1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.social.service.base;
24  
25  import com.liferay.counter.service.CounterLocalService;
26  import com.liferay.counter.service.CounterService;
27  
28  import com.liferay.portal.PortalException;
29  import com.liferay.portal.SystemException;
30  import com.liferay.portal.kernel.bean.InitializingBean;
31  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
32  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
33  import com.liferay.portal.service.UserLocalService;
34  import com.liferay.portal.service.UserService;
35  import com.liferay.portal.service.persistence.UserFinder;
36  import com.liferay.portal.service.persistence.UserPersistence;
37  
38  import com.liferay.portlet.social.model.SocialRelation;
39  import com.liferay.portlet.social.service.SocialActivityInterpreterLocalService;
40  import com.liferay.portlet.social.service.SocialActivityLocalService;
41  import com.liferay.portlet.social.service.SocialRelationLocalService;
42  import com.liferay.portlet.social.service.SocialRequestInterpreterLocalService;
43  import com.liferay.portlet.social.service.SocialRequestLocalService;
44  import com.liferay.portlet.social.service.persistence.SocialActivityFinder;
45  import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
46  import com.liferay.portlet.social.service.persistence.SocialRelationPersistence;
47  import com.liferay.portlet.social.service.persistence.SocialRequestPersistence;
48  
49  import java.util.List;
50  
51  /**
52   * <a href="SocialRelationLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
53   *
54   * @author Brian Wing Shun Chan
55   *
56   */
57  public abstract class SocialRelationLocalServiceBaseImpl
58      implements SocialRelationLocalService, InitializingBean {
59      public SocialRelation addSocialRelation(SocialRelation socialRelation)
60          throws SystemException {
61          socialRelation.setNew(true);
62  
63          return socialRelationPersistence.update(socialRelation, false);
64      }
65  
66      public void deleteSocialRelation(long relationId)
67          throws PortalException, SystemException {
68          socialRelationPersistence.remove(relationId);
69      }
70  
71      public void deleteSocialRelation(SocialRelation socialRelation)
72          throws SystemException {
73          socialRelationPersistence.remove(socialRelation);
74      }
75  
76      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
77          throws SystemException {
78          return socialRelationPersistence.findWithDynamicQuery(dynamicQuery);
79      }
80  
81      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
82          int end) throws SystemException {
83          return socialRelationPersistence.findWithDynamicQuery(dynamicQuery,
84              start, end);
85      }
86  
87      public SocialRelation getSocialRelation(long relationId)
88          throws PortalException, SystemException {
89          return socialRelationPersistence.findByPrimaryKey(relationId);
90      }
91  
92      public List<SocialRelation> getSocialRelations(int start, int end)
93          throws SystemException {
94          return socialRelationPersistence.findAll(start, end);
95      }
96  
97      public int getSocialRelationsCount() throws SystemException {
98          return socialRelationPersistence.countAll();
99      }
100 
101     public SocialRelation updateSocialRelation(SocialRelation socialRelation)
102         throws SystemException {
103         socialRelation.setNew(false);
104 
105         return socialRelationPersistence.update(socialRelation, true);
106     }
107 
108     public SocialActivityLocalService getSocialActivityLocalService() {
109         return socialActivityLocalService;
110     }
111 
112     public void setSocialActivityLocalService(
113         SocialActivityLocalService socialActivityLocalService) {
114         this.socialActivityLocalService = socialActivityLocalService;
115     }
116 
117     public SocialActivityPersistence getSocialActivityPersistence() {
118         return socialActivityPersistence;
119     }
120 
121     public void setSocialActivityPersistence(
122         SocialActivityPersistence socialActivityPersistence) {
123         this.socialActivityPersistence = socialActivityPersistence;
124     }
125 
126     public SocialActivityFinder getSocialActivityFinder() {
127         return socialActivityFinder;
128     }
129 
130     public void setSocialActivityFinder(
131         SocialActivityFinder socialActivityFinder) {
132         this.socialActivityFinder = socialActivityFinder;
133     }
134 
135     public SocialActivityInterpreterLocalService getSocialActivityInterpreterLocalService() {
136         return socialActivityInterpreterLocalService;
137     }
138 
139     public void setSocialActivityInterpreterLocalService(
140         SocialActivityInterpreterLocalService socialActivityInterpreterLocalService) {
141         this.socialActivityInterpreterLocalService = socialActivityInterpreterLocalService;
142     }
143 
144     public SocialRelationPersistence getSocialRelationPersistence() {
145         return socialRelationPersistence;
146     }
147 
148     public void setSocialRelationPersistence(
149         SocialRelationPersistence socialRelationPersistence) {
150         this.socialRelationPersistence = socialRelationPersistence;
151     }
152 
153     public SocialRequestLocalService getSocialRequestLocalService() {
154         return socialRequestLocalService;
155     }
156 
157     public void setSocialRequestLocalService(
158         SocialRequestLocalService socialRequestLocalService) {
159         this.socialRequestLocalService = socialRequestLocalService;
160     }
161 
162     public SocialRequestPersistence getSocialRequestPersistence() {
163         return socialRequestPersistence;
164     }
165 
166     public void setSocialRequestPersistence(
167         SocialRequestPersistence socialRequestPersistence) {
168         this.socialRequestPersistence = socialRequestPersistence;
169     }
170 
171     public SocialRequestInterpreterLocalService getSocialRequestInterpreterLocalService() {
172         return socialRequestInterpreterLocalService;
173     }
174 
175     public void setSocialRequestInterpreterLocalService(
176         SocialRequestInterpreterLocalService socialRequestInterpreterLocalService) {
177         this.socialRequestInterpreterLocalService = socialRequestInterpreterLocalService;
178     }
179 
180     public CounterLocalService getCounterLocalService() {
181         return counterLocalService;
182     }
183 
184     public void setCounterLocalService(CounterLocalService counterLocalService) {
185         this.counterLocalService = counterLocalService;
186     }
187 
188     public CounterService getCounterService() {
189         return counterService;
190     }
191 
192     public void setCounterService(CounterService counterService) {
193         this.counterService = counterService;
194     }
195 
196     public UserLocalService getUserLocalService() {
197         return userLocalService;
198     }
199 
200     public void setUserLocalService(UserLocalService userLocalService) {
201         this.userLocalService = userLocalService;
202     }
203 
204     public UserService getUserService() {
205         return userService;
206     }
207 
208     public void setUserService(UserService userService) {
209         this.userService = userService;
210     }
211 
212     public UserPersistence getUserPersistence() {
213         return userPersistence;
214     }
215 
216     public void setUserPersistence(UserPersistence userPersistence) {
217         this.userPersistence = userPersistence;
218     }
219 
220     public UserFinder getUserFinder() {
221         return userFinder;
222     }
223 
224     public void setUserFinder(UserFinder userFinder) {
225         this.userFinder = userFinder;
226     }
227 
228     public void afterPropertiesSet() {
229         if (socialActivityLocalService == null) {
230             socialActivityLocalService = (SocialActivityLocalService)PortalBeanLocatorUtil.locate(SocialActivityLocalService.class.getName() +
231                     ".impl");
232         }
233 
234         if (socialActivityPersistence == null) {
235             socialActivityPersistence = (SocialActivityPersistence)PortalBeanLocatorUtil.locate(SocialActivityPersistence.class.getName() +
236                     ".impl");
237         }
238 
239         if (socialActivityFinder == null) {
240             socialActivityFinder = (SocialActivityFinder)PortalBeanLocatorUtil.locate(SocialActivityFinder.class.getName() +
241                     ".impl");
242         }
243 
244         if (socialActivityInterpreterLocalService == null) {
245             socialActivityInterpreterLocalService = (SocialActivityInterpreterLocalService)PortalBeanLocatorUtil.locate(SocialActivityInterpreterLocalService.class.getName() +
246                     ".impl");
247         }
248 
249         if (socialRelationPersistence == null) {
250             socialRelationPersistence = (SocialRelationPersistence)PortalBeanLocatorUtil.locate(SocialRelationPersistence.class.getName() +
251                     ".impl");
252         }
253 
254         if (socialRequestLocalService == null) {
255             socialRequestLocalService = (SocialRequestLocalService)PortalBeanLocatorUtil.locate(SocialRequestLocalService.class.getName() +
256                     ".impl");
257         }
258 
259         if (socialRequestPersistence == null) {
260             socialRequestPersistence = (SocialRequestPersistence)PortalBeanLocatorUtil.locate(SocialRequestPersistence.class.getName() +
261                     ".impl");
262         }
263 
264         if (socialRequestInterpreterLocalService == null) {
265             socialRequestInterpreterLocalService = (SocialRequestInterpreterLocalService)PortalBeanLocatorUtil.locate(SocialRequestInterpreterLocalService.class.getName() +
266                     ".impl");
267         }
268 
269         if (counterLocalService == null) {
270             counterLocalService = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName() +
271                     ".impl");
272         }
273 
274         if (counterService == null) {
275             counterService = (CounterService)PortalBeanLocatorUtil.locate(CounterService.class.getName() +
276                     ".impl");
277         }
278 
279         if (userLocalService == null) {
280             userLocalService = (UserLocalService)PortalBeanLocatorUtil.locate(UserLocalService.class.getName() +
281                     ".impl");
282         }
283 
284         if (userService == null) {
285             userService = (UserService)PortalBeanLocatorUtil.locate(UserService.class.getName() +
286                     ".impl");
287         }
288 
289         if (userPersistence == null) {
290             userPersistence = (UserPersistence)PortalBeanLocatorUtil.locate(UserPersistence.class.getName() +
291                     ".impl");
292         }
293 
294         if (userFinder == null) {
295             userFinder = (UserFinder)PortalBeanLocatorUtil.locate(UserFinder.class.getName() +
296                     ".impl");
297         }
298     }
299 
300     protected SocialActivityLocalService socialActivityLocalService;
301     protected SocialActivityPersistence socialActivityPersistence;
302     protected SocialActivityFinder socialActivityFinder;
303     protected SocialActivityInterpreterLocalService socialActivityInterpreterLocalService;
304     protected SocialRelationPersistence socialRelationPersistence;
305     protected SocialRequestLocalService socialRequestLocalService;
306     protected SocialRequestPersistence socialRequestPersistence;
307     protected SocialRequestInterpreterLocalService socialRequestInterpreterLocalService;
308     protected CounterLocalService counterLocalService;
309     protected CounterService counterService;
310     protected UserLocalService userLocalService;
311     protected UserService userService;
312     protected UserPersistence userPersistence;
313     protected UserFinder userFinder;
314 }