001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.ratings.service.base;
016    
017    import com.liferay.counter.service.CounterLocalService;
018    
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
021    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
022    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.util.OrderByComparator;
026    import com.liferay.portal.service.ResourceLocalService;
027    import com.liferay.portal.service.ResourceService;
028    import com.liferay.portal.service.UserLocalService;
029    import com.liferay.portal.service.UserService;
030    import com.liferay.portal.service.persistence.ResourceFinder;
031    import com.liferay.portal.service.persistence.ResourcePersistence;
032    import com.liferay.portal.service.persistence.UserFinder;
033    import com.liferay.portal.service.persistence.UserPersistence;
034    
035    import com.liferay.portlet.blogs.service.BlogsEntryLocalService;
036    import com.liferay.portlet.blogs.service.BlogsEntryService;
037    import com.liferay.portlet.blogs.service.BlogsStatsUserLocalService;
038    import com.liferay.portlet.blogs.service.persistence.BlogsEntryFinder;
039    import com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence;
040    import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserFinder;
041    import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence;
042    import com.liferay.portlet.ratings.model.RatingsEntry;
043    import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
044    import com.liferay.portlet.ratings.service.RatingsEntryService;
045    import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
046    import com.liferay.portlet.ratings.service.persistence.RatingsEntryFinder;
047    import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
048    import com.liferay.portlet.ratings.service.persistence.RatingsStatsFinder;
049    import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
050    import com.liferay.portlet.social.service.SocialEquityLogLocalService;
051    import com.liferay.portlet.social.service.persistence.SocialEquityLogPersistence;
052    
053    import java.util.List;
054    
055    import javax.sql.DataSource;
056    
057    /**
058     * @author Brian Wing Shun Chan
059     */
060    public abstract class RatingsEntryLocalServiceBaseImpl
061            implements RatingsEntryLocalService {
062            public RatingsEntry addRatingsEntry(RatingsEntry ratingsEntry)
063                    throws SystemException {
064                    ratingsEntry.setNew(true);
065    
066                    return ratingsEntryPersistence.update(ratingsEntry, false);
067            }
068    
069            public RatingsEntry createRatingsEntry(long entryId) {
070                    return ratingsEntryPersistence.create(entryId);
071            }
072    
073            public void deleteRatingsEntry(long entryId)
074                    throws PortalException, SystemException {
075                    ratingsEntryPersistence.remove(entryId);
076            }
077    
078            public void deleteRatingsEntry(RatingsEntry ratingsEntry)
079                    throws SystemException {
080                    ratingsEntryPersistence.remove(ratingsEntry);
081            }
082    
083            @SuppressWarnings("unchecked")
084            public List dynamicQuery(DynamicQuery dynamicQuery)
085                    throws SystemException {
086                    return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery);
087            }
088    
089            @SuppressWarnings("unchecked")
090            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
091                    throws SystemException {
092                    return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery,
093                            start, end);
094            }
095    
096            @SuppressWarnings("unchecked")
097            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
098                    OrderByComparator orderByComparator) throws SystemException {
099                    return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery,
100                            start, end, orderByComparator);
101            }
102    
103            public long dynamicQueryCount(DynamicQuery dynamicQuery)
104                    throws SystemException {
105                    return ratingsEntryPersistence.countWithDynamicQuery(dynamicQuery);
106            }
107    
108            public RatingsEntry getRatingsEntry(long entryId)
109                    throws PortalException, SystemException {
110                    return ratingsEntryPersistence.findByPrimaryKey(entryId);
111            }
112    
113            public List<RatingsEntry> getRatingsEntries(int start, int end)
114                    throws SystemException {
115                    return ratingsEntryPersistence.findAll(start, end);
116            }
117    
118            public int getRatingsEntriesCount() throws SystemException {
119                    return ratingsEntryPersistence.countAll();
120            }
121    
122            public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry)
123                    throws SystemException {
124                    ratingsEntry.setNew(false);
125    
126                    return ratingsEntryPersistence.update(ratingsEntry, true);
127            }
128    
129            public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry,
130                    boolean merge) throws SystemException {
131                    ratingsEntry.setNew(false);
132    
133                    return ratingsEntryPersistence.update(ratingsEntry, merge);
134            }
135    
136            public RatingsEntryLocalService getRatingsEntryLocalService() {
137                    return ratingsEntryLocalService;
138            }
139    
140            public void setRatingsEntryLocalService(
141                    RatingsEntryLocalService ratingsEntryLocalService) {
142                    this.ratingsEntryLocalService = ratingsEntryLocalService;
143            }
144    
145            public RatingsEntryService getRatingsEntryService() {
146                    return ratingsEntryService;
147            }
148    
149            public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
150                    this.ratingsEntryService = ratingsEntryService;
151            }
152    
153            public RatingsEntryPersistence getRatingsEntryPersistence() {
154                    return ratingsEntryPersistence;
155            }
156    
157            public void setRatingsEntryPersistence(
158                    RatingsEntryPersistence ratingsEntryPersistence) {
159                    this.ratingsEntryPersistence = ratingsEntryPersistence;
160            }
161    
162            public RatingsEntryFinder getRatingsEntryFinder() {
163                    return ratingsEntryFinder;
164            }
165    
166            public void setRatingsEntryFinder(RatingsEntryFinder ratingsEntryFinder) {
167                    this.ratingsEntryFinder = ratingsEntryFinder;
168            }
169    
170            public RatingsStatsLocalService getRatingsStatsLocalService() {
171                    return ratingsStatsLocalService;
172            }
173    
174            public void setRatingsStatsLocalService(
175                    RatingsStatsLocalService ratingsStatsLocalService) {
176                    this.ratingsStatsLocalService = ratingsStatsLocalService;
177            }
178    
179            public RatingsStatsPersistence getRatingsStatsPersistence() {
180                    return ratingsStatsPersistence;
181            }
182    
183            public void setRatingsStatsPersistence(
184                    RatingsStatsPersistence ratingsStatsPersistence) {
185                    this.ratingsStatsPersistence = ratingsStatsPersistence;
186            }
187    
188            public RatingsStatsFinder getRatingsStatsFinder() {
189                    return ratingsStatsFinder;
190            }
191    
192            public void setRatingsStatsFinder(RatingsStatsFinder ratingsStatsFinder) {
193                    this.ratingsStatsFinder = ratingsStatsFinder;
194            }
195    
196            public CounterLocalService getCounterLocalService() {
197                    return counterLocalService;
198            }
199    
200            public void setCounterLocalService(CounterLocalService counterLocalService) {
201                    this.counterLocalService = counterLocalService;
202            }
203    
204            public ResourceLocalService getResourceLocalService() {
205                    return resourceLocalService;
206            }
207    
208            public void setResourceLocalService(
209                    ResourceLocalService resourceLocalService) {
210                    this.resourceLocalService = resourceLocalService;
211            }
212    
213            public ResourceService getResourceService() {
214                    return resourceService;
215            }
216    
217            public void setResourceService(ResourceService resourceService) {
218                    this.resourceService = resourceService;
219            }
220    
221            public ResourcePersistence getResourcePersistence() {
222                    return resourcePersistence;
223            }
224    
225            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
226                    this.resourcePersistence = resourcePersistence;
227            }
228    
229            public ResourceFinder getResourceFinder() {
230                    return resourceFinder;
231            }
232    
233            public void setResourceFinder(ResourceFinder resourceFinder) {
234                    this.resourceFinder = resourceFinder;
235            }
236    
237            public UserLocalService getUserLocalService() {
238                    return userLocalService;
239            }
240    
241            public void setUserLocalService(UserLocalService userLocalService) {
242                    this.userLocalService = userLocalService;
243            }
244    
245            public UserService getUserService() {
246                    return userService;
247            }
248    
249            public void setUserService(UserService userService) {
250                    this.userService = userService;
251            }
252    
253            public UserPersistence getUserPersistence() {
254                    return userPersistence;
255            }
256    
257            public void setUserPersistence(UserPersistence userPersistence) {
258                    this.userPersistence = userPersistence;
259            }
260    
261            public UserFinder getUserFinder() {
262                    return userFinder;
263            }
264    
265            public void setUserFinder(UserFinder userFinder) {
266                    this.userFinder = userFinder;
267            }
268    
269            public BlogsEntryLocalService getBlogsEntryLocalService() {
270                    return blogsEntryLocalService;
271            }
272    
273            public void setBlogsEntryLocalService(
274                    BlogsEntryLocalService blogsEntryLocalService) {
275                    this.blogsEntryLocalService = blogsEntryLocalService;
276            }
277    
278            public BlogsEntryService getBlogsEntryService() {
279                    return blogsEntryService;
280            }
281    
282            public void setBlogsEntryService(BlogsEntryService blogsEntryService) {
283                    this.blogsEntryService = blogsEntryService;
284            }
285    
286            public BlogsEntryPersistence getBlogsEntryPersistence() {
287                    return blogsEntryPersistence;
288            }
289    
290            public void setBlogsEntryPersistence(
291                    BlogsEntryPersistence blogsEntryPersistence) {
292                    this.blogsEntryPersistence = blogsEntryPersistence;
293            }
294    
295            public BlogsEntryFinder getBlogsEntryFinder() {
296                    return blogsEntryFinder;
297            }
298    
299            public void setBlogsEntryFinder(BlogsEntryFinder blogsEntryFinder) {
300                    this.blogsEntryFinder = blogsEntryFinder;
301            }
302    
303            public BlogsStatsUserLocalService getBlogsStatsUserLocalService() {
304                    return blogsStatsUserLocalService;
305            }
306    
307            public void setBlogsStatsUserLocalService(
308                    BlogsStatsUserLocalService blogsStatsUserLocalService) {
309                    this.blogsStatsUserLocalService = blogsStatsUserLocalService;
310            }
311    
312            public BlogsStatsUserPersistence getBlogsStatsUserPersistence() {
313                    return blogsStatsUserPersistence;
314            }
315    
316            public void setBlogsStatsUserPersistence(
317                    BlogsStatsUserPersistence blogsStatsUserPersistence) {
318                    this.blogsStatsUserPersistence = blogsStatsUserPersistence;
319            }
320    
321            public BlogsStatsUserFinder getBlogsStatsUserFinder() {
322                    return blogsStatsUserFinder;
323            }
324    
325            public void setBlogsStatsUserFinder(
326                    BlogsStatsUserFinder blogsStatsUserFinder) {
327                    this.blogsStatsUserFinder = blogsStatsUserFinder;
328            }
329    
330            public SocialEquityLogLocalService getSocialEquityLogLocalService() {
331                    return socialEquityLogLocalService;
332            }
333    
334            public void setSocialEquityLogLocalService(
335                    SocialEquityLogLocalService socialEquityLogLocalService) {
336                    this.socialEquityLogLocalService = socialEquityLogLocalService;
337            }
338    
339            public SocialEquityLogPersistence getSocialEquityLogPersistence() {
340                    return socialEquityLogPersistence;
341            }
342    
343            public void setSocialEquityLogPersistence(
344                    SocialEquityLogPersistence socialEquityLogPersistence) {
345                    this.socialEquityLogPersistence = socialEquityLogPersistence;
346            }
347    
348            protected void runSQL(String sql) throws SystemException {
349                    try {
350                            DataSource dataSource = ratingsEntryPersistence.getDataSource();
351    
352                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
353                                            sql, new int[0]);
354    
355                            sqlUpdate.update();
356                    }
357                    catch (Exception e) {
358                            throw new SystemException(e);
359                    }
360            }
361    
362            @BeanReference(type = RatingsEntryLocalService.class)
363            protected RatingsEntryLocalService ratingsEntryLocalService;
364            @BeanReference(type = RatingsEntryService.class)
365            protected RatingsEntryService ratingsEntryService;
366            @BeanReference(type = RatingsEntryPersistence.class)
367            protected RatingsEntryPersistence ratingsEntryPersistence;
368            @BeanReference(type = RatingsEntryFinder.class)
369            protected RatingsEntryFinder ratingsEntryFinder;
370            @BeanReference(type = RatingsStatsLocalService.class)
371            protected RatingsStatsLocalService ratingsStatsLocalService;
372            @BeanReference(type = RatingsStatsPersistence.class)
373            protected RatingsStatsPersistence ratingsStatsPersistence;
374            @BeanReference(type = RatingsStatsFinder.class)
375            protected RatingsStatsFinder ratingsStatsFinder;
376            @BeanReference(type = CounterLocalService.class)
377            protected CounterLocalService counterLocalService;
378            @BeanReference(type = ResourceLocalService.class)
379            protected ResourceLocalService resourceLocalService;
380            @BeanReference(type = ResourceService.class)
381            protected ResourceService resourceService;
382            @BeanReference(type = ResourcePersistence.class)
383            protected ResourcePersistence resourcePersistence;
384            @BeanReference(type = ResourceFinder.class)
385            protected ResourceFinder resourceFinder;
386            @BeanReference(type = UserLocalService.class)
387            protected UserLocalService userLocalService;
388            @BeanReference(type = UserService.class)
389            protected UserService userService;
390            @BeanReference(type = UserPersistence.class)
391            protected UserPersistence userPersistence;
392            @BeanReference(type = UserFinder.class)
393            protected UserFinder userFinder;
394            @BeanReference(type = BlogsEntryLocalService.class)
395            protected BlogsEntryLocalService blogsEntryLocalService;
396            @BeanReference(type = BlogsEntryService.class)
397            protected BlogsEntryService blogsEntryService;
398            @BeanReference(type = BlogsEntryPersistence.class)
399            protected BlogsEntryPersistence blogsEntryPersistence;
400            @BeanReference(type = BlogsEntryFinder.class)
401            protected BlogsEntryFinder blogsEntryFinder;
402            @BeanReference(type = BlogsStatsUserLocalService.class)
403            protected BlogsStatsUserLocalService blogsStatsUserLocalService;
404            @BeanReference(type = BlogsStatsUserPersistence.class)
405            protected BlogsStatsUserPersistence blogsStatsUserPersistence;
406            @BeanReference(type = BlogsStatsUserFinder.class)
407            protected BlogsStatsUserFinder blogsStatsUserFinder;
408            @BeanReference(type = SocialEquityLogLocalService.class)
409            protected SocialEquityLogLocalService socialEquityLogLocalService;
410            @BeanReference(type = SocialEquityLogPersistence.class)
411            protected SocialEquityLogPersistence socialEquityLogPersistence;
412    }