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