1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.portlet.social.service.base;
16  
17  import com.liferay.counter.service.CounterLocalService;
18  import com.liferay.counter.service.CounterService;
19  
20  import com.liferay.portal.PortalException;
21  import com.liferay.portal.SystemException;
22  import com.liferay.portal.kernel.annotation.BeanReference;
23  import com.liferay.portal.kernel.dao.db.DB;
24  import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
25  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
26  import com.liferay.portal.kernel.util.OrderByComparator;
27  import com.liferay.portal.service.ResourceLocalService;
28  import com.liferay.portal.service.ResourceService;
29  import com.liferay.portal.service.UserLocalService;
30  import com.liferay.portal.service.UserService;
31  import com.liferay.portal.service.persistence.ResourceFinder;
32  import com.liferay.portal.service.persistence.ResourcePersistence;
33  import com.liferay.portal.service.persistence.UserFinder;
34  import com.liferay.portal.service.persistence.UserPersistence;
35  
36  import com.liferay.portlet.social.model.SocialRelation;
37  import com.liferay.portlet.social.service.SocialActivityInterpreterLocalService;
38  import com.liferay.portlet.social.service.SocialActivityLocalService;
39  import com.liferay.portlet.social.service.SocialRelationLocalService;
40  import com.liferay.portlet.social.service.SocialRequestInterpreterLocalService;
41  import com.liferay.portlet.social.service.SocialRequestLocalService;
42  import com.liferay.portlet.social.service.persistence.SocialActivityFinder;
43  import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
44  import com.liferay.portlet.social.service.persistence.SocialRelationPersistence;
45  import com.liferay.portlet.social.service.persistence.SocialRequestPersistence;
46  
47  import java.util.List;
48  
49  /**
50   * <a href="SocialRelationLocalServiceBaseImpl.java.html"><b><i>View Source</i>
51   * </b></a>
52   *
53   * @author Brian Wing Shun Chan
54   */
55  public abstract class SocialRelationLocalServiceBaseImpl
56      implements SocialRelationLocalService {
57      public SocialRelation addSocialRelation(SocialRelation socialRelation)
58          throws SystemException {
59          socialRelation.setNew(true);
60  
61          return socialRelationPersistence.update(socialRelation, false);
62      }
63  
64      public SocialRelation createSocialRelation(long relationId) {
65          return socialRelationPersistence.create(relationId);
66      }
67  
68      public void deleteSocialRelation(long relationId)
69          throws PortalException, SystemException {
70          socialRelationPersistence.remove(relationId);
71      }
72  
73      public void deleteSocialRelation(SocialRelation socialRelation)
74          throws SystemException {
75          socialRelationPersistence.remove(socialRelation);
76      }
77  
78      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
79          throws SystemException {
80          return socialRelationPersistence.findWithDynamicQuery(dynamicQuery);
81      }
82  
83      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
84          int end) throws SystemException {
85          return socialRelationPersistence.findWithDynamicQuery(dynamicQuery,
86              start, end);
87      }
88  
89      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
90          int end, OrderByComparator orderByComparator) throws SystemException {
91          return socialRelationPersistence.findWithDynamicQuery(dynamicQuery,
92              start, end, orderByComparator);
93      }
94  
95      public int dynamicQueryCount(DynamicQuery dynamicQuery)
96          throws SystemException {
97          return socialRelationPersistence.countWithDynamicQuery(dynamicQuery);
98      }
99  
100     public SocialRelation getSocialRelation(long relationId)
101         throws PortalException, SystemException {
102         return socialRelationPersistence.findByPrimaryKey(relationId);
103     }
104 
105     public List<SocialRelation> getSocialRelations(int start, int end)
106         throws SystemException {
107         return socialRelationPersistence.findAll(start, end);
108     }
109 
110     public int getSocialRelationsCount() throws SystemException {
111         return socialRelationPersistence.countAll();
112     }
113 
114     public SocialRelation updateSocialRelation(SocialRelation socialRelation)
115         throws SystemException {
116         socialRelation.setNew(false);
117 
118         return socialRelationPersistence.update(socialRelation, true);
119     }
120 
121     public SocialRelation updateSocialRelation(SocialRelation socialRelation,
122         boolean merge) throws SystemException {
123         socialRelation.setNew(false);
124 
125         return socialRelationPersistence.update(socialRelation, merge);
126     }
127 
128     public SocialActivityLocalService getSocialActivityLocalService() {
129         return socialActivityLocalService;
130     }
131 
132     public void setSocialActivityLocalService(
133         SocialActivityLocalService socialActivityLocalService) {
134         this.socialActivityLocalService = socialActivityLocalService;
135     }
136 
137     public SocialActivityPersistence getSocialActivityPersistence() {
138         return socialActivityPersistence;
139     }
140 
141     public void setSocialActivityPersistence(
142         SocialActivityPersistence socialActivityPersistence) {
143         this.socialActivityPersistence = socialActivityPersistence;
144     }
145 
146     public SocialActivityFinder getSocialActivityFinder() {
147         return socialActivityFinder;
148     }
149 
150     public void setSocialActivityFinder(
151         SocialActivityFinder socialActivityFinder) {
152         this.socialActivityFinder = socialActivityFinder;
153     }
154 
155     public SocialActivityInterpreterLocalService getSocialActivityInterpreterLocalService() {
156         return socialActivityInterpreterLocalService;
157     }
158 
159     public void setSocialActivityInterpreterLocalService(
160         SocialActivityInterpreterLocalService socialActivityInterpreterLocalService) {
161         this.socialActivityInterpreterLocalService = socialActivityInterpreterLocalService;
162     }
163 
164     public SocialRelationLocalService getSocialRelationLocalService() {
165         return socialRelationLocalService;
166     }
167 
168     public void setSocialRelationLocalService(
169         SocialRelationLocalService socialRelationLocalService) {
170         this.socialRelationLocalService = socialRelationLocalService;
171     }
172 
173     public SocialRelationPersistence getSocialRelationPersistence() {
174         return socialRelationPersistence;
175     }
176 
177     public void setSocialRelationPersistence(
178         SocialRelationPersistence socialRelationPersistence) {
179         this.socialRelationPersistence = socialRelationPersistence;
180     }
181 
182     public SocialRequestLocalService getSocialRequestLocalService() {
183         return socialRequestLocalService;
184     }
185 
186     public void setSocialRequestLocalService(
187         SocialRequestLocalService socialRequestLocalService) {
188         this.socialRequestLocalService = socialRequestLocalService;
189     }
190 
191     public SocialRequestPersistence getSocialRequestPersistence() {
192         return socialRequestPersistence;
193     }
194 
195     public void setSocialRequestPersistence(
196         SocialRequestPersistence socialRequestPersistence) {
197         this.socialRequestPersistence = socialRequestPersistence;
198     }
199 
200     public SocialRequestInterpreterLocalService getSocialRequestInterpreterLocalService() {
201         return socialRequestInterpreterLocalService;
202     }
203 
204     public void setSocialRequestInterpreterLocalService(
205         SocialRequestInterpreterLocalService socialRequestInterpreterLocalService) {
206         this.socialRequestInterpreterLocalService = socialRequestInterpreterLocalService;
207     }
208 
209     public CounterLocalService getCounterLocalService() {
210         return counterLocalService;
211     }
212 
213     public void setCounterLocalService(CounterLocalService counterLocalService) {
214         this.counterLocalService = counterLocalService;
215     }
216 
217     public CounterService getCounterService() {
218         return counterService;
219     }
220 
221     public void setCounterService(CounterService counterService) {
222         this.counterService = counterService;
223     }
224 
225     public ResourceLocalService getResourceLocalService() {
226         return resourceLocalService;
227     }
228 
229     public void setResourceLocalService(
230         ResourceLocalService resourceLocalService) {
231         this.resourceLocalService = resourceLocalService;
232     }
233 
234     public ResourceService getResourceService() {
235         return resourceService;
236     }
237 
238     public void setResourceService(ResourceService resourceService) {
239         this.resourceService = resourceService;
240     }
241 
242     public ResourcePersistence getResourcePersistence() {
243         return resourcePersistence;
244     }
245 
246     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
247         this.resourcePersistence = resourcePersistence;
248     }
249 
250     public ResourceFinder getResourceFinder() {
251         return resourceFinder;
252     }
253 
254     public void setResourceFinder(ResourceFinder resourceFinder) {
255         this.resourceFinder = resourceFinder;
256     }
257 
258     public UserLocalService getUserLocalService() {
259         return userLocalService;
260     }
261 
262     public void setUserLocalService(UserLocalService userLocalService) {
263         this.userLocalService = userLocalService;
264     }
265 
266     public UserService getUserService() {
267         return userService;
268     }
269 
270     public void setUserService(UserService userService) {
271         this.userService = userService;
272     }
273 
274     public UserPersistence getUserPersistence() {
275         return userPersistence;
276     }
277 
278     public void setUserPersistence(UserPersistence userPersistence) {
279         this.userPersistence = userPersistence;
280     }
281 
282     public UserFinder getUserFinder() {
283         return userFinder;
284     }
285 
286     public void setUserFinder(UserFinder userFinder) {
287         this.userFinder = userFinder;
288     }
289 
290     protected void runSQL(String sql) throws SystemException {
291         try {
292             DB db = DBFactoryUtil.getDB();
293 
294             db.runSQL(sql);
295         }
296         catch (Exception e) {
297             throw new SystemException(e);
298         }
299     }
300 
301     @BeanReference(type = SocialActivityLocalService.class)
302     protected SocialActivityLocalService socialActivityLocalService;
303     @BeanReference(type = SocialActivityPersistence.class)
304     protected SocialActivityPersistence socialActivityPersistence;
305     @BeanReference(type = SocialActivityFinder.class)
306     protected SocialActivityFinder socialActivityFinder;
307     @BeanReference(type = SocialActivityInterpreterLocalService.class)
308     protected SocialActivityInterpreterLocalService socialActivityInterpreterLocalService;
309     @BeanReference(type = SocialRelationLocalService.class)
310     protected SocialRelationLocalService socialRelationLocalService;
311     @BeanReference(type = SocialRelationPersistence.class)
312     protected SocialRelationPersistence socialRelationPersistence;
313     @BeanReference(type = SocialRequestLocalService.class)
314     protected SocialRequestLocalService socialRequestLocalService;
315     @BeanReference(type = SocialRequestPersistence.class)
316     protected SocialRequestPersistence socialRequestPersistence;
317     @BeanReference(type = SocialRequestInterpreterLocalService.class)
318     protected SocialRequestInterpreterLocalService socialRequestInterpreterLocalService;
319     @BeanReference(type = CounterLocalService.class)
320     protected CounterLocalService counterLocalService;
321     @BeanReference(type = CounterService.class)
322     protected CounterService counterService;
323     @BeanReference(type = ResourceLocalService.class)
324     protected ResourceLocalService resourceLocalService;
325     @BeanReference(type = ResourceService.class)
326     protected ResourceService resourceService;
327     @BeanReference(type = ResourcePersistence.class)
328     protected ResourcePersistence resourcePersistence;
329     @BeanReference(type = ResourceFinder.class)
330     protected ResourceFinder resourceFinder;
331     @BeanReference(type = UserLocalService.class)
332     protected UserLocalService userLocalService;
333     @BeanReference(type = UserService.class)
334     protected UserService userService;
335     @BeanReference(type = UserPersistence.class)
336     protected UserPersistence userPersistence;
337     @BeanReference(type = UserFinder.class)
338     protected UserFinder userFinder;
339 }