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