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  import com.liferay.counter.service.CounterService;
19  
20  import com.liferay.portal.kernel.annotation.BeanReference;
21  import com.liferay.portal.kernel.dao.db.DB;
22  import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
23  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
24  import com.liferay.portal.kernel.exception.PortalException;
25  import com.liferay.portal.kernel.exception.SystemException;
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 RatingsStats getRatingsStats(long statsId)
85          throws PortalException, SystemException {
86          return ratingsStatsPersistence.findByPrimaryKey(statsId);
87      }
88  
89      public List<RatingsStats> getRatingsStatses(int start, int end)
90          throws SystemException {
91          return ratingsStatsPersistence.findAll(start, end);
92      }
93  
94      public int getRatingsStatsesCount() throws SystemException {
95          return ratingsStatsPersistence.countAll();
96      }
97  
98      public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
99          throws SystemException {
100         ratingsStats.setNew(false);
101 
102         return ratingsStatsPersistence.update(ratingsStats, true);
103     }
104 
105     public RatingsStats updateRatingsStats(RatingsStats ratingsStats,
106         boolean merge) throws SystemException {
107         ratingsStats.setNew(false);
108 
109         return ratingsStatsPersistence.update(ratingsStats, merge);
110     }
111 
112     public RatingsEntryLocalService getRatingsEntryLocalService() {
113         return ratingsEntryLocalService;
114     }
115 
116     public void setRatingsEntryLocalService(
117         RatingsEntryLocalService ratingsEntryLocalService) {
118         this.ratingsEntryLocalService = ratingsEntryLocalService;
119     }
120 
121     public RatingsEntryService getRatingsEntryService() {
122         return ratingsEntryService;
123     }
124 
125     public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
126         this.ratingsEntryService = ratingsEntryService;
127     }
128 
129     public RatingsEntryPersistence getRatingsEntryPersistence() {
130         return ratingsEntryPersistence;
131     }
132 
133     public void setRatingsEntryPersistence(
134         RatingsEntryPersistence ratingsEntryPersistence) {
135         this.ratingsEntryPersistence = ratingsEntryPersistence;
136     }
137 
138     public RatingsStatsLocalService getRatingsStatsLocalService() {
139         return ratingsStatsLocalService;
140     }
141 
142     public void setRatingsStatsLocalService(
143         RatingsStatsLocalService ratingsStatsLocalService) {
144         this.ratingsStatsLocalService = ratingsStatsLocalService;
145     }
146 
147     public RatingsStatsPersistence getRatingsStatsPersistence() {
148         return ratingsStatsPersistence;
149     }
150 
151     public void setRatingsStatsPersistence(
152         RatingsStatsPersistence ratingsStatsPersistence) {
153         this.ratingsStatsPersistence = ratingsStatsPersistence;
154     }
155 
156     public CounterLocalService getCounterLocalService() {
157         return counterLocalService;
158     }
159 
160     public void setCounterLocalService(CounterLocalService counterLocalService) {
161         this.counterLocalService = counterLocalService;
162     }
163 
164     public CounterService getCounterService() {
165         return counterService;
166     }
167 
168     public void setCounterService(CounterService counterService) {
169         this.counterService = counterService;
170     }
171 
172     public ResourceLocalService getResourceLocalService() {
173         return resourceLocalService;
174     }
175 
176     public void setResourceLocalService(
177         ResourceLocalService resourceLocalService) {
178         this.resourceLocalService = resourceLocalService;
179     }
180 
181     public ResourceService getResourceService() {
182         return resourceService;
183     }
184 
185     public void setResourceService(ResourceService resourceService) {
186         this.resourceService = resourceService;
187     }
188 
189     public ResourcePersistence getResourcePersistence() {
190         return resourcePersistence;
191     }
192 
193     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
194         this.resourcePersistence = resourcePersistence;
195     }
196 
197     public ResourceFinder getResourceFinder() {
198         return resourceFinder;
199     }
200 
201     public void setResourceFinder(ResourceFinder resourceFinder) {
202         this.resourceFinder = resourceFinder;
203     }
204 
205     public UserLocalService getUserLocalService() {
206         return userLocalService;
207     }
208 
209     public void setUserLocalService(UserLocalService userLocalService) {
210         this.userLocalService = userLocalService;
211     }
212 
213     public UserService getUserService() {
214         return userService;
215     }
216 
217     public void setUserService(UserService userService) {
218         this.userService = userService;
219     }
220 
221     public UserPersistence getUserPersistence() {
222         return userPersistence;
223     }
224 
225     public void setUserPersistence(UserPersistence userPersistence) {
226         this.userPersistence = userPersistence;
227     }
228 
229     public UserFinder getUserFinder() {
230         return userFinder;
231     }
232 
233     public void setUserFinder(UserFinder userFinder) {
234         this.userFinder = userFinder;
235     }
236 
237     protected void runSQL(String sql) throws SystemException {
238         try {
239             DB db = DBFactoryUtil.getDB();
240 
241             db.runSQL(sql);
242         }
243         catch (Exception e) {
244             throw new SystemException(e);
245         }
246     }
247 
248     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsEntryLocalService")
249     protected RatingsEntryLocalService ratingsEntryLocalService;
250     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsEntryService")
251     protected RatingsEntryService ratingsEntryService;
252     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence")
253     protected RatingsEntryPersistence ratingsEntryPersistence;
254     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsStatsLocalService")
255     protected RatingsStatsLocalService ratingsStatsLocalService;
256     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence")
257     protected RatingsStatsPersistence ratingsStatsPersistence;
258     @BeanReference(name = "com.liferay.counter.service.CounterLocalService")
259     protected CounterLocalService counterLocalService;
260     @BeanReference(name = "com.liferay.counter.service.CounterService")
261     protected CounterService counterService;
262     @BeanReference(name = "com.liferay.portal.service.ResourceLocalService")
263     protected ResourceLocalService resourceLocalService;
264     @BeanReference(name = "com.liferay.portal.service.ResourceService")
265     protected ResourceService resourceService;
266     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
267     protected ResourcePersistence resourcePersistence;
268     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceFinder")
269     protected ResourceFinder resourceFinder;
270     @BeanReference(name = "com.liferay.portal.service.UserLocalService")
271     protected UserLocalService userLocalService;
272     @BeanReference(name = "com.liferay.portal.service.UserService")
273     protected UserService userService;
274     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
275     protected UserPersistence userPersistence;
276     @BeanReference(name = "com.liferay.portal.service.persistence.UserFinder")
277     protected UserFinder userFinder;
278 }