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.ratings.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.blogs.service.BlogsEntryLocalService;
36  import com.liferay.portlet.blogs.service.BlogsEntryService;
37  import com.liferay.portlet.blogs.service.BlogsStatsUserLocalService;
38  import com.liferay.portlet.blogs.service.persistence.BlogsEntryFinder;
39  import com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence;
40  import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserFinder;
41  import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence;
42  import com.liferay.portlet.ratings.model.RatingsEntry;
43  import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
44  import com.liferay.portlet.ratings.service.RatingsEntryService;
45  import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
46  import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
47  import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
48  
49  import java.util.List;
50  
51  /**
52   * <a href="RatingsEntryLocalServiceBaseImpl.java.html"><b><i>View Source</i>
53   * </b></a>
54   *
55   * @author Brian Wing Shun Chan
56   */
57  public abstract class RatingsEntryLocalServiceBaseImpl
58      implements RatingsEntryLocalService {
59      public RatingsEntry addRatingsEntry(RatingsEntry ratingsEntry)
60          throws SystemException {
61          ratingsEntry.setNew(true);
62  
63          return ratingsEntryPersistence.update(ratingsEntry, false);
64      }
65  
66      public RatingsEntry createRatingsEntry(long entryId) {
67          return ratingsEntryPersistence.create(entryId);
68      }
69  
70      public void deleteRatingsEntry(long entryId)
71          throws PortalException, SystemException {
72          ratingsEntryPersistence.remove(entryId);
73      }
74  
75      public void deleteRatingsEntry(RatingsEntry ratingsEntry)
76          throws SystemException {
77          ratingsEntryPersistence.remove(ratingsEntry);
78      }
79  
80      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
81          throws SystemException {
82          return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery);
83      }
84  
85      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
86          int end) throws SystemException {
87          return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery,
88              start, end);
89      }
90  
91      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
92          int end, OrderByComparator orderByComparator) throws SystemException {
93          return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery,
94              start, end, orderByComparator);
95      }
96  
97      public int dynamicQueryCount(DynamicQuery dynamicQuery)
98          throws SystemException {
99          return ratingsEntryPersistence.countWithDynamicQuery(dynamicQuery);
100     }
101 
102     public RatingsEntry getRatingsEntry(long entryId)
103         throws PortalException, SystemException {
104         return ratingsEntryPersistence.findByPrimaryKey(entryId);
105     }
106 
107     public List<RatingsEntry> getRatingsEntries(int start, int end)
108         throws SystemException {
109         return ratingsEntryPersistence.findAll(start, end);
110     }
111 
112     public int getRatingsEntriesCount() throws SystemException {
113         return ratingsEntryPersistence.countAll();
114     }
115 
116     public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry)
117         throws SystemException {
118         ratingsEntry.setNew(false);
119 
120         return ratingsEntryPersistence.update(ratingsEntry, true);
121     }
122 
123     public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry,
124         boolean merge) throws SystemException {
125         ratingsEntry.setNew(false);
126 
127         return ratingsEntryPersistence.update(ratingsEntry, merge);
128     }
129 
130     public RatingsEntryLocalService getRatingsEntryLocalService() {
131         return ratingsEntryLocalService;
132     }
133 
134     public void setRatingsEntryLocalService(
135         RatingsEntryLocalService ratingsEntryLocalService) {
136         this.ratingsEntryLocalService = ratingsEntryLocalService;
137     }
138 
139     public RatingsEntryService getRatingsEntryService() {
140         return ratingsEntryService;
141     }
142 
143     public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
144         this.ratingsEntryService = ratingsEntryService;
145     }
146 
147     public RatingsEntryPersistence getRatingsEntryPersistence() {
148         return ratingsEntryPersistence;
149     }
150 
151     public void setRatingsEntryPersistence(
152         RatingsEntryPersistence ratingsEntryPersistence) {
153         this.ratingsEntryPersistence = ratingsEntryPersistence;
154     }
155 
156     public RatingsStatsLocalService getRatingsStatsLocalService() {
157         return ratingsStatsLocalService;
158     }
159 
160     public void setRatingsStatsLocalService(
161         RatingsStatsLocalService ratingsStatsLocalService) {
162         this.ratingsStatsLocalService = ratingsStatsLocalService;
163     }
164 
165     public RatingsStatsPersistence getRatingsStatsPersistence() {
166         return ratingsStatsPersistence;
167     }
168 
169     public void setRatingsStatsPersistence(
170         RatingsStatsPersistence ratingsStatsPersistence) {
171         this.ratingsStatsPersistence = ratingsStatsPersistence;
172     }
173 
174     public CounterLocalService getCounterLocalService() {
175         return counterLocalService;
176     }
177 
178     public void setCounterLocalService(CounterLocalService counterLocalService) {
179         this.counterLocalService = counterLocalService;
180     }
181 
182     public ResourceLocalService getResourceLocalService() {
183         return resourceLocalService;
184     }
185 
186     public void setResourceLocalService(
187         ResourceLocalService resourceLocalService) {
188         this.resourceLocalService = resourceLocalService;
189     }
190 
191     public ResourceService getResourceService() {
192         return resourceService;
193     }
194 
195     public void setResourceService(ResourceService resourceService) {
196         this.resourceService = resourceService;
197     }
198 
199     public ResourcePersistence getResourcePersistence() {
200         return resourcePersistence;
201     }
202 
203     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
204         this.resourcePersistence = resourcePersistence;
205     }
206 
207     public ResourceFinder getResourceFinder() {
208         return resourceFinder;
209     }
210 
211     public void setResourceFinder(ResourceFinder resourceFinder) {
212         this.resourceFinder = resourceFinder;
213     }
214 
215     public UserLocalService getUserLocalService() {
216         return userLocalService;
217     }
218 
219     public void setUserLocalService(UserLocalService userLocalService) {
220         this.userLocalService = userLocalService;
221     }
222 
223     public UserService getUserService() {
224         return userService;
225     }
226 
227     public void setUserService(UserService userService) {
228         this.userService = userService;
229     }
230 
231     public UserPersistence getUserPersistence() {
232         return userPersistence;
233     }
234 
235     public void setUserPersistence(UserPersistence userPersistence) {
236         this.userPersistence = userPersistence;
237     }
238 
239     public UserFinder getUserFinder() {
240         return userFinder;
241     }
242 
243     public void setUserFinder(UserFinder userFinder) {
244         this.userFinder = userFinder;
245     }
246 
247     public BlogsEntryLocalService getBlogsEntryLocalService() {
248         return blogsEntryLocalService;
249     }
250 
251     public void setBlogsEntryLocalService(
252         BlogsEntryLocalService blogsEntryLocalService) {
253         this.blogsEntryLocalService = blogsEntryLocalService;
254     }
255 
256     public BlogsEntryService getBlogsEntryService() {
257         return blogsEntryService;
258     }
259 
260     public void setBlogsEntryService(BlogsEntryService blogsEntryService) {
261         this.blogsEntryService = blogsEntryService;
262     }
263 
264     public BlogsEntryPersistence getBlogsEntryPersistence() {
265         return blogsEntryPersistence;
266     }
267 
268     public void setBlogsEntryPersistence(
269         BlogsEntryPersistence blogsEntryPersistence) {
270         this.blogsEntryPersistence = blogsEntryPersistence;
271     }
272 
273     public BlogsEntryFinder getBlogsEntryFinder() {
274         return blogsEntryFinder;
275     }
276 
277     public void setBlogsEntryFinder(BlogsEntryFinder blogsEntryFinder) {
278         this.blogsEntryFinder = blogsEntryFinder;
279     }
280 
281     public BlogsStatsUserLocalService getBlogsStatsUserLocalService() {
282         return blogsStatsUserLocalService;
283     }
284 
285     public void setBlogsStatsUserLocalService(
286         BlogsStatsUserLocalService blogsStatsUserLocalService) {
287         this.blogsStatsUserLocalService = blogsStatsUserLocalService;
288     }
289 
290     public BlogsStatsUserPersistence getBlogsStatsUserPersistence() {
291         return blogsStatsUserPersistence;
292     }
293 
294     public void setBlogsStatsUserPersistence(
295         BlogsStatsUserPersistence blogsStatsUserPersistence) {
296         this.blogsStatsUserPersistence = blogsStatsUserPersistence;
297     }
298 
299     public BlogsStatsUserFinder getBlogsStatsUserFinder() {
300         return blogsStatsUserFinder;
301     }
302 
303     public void setBlogsStatsUserFinder(
304         BlogsStatsUserFinder blogsStatsUserFinder) {
305         this.blogsStatsUserFinder = blogsStatsUserFinder;
306     }
307 
308     protected void runSQL(String sql) throws SystemException {
309         try {
310             DB db = DBFactoryUtil.getDB();
311 
312             db.runSQL(sql);
313         }
314         catch (Exception e) {
315             throw new SystemException(e);
316         }
317     }
318 
319     @BeanReference(type = RatingsEntryLocalService.class)
320     protected RatingsEntryLocalService ratingsEntryLocalService;
321     @BeanReference(type = RatingsEntryService.class)
322     protected RatingsEntryService ratingsEntryService;
323     @BeanReference(type = RatingsEntryPersistence.class)
324     protected RatingsEntryPersistence ratingsEntryPersistence;
325     @BeanReference(type = RatingsStatsLocalService.class)
326     protected RatingsStatsLocalService ratingsStatsLocalService;
327     @BeanReference(type = RatingsStatsPersistence.class)
328     protected RatingsStatsPersistence ratingsStatsPersistence;
329     @BeanReference(type = CounterLocalService.class)
330     protected CounterLocalService counterLocalService;
331     @BeanReference(type = ResourceLocalService.class)
332     protected ResourceLocalService resourceLocalService;
333     @BeanReference(type = ResourceService.class)
334     protected ResourceService resourceService;
335     @BeanReference(type = ResourcePersistence.class)
336     protected ResourcePersistence resourcePersistence;
337     @BeanReference(type = ResourceFinder.class)
338     protected ResourceFinder resourceFinder;
339     @BeanReference(type = UserLocalService.class)
340     protected UserLocalService userLocalService;
341     @BeanReference(type = UserService.class)
342     protected UserService userService;
343     @BeanReference(type = UserPersistence.class)
344     protected UserPersistence userPersistence;
345     @BeanReference(type = UserFinder.class)
346     protected UserFinder userFinder;
347     @BeanReference(type = BlogsEntryLocalService.class)
348     protected BlogsEntryLocalService blogsEntryLocalService;
349     @BeanReference(type = BlogsEntryService.class)
350     protected BlogsEntryService blogsEntryService;
351     @BeanReference(type = BlogsEntryPersistence.class)
352     protected BlogsEntryPersistence blogsEntryPersistence;
353     @BeanReference(type = BlogsEntryFinder.class)
354     protected BlogsEntryFinder blogsEntryFinder;
355     @BeanReference(type = BlogsStatsUserLocalService.class)
356     protected BlogsStatsUserLocalService blogsStatsUserLocalService;
357     @BeanReference(type = BlogsStatsUserPersistence.class)
358     protected BlogsStatsUserPersistence blogsStatsUserPersistence;
359     @BeanReference(type = BlogsStatsUserFinder.class)
360     protected BlogsStatsUserFinder blogsStatsUserFinder;
361 }