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.ratings.model.RatingsStats;
36  import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
37  import com.liferay.portlet.ratings.service.RatingsEntryService;
38  import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
39  import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
40  import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
41  
42  import java.util.List;
43  
44  /**
45   * <a href="RatingsStatsLocalServiceBaseImpl.java.html"><b><i>View Source</i>
46   * </b></a>
47   *
48   * @author Brian Wing Shun Chan
49   */
50  public abstract class RatingsStatsLocalServiceBaseImpl
51      implements RatingsStatsLocalService {
52      public RatingsStats addRatingsStats(RatingsStats ratingsStats)
53          throws SystemException {
54          ratingsStats.setNew(true);
55  
56          return ratingsStatsPersistence.update(ratingsStats, false);
57      }
58  
59      public RatingsStats createRatingsStats(long statsId) {
60          return ratingsStatsPersistence.create(statsId);
61      }
62  
63      public void deleteRatingsStats(long statsId)
64          throws PortalException, SystemException {
65          ratingsStatsPersistence.remove(statsId);
66      }
67  
68      public void deleteRatingsStats(RatingsStats ratingsStats)
69          throws SystemException {
70          ratingsStatsPersistence.remove(ratingsStats);
71      }
72  
73      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
74          throws SystemException {
75          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery);
76      }
77  
78      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
79          int end) throws SystemException {
80          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
81              start, end);
82      }
83  
84      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
85          int end, OrderByComparator orderByComparator) throws SystemException {
86          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
87              start, end, orderByComparator);
88      }
89  
90      public int dynamicQueryCount(DynamicQuery dynamicQuery)
91          throws SystemException {
92          return ratingsStatsPersistence.countWithDynamicQuery(dynamicQuery);
93      }
94  
95      public RatingsStats getRatingsStats(long statsId)
96          throws PortalException, SystemException {
97          return ratingsStatsPersistence.findByPrimaryKey(statsId);
98      }
99  
100     public List<RatingsStats> getRatingsStatses(int start, int end)
101         throws SystemException {
102         return ratingsStatsPersistence.findAll(start, end);
103     }
104 
105     public int getRatingsStatsesCount() throws SystemException {
106         return ratingsStatsPersistence.countAll();
107     }
108 
109     public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
110         throws SystemException {
111         ratingsStats.setNew(false);
112 
113         return ratingsStatsPersistence.update(ratingsStats, true);
114     }
115 
116     public RatingsStats updateRatingsStats(RatingsStats ratingsStats,
117         boolean merge) throws SystemException {
118         ratingsStats.setNew(false);
119 
120         return ratingsStatsPersistence.update(ratingsStats, merge);
121     }
122 
123     public RatingsEntryLocalService getRatingsEntryLocalService() {
124         return ratingsEntryLocalService;
125     }
126 
127     public void setRatingsEntryLocalService(
128         RatingsEntryLocalService ratingsEntryLocalService) {
129         this.ratingsEntryLocalService = ratingsEntryLocalService;
130     }
131 
132     public RatingsEntryService getRatingsEntryService() {
133         return ratingsEntryService;
134     }
135 
136     public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
137         this.ratingsEntryService = ratingsEntryService;
138     }
139 
140     public RatingsEntryPersistence getRatingsEntryPersistence() {
141         return ratingsEntryPersistence;
142     }
143 
144     public void setRatingsEntryPersistence(
145         RatingsEntryPersistence ratingsEntryPersistence) {
146         this.ratingsEntryPersistence = ratingsEntryPersistence;
147     }
148 
149     public RatingsStatsLocalService getRatingsStatsLocalService() {
150         return ratingsStatsLocalService;
151     }
152 
153     public void setRatingsStatsLocalService(
154         RatingsStatsLocalService ratingsStatsLocalService) {
155         this.ratingsStatsLocalService = ratingsStatsLocalService;
156     }
157 
158     public RatingsStatsPersistence getRatingsStatsPersistence() {
159         return ratingsStatsPersistence;
160     }
161 
162     public void setRatingsStatsPersistence(
163         RatingsStatsPersistence ratingsStatsPersistence) {
164         this.ratingsStatsPersistence = ratingsStatsPersistence;
165     }
166 
167     public CounterLocalService getCounterLocalService() {
168         return counterLocalService;
169     }
170 
171     public void setCounterLocalService(CounterLocalService counterLocalService) {
172         this.counterLocalService = counterLocalService;
173     }
174 
175     public ResourceLocalService getResourceLocalService() {
176         return resourceLocalService;
177     }
178 
179     public void setResourceLocalService(
180         ResourceLocalService resourceLocalService) {
181         this.resourceLocalService = resourceLocalService;
182     }
183 
184     public ResourceService getResourceService() {
185         return resourceService;
186     }
187 
188     public void setResourceService(ResourceService resourceService) {
189         this.resourceService = resourceService;
190     }
191 
192     public ResourcePersistence getResourcePersistence() {
193         return resourcePersistence;
194     }
195 
196     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
197         this.resourcePersistence = resourcePersistence;
198     }
199 
200     public ResourceFinder getResourceFinder() {
201         return resourceFinder;
202     }
203 
204     public void setResourceFinder(ResourceFinder resourceFinder) {
205         this.resourceFinder = resourceFinder;
206     }
207 
208     public UserLocalService getUserLocalService() {
209         return userLocalService;
210     }
211 
212     public void setUserLocalService(UserLocalService userLocalService) {
213         this.userLocalService = userLocalService;
214     }
215 
216     public UserService getUserService() {
217         return userService;
218     }
219 
220     public void setUserService(UserService userService) {
221         this.userService = userService;
222     }
223 
224     public UserPersistence getUserPersistence() {
225         return userPersistence;
226     }
227 
228     public void setUserPersistence(UserPersistence userPersistence) {
229         this.userPersistence = userPersistence;
230     }
231 
232     public UserFinder getUserFinder() {
233         return userFinder;
234     }
235 
236     public void setUserFinder(UserFinder userFinder) {
237         this.userFinder = userFinder;
238     }
239 
240     protected void runSQL(String sql) throws SystemException {
241         try {
242             DB db = DBFactoryUtil.getDB();
243 
244             db.runSQL(sql);
245         }
246         catch (Exception e) {
247             throw new SystemException(e);
248         }
249     }
250 
251     @BeanReference(type = RatingsEntryLocalService.class)
252     protected RatingsEntryLocalService ratingsEntryLocalService;
253     @BeanReference(type = RatingsEntryService.class)
254     protected RatingsEntryService ratingsEntryService;
255     @BeanReference(type = RatingsEntryPersistence.class)
256     protected RatingsEntryPersistence ratingsEntryPersistence;
257     @BeanReference(type = RatingsStatsLocalService.class)
258     protected RatingsStatsLocalService ratingsStatsLocalService;
259     @BeanReference(type = RatingsStatsPersistence.class)
260     protected RatingsStatsPersistence ratingsStatsPersistence;
261     @BeanReference(type = CounterLocalService.class)
262     protected CounterLocalService counterLocalService;
263     @BeanReference(type = ResourceLocalService.class)
264     protected ResourceLocalService resourceLocalService;
265     @BeanReference(type = ResourceService.class)
266     protected ResourceService resourceService;
267     @BeanReference(type = ResourcePersistence.class)
268     protected ResourcePersistence resourcePersistence;
269     @BeanReference(type = ResourceFinder.class)
270     protected ResourceFinder resourceFinder;
271     @BeanReference(type = UserLocalService.class)
272     protected UserLocalService userLocalService;
273     @BeanReference(type = UserService.class)
274     protected UserService userService;
275     @BeanReference(type = UserPersistence.class)
276     protected UserPersistence userPersistence;
277     @BeanReference(type = UserFinder.class)
278     protected UserFinder userFinder;
279 }