1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.CounterLocalServiceFactory;
27  import com.liferay.counter.service.CounterService;
28  import com.liferay.counter.service.CounterServiceFactory;
29  
30  import com.liferay.portal.SystemException;
31  import com.liferay.portal.kernel.dao.DynamicQueryInitializer;
32  import com.liferay.portal.service.UserLocalService;
33  import com.liferay.portal.service.UserLocalServiceFactory;
34  import com.liferay.portal.service.UserService;
35  import com.liferay.portal.service.UserServiceFactory;
36  import com.liferay.portal.service.persistence.UserFinder;
37  import com.liferay.portal.service.persistence.UserFinderUtil;
38  import com.liferay.portal.service.persistence.UserPersistence;
39  import com.liferay.portal.service.persistence.UserUtil;
40  
41  import com.liferay.portlet.blogs.service.BlogsEntryLocalService;
42  import com.liferay.portlet.blogs.service.BlogsEntryLocalServiceFactory;
43  import com.liferay.portlet.blogs.service.BlogsEntryService;
44  import com.liferay.portlet.blogs.service.BlogsEntryServiceFactory;
45  import com.liferay.portlet.blogs.service.BlogsStatsUserLocalService;
46  import com.liferay.portlet.blogs.service.BlogsStatsUserLocalServiceFactory;
47  import com.liferay.portlet.blogs.service.persistence.BlogsEntryFinder;
48  import com.liferay.portlet.blogs.service.persistence.BlogsEntryFinderUtil;
49  import com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence;
50  import com.liferay.portlet.blogs.service.persistence.BlogsEntryUtil;
51  import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserFinder;
52  import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserFinderUtil;
53  import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence;
54  import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserUtil;
55  import com.liferay.portlet.ratings.model.RatingsEntry;
56  import com.liferay.portlet.ratings.model.impl.RatingsEntryImpl;
57  import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
58  import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
59  import com.liferay.portlet.ratings.service.RatingsStatsLocalServiceFactory;
60  import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
61  import com.liferay.portlet.ratings.service.persistence.RatingsEntryUtil;
62  import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
63  import com.liferay.portlet.ratings.service.persistence.RatingsStatsUtil;
64  
65  import org.springframework.beans.factory.InitializingBean;
66  
67  import java.util.List;
68  
69  /**
70   * <a href="RatingsEntryLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
71   *
72   * @author Brian Wing Shun Chan
73   *
74   */
75  public abstract class RatingsEntryLocalServiceBaseImpl
76      implements RatingsEntryLocalService, InitializingBean {
77      public RatingsEntry addRatingsEntry(RatingsEntry model)
78          throws SystemException {
79          RatingsEntry ratingsEntry = new RatingsEntryImpl();
80  
81          ratingsEntry.setNew(true);
82  
83          ratingsEntry.setEntryId(model.getEntryId());
84          ratingsEntry.setCompanyId(model.getCompanyId());
85          ratingsEntry.setUserId(model.getUserId());
86          ratingsEntry.setUserName(model.getUserName());
87          ratingsEntry.setCreateDate(model.getCreateDate());
88          ratingsEntry.setModifiedDate(model.getModifiedDate());
89          ratingsEntry.setClassNameId(model.getClassNameId());
90          ratingsEntry.setClassPK(model.getClassPK());
91          ratingsEntry.setScore(model.getScore());
92  
93          return ratingsEntryPersistence.update(ratingsEntry);
94      }
95  
96      public List dynamicQuery(DynamicQueryInitializer queryInitializer)
97          throws SystemException {
98          return ratingsEntryPersistence.findWithDynamicQuery(queryInitializer);
99      }
100 
101     public List dynamicQuery(DynamicQueryInitializer queryInitializer,
102         int begin, int end) throws SystemException {
103         return ratingsEntryPersistence.findWithDynamicQuery(queryInitializer,
104             begin, end);
105     }
106 
107     public RatingsEntry updateRatingsEntry(RatingsEntry model)
108         throws SystemException {
109         RatingsEntry ratingsEntry = new RatingsEntryImpl();
110 
111         ratingsEntry.setNew(false);
112 
113         ratingsEntry.setEntryId(model.getEntryId());
114         ratingsEntry.setCompanyId(model.getCompanyId());
115         ratingsEntry.setUserId(model.getUserId());
116         ratingsEntry.setUserName(model.getUserName());
117         ratingsEntry.setCreateDate(model.getCreateDate());
118         ratingsEntry.setModifiedDate(model.getModifiedDate());
119         ratingsEntry.setClassNameId(model.getClassNameId());
120         ratingsEntry.setClassPK(model.getClassPK());
121         ratingsEntry.setScore(model.getScore());
122 
123         return ratingsEntryPersistence.update(ratingsEntry);
124     }
125 
126     public RatingsEntryPersistence getRatingsEntryPersistence() {
127         return ratingsEntryPersistence;
128     }
129 
130     public void setRatingsEntryPersistence(
131         RatingsEntryPersistence ratingsEntryPersistence) {
132         this.ratingsEntryPersistence = ratingsEntryPersistence;
133     }
134 
135     public RatingsStatsLocalService getRatingsStatsLocalService() {
136         return ratingsStatsLocalService;
137     }
138 
139     public void setRatingsStatsLocalService(
140         RatingsStatsLocalService ratingsStatsLocalService) {
141         this.ratingsStatsLocalService = ratingsStatsLocalService;
142     }
143 
144     public RatingsStatsPersistence getRatingsStatsPersistence() {
145         return ratingsStatsPersistence;
146     }
147 
148     public void setRatingsStatsPersistence(
149         RatingsStatsPersistence ratingsStatsPersistence) {
150         this.ratingsStatsPersistence = ratingsStatsPersistence;
151     }
152 
153     public CounterLocalService getCounterLocalService() {
154         return counterLocalService;
155     }
156 
157     public void setCounterLocalService(CounterLocalService counterLocalService) {
158         this.counterLocalService = counterLocalService;
159     }
160 
161     public CounterService getCounterService() {
162         return counterService;
163     }
164 
165     public void setCounterService(CounterService counterService) {
166         this.counterService = counterService;
167     }
168 
169     public UserLocalService getUserLocalService() {
170         return userLocalService;
171     }
172 
173     public void setUserLocalService(UserLocalService userLocalService) {
174         this.userLocalService = userLocalService;
175     }
176 
177     public UserService getUserService() {
178         return userService;
179     }
180 
181     public void setUserService(UserService userService) {
182         this.userService = userService;
183     }
184 
185     public UserPersistence getUserPersistence() {
186         return userPersistence;
187     }
188 
189     public void setUserPersistence(UserPersistence userPersistence) {
190         this.userPersistence = userPersistence;
191     }
192 
193     public UserFinder getUserFinder() {
194         return userFinder;
195     }
196 
197     public void setUserFinder(UserFinder userFinder) {
198         this.userFinder = userFinder;
199     }
200 
201     public BlogsEntryLocalService getBlogsEntryLocalService() {
202         return blogsEntryLocalService;
203     }
204 
205     public void setBlogsEntryLocalService(
206         BlogsEntryLocalService blogsEntryLocalService) {
207         this.blogsEntryLocalService = blogsEntryLocalService;
208     }
209 
210     public BlogsEntryService getBlogsEntryService() {
211         return blogsEntryService;
212     }
213 
214     public void setBlogsEntryService(BlogsEntryService blogsEntryService) {
215         this.blogsEntryService = blogsEntryService;
216     }
217 
218     public BlogsEntryPersistence getBlogsEntryPersistence() {
219         return blogsEntryPersistence;
220     }
221 
222     public void setBlogsEntryPersistence(
223         BlogsEntryPersistence blogsEntryPersistence) {
224         this.blogsEntryPersistence = blogsEntryPersistence;
225     }
226 
227     public BlogsEntryFinder getBlogsEntryFinder() {
228         return blogsEntryFinder;
229     }
230 
231     public void setBlogsEntryFinder(BlogsEntryFinder blogsEntryFinder) {
232         this.blogsEntryFinder = blogsEntryFinder;
233     }
234 
235     public BlogsStatsUserLocalService getBlogsStatsUserLocalService() {
236         return blogsStatsUserLocalService;
237     }
238 
239     public void setBlogsStatsUserLocalService(
240         BlogsStatsUserLocalService blogsStatsUserLocalService) {
241         this.blogsStatsUserLocalService = blogsStatsUserLocalService;
242     }
243 
244     public BlogsStatsUserPersistence getBlogsStatsUserPersistence() {
245         return blogsStatsUserPersistence;
246     }
247 
248     public void setBlogsStatsUserPersistence(
249         BlogsStatsUserPersistence blogsStatsUserPersistence) {
250         this.blogsStatsUserPersistence = blogsStatsUserPersistence;
251     }
252 
253     public BlogsStatsUserFinder getBlogsStatsUserFinder() {
254         return blogsStatsUserFinder;
255     }
256 
257     public void setBlogsStatsUserFinder(
258         BlogsStatsUserFinder blogsStatsUserFinder) {
259         this.blogsStatsUserFinder = blogsStatsUserFinder;
260     }
261 
262     public void afterPropertiesSet() {
263         if (ratingsEntryPersistence == null) {
264             ratingsEntryPersistence = RatingsEntryUtil.getPersistence();
265         }
266 
267         if (ratingsStatsLocalService == null) {
268             ratingsStatsLocalService = RatingsStatsLocalServiceFactory.getImpl();
269         }
270 
271         if (ratingsStatsPersistence == null) {
272             ratingsStatsPersistence = RatingsStatsUtil.getPersistence();
273         }
274 
275         if (counterLocalService == null) {
276             counterLocalService = CounterLocalServiceFactory.getImpl();
277         }
278 
279         if (counterService == null) {
280             counterService = CounterServiceFactory.getImpl();
281         }
282 
283         if (userLocalService == null) {
284             userLocalService = UserLocalServiceFactory.getImpl();
285         }
286 
287         if (userService == null) {
288             userService = UserServiceFactory.getImpl();
289         }
290 
291         if (userPersistence == null) {
292             userPersistence = UserUtil.getPersistence();
293         }
294 
295         if (userFinder == null) {
296             userFinder = UserFinderUtil.getFinder();
297         }
298 
299         if (blogsEntryLocalService == null) {
300             blogsEntryLocalService = BlogsEntryLocalServiceFactory.getImpl();
301         }
302 
303         if (blogsEntryService == null) {
304             blogsEntryService = BlogsEntryServiceFactory.getImpl();
305         }
306 
307         if (blogsEntryPersistence == null) {
308             blogsEntryPersistence = BlogsEntryUtil.getPersistence();
309         }
310 
311         if (blogsEntryFinder == null) {
312             blogsEntryFinder = BlogsEntryFinderUtil.getFinder();
313         }
314 
315         if (blogsStatsUserLocalService == null) {
316             blogsStatsUserLocalService = BlogsStatsUserLocalServiceFactory.getImpl();
317         }
318 
319         if (blogsStatsUserPersistence == null) {
320             blogsStatsUserPersistence = BlogsStatsUserUtil.getPersistence();
321         }
322 
323         if (blogsStatsUserFinder == null) {
324             blogsStatsUserFinder = BlogsStatsUserFinderUtil.getFinder();
325         }
326     }
327 
328     protected RatingsEntryPersistence ratingsEntryPersistence;
329     protected RatingsStatsLocalService ratingsStatsLocalService;
330     protected RatingsStatsPersistence ratingsStatsPersistence;
331     protected CounterLocalService counterLocalService;
332     protected CounterService counterService;
333     protected UserLocalService userLocalService;
334     protected UserService userService;
335     protected UserPersistence userPersistence;
336     protected UserFinder userFinder;
337     protected BlogsEntryLocalService blogsEntryLocalService;
338     protected BlogsEntryService blogsEntryService;
339     protected BlogsEntryPersistence blogsEntryPersistence;
340     protected BlogsEntryFinder blogsEntryFinder;
341     protected BlogsStatsUserLocalService blogsStatsUserLocalService;
342     protected BlogsStatsUserPersistence blogsStatsUserPersistence;
343     protected BlogsStatsUserFinder blogsStatsUserFinder;
344 }