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