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