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