1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.ratings.service.base;
24  
25  import com.liferay.counter.service.CounterLocalService;
26  import com.liferay.counter.service.CounterService;
27  
28  import com.liferay.portal.PortalException;
29  import com.liferay.portal.SystemException;
30  import com.liferay.portal.kernel.annotation.BeanReference;
31  import com.liferay.portal.kernel.dao.db.DB;
32  import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
33  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
34  import com.liferay.portal.service.ResourceLocalService;
35  import com.liferay.portal.service.ResourceService;
36  import com.liferay.portal.service.UserLocalService;
37  import com.liferay.portal.service.UserService;
38  import com.liferay.portal.service.persistence.ResourceFinder;
39  import com.liferay.portal.service.persistence.ResourcePersistence;
40  import com.liferay.portal.service.persistence.UserFinder;
41  import com.liferay.portal.service.persistence.UserPersistence;
42  
43  import com.liferay.portlet.ratings.model.RatingsStats;
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  /**
53   * <a href="RatingsStatsLocalServiceBaseImpl.java.html"><b><i>View Source</i>
54   * </b></a>
55   *
56   * @author Brian Wing Shun Chan
57   */
58  public abstract class RatingsStatsLocalServiceBaseImpl
59      implements RatingsStatsLocalService {
60      public RatingsStats addRatingsStats(RatingsStats ratingsStats)
61          throws SystemException {
62          ratingsStats.setNew(true);
63  
64          return ratingsStatsPersistence.update(ratingsStats, false);
65      }
66  
67      public RatingsStats createRatingsStats(long statsId) {
68          return ratingsStatsPersistence.create(statsId);
69      }
70  
71      public void deleteRatingsStats(long statsId)
72          throws PortalException, SystemException {
73          ratingsStatsPersistence.remove(statsId);
74      }
75  
76      public void deleteRatingsStats(RatingsStats ratingsStats)
77          throws SystemException {
78          ratingsStatsPersistence.remove(ratingsStats);
79      }
80  
81      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
82          throws SystemException {
83          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery);
84      }
85  
86      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
87          int end) throws SystemException {
88          return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
89              start, end);
90      }
91  
92      public RatingsStats getRatingsStats(long statsId)
93          throws PortalException, SystemException {
94          return ratingsStatsPersistence.findByPrimaryKey(statsId);
95      }
96  
97      public List<RatingsStats> getRatingsStatses(int start, int end)
98          throws SystemException {
99          return ratingsStatsPersistence.findAll(start, end);
100     }
101 
102     public int getRatingsStatsesCount() throws SystemException {
103         return ratingsStatsPersistence.countAll();
104     }
105 
106     public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
107         throws SystemException {
108         ratingsStats.setNew(false);
109 
110         return ratingsStatsPersistence.update(ratingsStats, true);
111     }
112 
113     public RatingsStats updateRatingsStats(RatingsStats ratingsStats,
114         boolean merge) throws SystemException {
115         ratingsStats.setNew(false);
116 
117         return ratingsStatsPersistence.update(ratingsStats, merge);
118     }
119 
120     public RatingsEntryLocalService getRatingsEntryLocalService() {
121         return ratingsEntryLocalService;
122     }
123 
124     public void setRatingsEntryLocalService(
125         RatingsEntryLocalService ratingsEntryLocalService) {
126         this.ratingsEntryLocalService = ratingsEntryLocalService;
127     }
128 
129     public RatingsEntryService getRatingsEntryService() {
130         return ratingsEntryService;
131     }
132 
133     public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
134         this.ratingsEntryService = ratingsEntryService;
135     }
136 
137     public RatingsEntryPersistence getRatingsEntryPersistence() {
138         return ratingsEntryPersistence;
139     }
140 
141     public void setRatingsEntryPersistence(
142         RatingsEntryPersistence ratingsEntryPersistence) {
143         this.ratingsEntryPersistence = ratingsEntryPersistence;
144     }
145 
146     public RatingsStatsLocalService getRatingsStatsLocalService() {
147         return ratingsStatsLocalService;
148     }
149 
150     public void setRatingsStatsLocalService(
151         RatingsStatsLocalService ratingsStatsLocalService) {
152         this.ratingsStatsLocalService = ratingsStatsLocalService;
153     }
154 
155     public RatingsStatsPersistence getRatingsStatsPersistence() {
156         return ratingsStatsPersistence;
157     }
158 
159     public void setRatingsStatsPersistence(
160         RatingsStatsPersistence ratingsStatsPersistence) {
161         this.ratingsStatsPersistence = ratingsStatsPersistence;
162     }
163 
164     public CounterLocalService getCounterLocalService() {
165         return counterLocalService;
166     }
167 
168     public void setCounterLocalService(CounterLocalService counterLocalService) {
169         this.counterLocalService = counterLocalService;
170     }
171 
172     public CounterService getCounterService() {
173         return counterService;
174     }
175 
176     public void setCounterService(CounterService counterService) {
177         this.counterService = counterService;
178     }
179 
180     public ResourceLocalService getResourceLocalService() {
181         return resourceLocalService;
182     }
183 
184     public void setResourceLocalService(
185         ResourceLocalService resourceLocalService) {
186         this.resourceLocalService = resourceLocalService;
187     }
188 
189     public ResourceService getResourceService() {
190         return resourceService;
191     }
192 
193     public void setResourceService(ResourceService resourceService) {
194         this.resourceService = resourceService;
195     }
196 
197     public ResourcePersistence getResourcePersistence() {
198         return resourcePersistence;
199     }
200 
201     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
202         this.resourcePersistence = resourcePersistence;
203     }
204 
205     public ResourceFinder getResourceFinder() {
206         return resourceFinder;
207     }
208 
209     public void setResourceFinder(ResourceFinder resourceFinder) {
210         this.resourceFinder = resourceFinder;
211     }
212 
213     public UserLocalService getUserLocalService() {
214         return userLocalService;
215     }
216 
217     public void setUserLocalService(UserLocalService userLocalService) {
218         this.userLocalService = userLocalService;
219     }
220 
221     public UserService getUserService() {
222         return userService;
223     }
224 
225     public void setUserService(UserService userService) {
226         this.userService = userService;
227     }
228 
229     public UserPersistence getUserPersistence() {
230         return userPersistence;
231     }
232 
233     public void setUserPersistence(UserPersistence userPersistence) {
234         this.userPersistence = userPersistence;
235     }
236 
237     public UserFinder getUserFinder() {
238         return userFinder;
239     }
240 
241     public void setUserFinder(UserFinder userFinder) {
242         this.userFinder = userFinder;
243     }
244 
245     protected void runSQL(String sql) throws SystemException {
246         try {
247             DB db = DBFactoryUtil.getDB();
248 
249             db.runSQL(sql);
250         }
251         catch (Exception e) {
252             throw new SystemException(e);
253         }
254     }
255 
256     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsEntryLocalService")
257     protected RatingsEntryLocalService ratingsEntryLocalService;
258     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsEntryService")
259     protected RatingsEntryService ratingsEntryService;
260     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence")
261     protected RatingsEntryPersistence ratingsEntryPersistence;
262     @BeanReference(name = "com.liferay.portlet.ratings.service.RatingsStatsLocalService")
263     protected RatingsStatsLocalService ratingsStatsLocalService;
264     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence")
265     protected RatingsStatsPersistence ratingsStatsPersistence;
266     @BeanReference(name = "com.liferay.counter.service.CounterLocalService")
267     protected CounterLocalService counterLocalService;
268     @BeanReference(name = "com.liferay.counter.service.CounterService")
269     protected CounterService counterService;
270     @BeanReference(name = "com.liferay.portal.service.ResourceLocalService")
271     protected ResourceLocalService resourceLocalService;
272     @BeanReference(name = "com.liferay.portal.service.ResourceService")
273     protected ResourceService resourceService;
274     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
275     protected ResourcePersistence resourcePersistence;
276     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceFinder")
277     protected ResourceFinder resourceFinder;
278     @BeanReference(name = "com.liferay.portal.service.UserLocalService")
279     protected UserLocalService userLocalService;
280     @BeanReference(name = "com.liferay.portal.service.UserService")
281     protected UserService userService;
282     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
283     protected UserPersistence userPersistence;
284     @BeanReference(name = "com.liferay.portal.service.persistence.UserFinder")
285     protected UserFinder userFinder;
286 }