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.blogs.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.GroupLocalService;
027    import com.liferay.portal.service.GroupService;
028    import com.liferay.portal.service.ResourceLocalService;
029    import com.liferay.portal.service.ResourceService;
030    import com.liferay.portal.service.UserLocalService;
031    import com.liferay.portal.service.UserService;
032    import com.liferay.portal.service.persistence.GroupFinder;
033    import com.liferay.portal.service.persistence.GroupPersistence;
034    import com.liferay.portal.service.persistence.ResourceFinder;
035    import com.liferay.portal.service.persistence.ResourcePersistence;
036    import com.liferay.portal.service.persistence.UserFinder;
037    import com.liferay.portal.service.persistence.UserPersistence;
038    
039    import com.liferay.portlet.blogs.model.BlogsStatsUser;
040    import com.liferay.portlet.blogs.service.BlogsEntryLocalService;
041    import com.liferay.portlet.blogs.service.BlogsEntryService;
042    import com.liferay.portlet.blogs.service.BlogsStatsUserLocalService;
043    import com.liferay.portlet.blogs.service.persistence.BlogsEntryFinder;
044    import com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence;
045    import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserFinder;
046    import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence;
047    
048    import java.util.List;
049    
050    import javax.sql.DataSource;
051    
052    /**
053     * @author Brian Wing Shun Chan
054     */
055    public abstract class BlogsStatsUserLocalServiceBaseImpl
056            implements BlogsStatsUserLocalService {
057            public BlogsStatsUser addBlogsStatsUser(BlogsStatsUser blogsStatsUser)
058                    throws SystemException {
059                    blogsStatsUser.setNew(true);
060    
061                    return blogsStatsUserPersistence.update(blogsStatsUser, false);
062            }
063    
064            public BlogsStatsUser createBlogsStatsUser(long statsUserId) {
065                    return blogsStatsUserPersistence.create(statsUserId);
066            }
067    
068            public void deleteBlogsStatsUser(long statsUserId)
069                    throws PortalException, SystemException {
070                    blogsStatsUserPersistence.remove(statsUserId);
071            }
072    
073            public void deleteBlogsStatsUser(BlogsStatsUser blogsStatsUser)
074                    throws SystemException {
075                    blogsStatsUserPersistence.remove(blogsStatsUser);
076            }
077    
078            @SuppressWarnings("unchecked")
079            public List dynamicQuery(DynamicQuery dynamicQuery)
080                    throws SystemException {
081                    return blogsStatsUserPersistence.findWithDynamicQuery(dynamicQuery);
082            }
083    
084            @SuppressWarnings("unchecked")
085            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
086                    throws SystemException {
087                    return blogsStatsUserPersistence.findWithDynamicQuery(dynamicQuery,
088                            start, end);
089            }
090    
091            @SuppressWarnings("unchecked")
092            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
093                    OrderByComparator orderByComparator) throws SystemException {
094                    return blogsStatsUserPersistence.findWithDynamicQuery(dynamicQuery,
095                            start, end, orderByComparator);
096            }
097    
098            public long dynamicQueryCount(DynamicQuery dynamicQuery)
099                    throws SystemException {
100                    return blogsStatsUserPersistence.countWithDynamicQuery(dynamicQuery);
101            }
102    
103            public BlogsStatsUser getBlogsStatsUser(long statsUserId)
104                    throws PortalException, SystemException {
105                    return blogsStatsUserPersistence.findByPrimaryKey(statsUserId);
106            }
107    
108            public List<BlogsStatsUser> getBlogsStatsUsers(int start, int end)
109                    throws SystemException {
110                    return blogsStatsUserPersistence.findAll(start, end);
111            }
112    
113            public int getBlogsStatsUsersCount() throws SystemException {
114                    return blogsStatsUserPersistence.countAll();
115            }
116    
117            public BlogsStatsUser updateBlogsStatsUser(BlogsStatsUser blogsStatsUser)
118                    throws SystemException {
119                    blogsStatsUser.setNew(false);
120    
121                    return blogsStatsUserPersistence.update(blogsStatsUser, true);
122            }
123    
124            public BlogsStatsUser updateBlogsStatsUser(BlogsStatsUser blogsStatsUser,
125                    boolean merge) throws SystemException {
126                    blogsStatsUser.setNew(false);
127    
128                    return blogsStatsUserPersistence.update(blogsStatsUser, merge);
129            }
130    
131            public BlogsEntryLocalService getBlogsEntryLocalService() {
132                    return blogsEntryLocalService;
133            }
134    
135            public void setBlogsEntryLocalService(
136                    BlogsEntryLocalService blogsEntryLocalService) {
137                    this.blogsEntryLocalService = blogsEntryLocalService;
138            }
139    
140            public BlogsEntryService getBlogsEntryService() {
141                    return blogsEntryService;
142            }
143    
144            public void setBlogsEntryService(BlogsEntryService blogsEntryService) {
145                    this.blogsEntryService = blogsEntryService;
146            }
147    
148            public BlogsEntryPersistence getBlogsEntryPersistence() {
149                    return blogsEntryPersistence;
150            }
151    
152            public void setBlogsEntryPersistence(
153                    BlogsEntryPersistence blogsEntryPersistence) {
154                    this.blogsEntryPersistence = blogsEntryPersistence;
155            }
156    
157            public BlogsEntryFinder getBlogsEntryFinder() {
158                    return blogsEntryFinder;
159            }
160    
161            public void setBlogsEntryFinder(BlogsEntryFinder blogsEntryFinder) {
162                    this.blogsEntryFinder = blogsEntryFinder;
163            }
164    
165            public BlogsStatsUserLocalService getBlogsStatsUserLocalService() {
166                    return blogsStatsUserLocalService;
167            }
168    
169            public void setBlogsStatsUserLocalService(
170                    BlogsStatsUserLocalService blogsStatsUserLocalService) {
171                    this.blogsStatsUserLocalService = blogsStatsUserLocalService;
172            }
173    
174            public BlogsStatsUserPersistence getBlogsStatsUserPersistence() {
175                    return blogsStatsUserPersistence;
176            }
177    
178            public void setBlogsStatsUserPersistence(
179                    BlogsStatsUserPersistence blogsStatsUserPersistence) {
180                    this.blogsStatsUserPersistence = blogsStatsUserPersistence;
181            }
182    
183            public BlogsStatsUserFinder getBlogsStatsUserFinder() {
184                    return blogsStatsUserFinder;
185            }
186    
187            public void setBlogsStatsUserFinder(
188                    BlogsStatsUserFinder blogsStatsUserFinder) {
189                    this.blogsStatsUserFinder = blogsStatsUserFinder;
190            }
191    
192            public CounterLocalService getCounterLocalService() {
193                    return counterLocalService;
194            }
195    
196            public void setCounterLocalService(CounterLocalService counterLocalService) {
197                    this.counterLocalService = counterLocalService;
198            }
199    
200            public GroupLocalService getGroupLocalService() {
201                    return groupLocalService;
202            }
203    
204            public void setGroupLocalService(GroupLocalService groupLocalService) {
205                    this.groupLocalService = groupLocalService;
206            }
207    
208            public GroupService getGroupService() {
209                    return groupService;
210            }
211    
212            public void setGroupService(GroupService groupService) {
213                    this.groupService = groupService;
214            }
215    
216            public GroupPersistence getGroupPersistence() {
217                    return groupPersistence;
218            }
219    
220            public void setGroupPersistence(GroupPersistence groupPersistence) {
221                    this.groupPersistence = groupPersistence;
222            }
223    
224            public GroupFinder getGroupFinder() {
225                    return groupFinder;
226            }
227    
228            public void setGroupFinder(GroupFinder groupFinder) {
229                    this.groupFinder = groupFinder;
230            }
231    
232            public ResourceLocalService getResourceLocalService() {
233                    return resourceLocalService;
234            }
235    
236            public void setResourceLocalService(
237                    ResourceLocalService resourceLocalService) {
238                    this.resourceLocalService = resourceLocalService;
239            }
240    
241            public ResourceService getResourceService() {
242                    return resourceService;
243            }
244    
245            public void setResourceService(ResourceService resourceService) {
246                    this.resourceService = resourceService;
247            }
248    
249            public ResourcePersistence getResourcePersistence() {
250                    return resourcePersistence;
251            }
252    
253            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
254                    this.resourcePersistence = resourcePersistence;
255            }
256    
257            public ResourceFinder getResourceFinder() {
258                    return resourceFinder;
259            }
260    
261            public void setResourceFinder(ResourceFinder resourceFinder) {
262                    this.resourceFinder = resourceFinder;
263            }
264    
265            public UserLocalService getUserLocalService() {
266                    return userLocalService;
267            }
268    
269            public void setUserLocalService(UserLocalService userLocalService) {
270                    this.userLocalService = userLocalService;
271            }
272    
273            public UserService getUserService() {
274                    return userService;
275            }
276    
277            public void setUserService(UserService userService) {
278                    this.userService = userService;
279            }
280    
281            public UserPersistence getUserPersistence() {
282                    return userPersistence;
283            }
284    
285            public void setUserPersistence(UserPersistence userPersistence) {
286                    this.userPersistence = userPersistence;
287            }
288    
289            public UserFinder getUserFinder() {
290                    return userFinder;
291            }
292    
293            public void setUserFinder(UserFinder userFinder) {
294                    this.userFinder = userFinder;
295            }
296    
297            protected void runSQL(String sql) throws SystemException {
298                    try {
299                            DataSource dataSource = blogsStatsUserPersistence.getDataSource();
300    
301                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
302                                            sql, new int[0]);
303    
304                            sqlUpdate.update();
305                    }
306                    catch (Exception e) {
307                            throw new SystemException(e);
308                    }
309            }
310    
311            @BeanReference(type = BlogsEntryLocalService.class)
312            protected BlogsEntryLocalService blogsEntryLocalService;
313            @BeanReference(type = BlogsEntryService.class)
314            protected BlogsEntryService blogsEntryService;
315            @BeanReference(type = BlogsEntryPersistence.class)
316            protected BlogsEntryPersistence blogsEntryPersistence;
317            @BeanReference(type = BlogsEntryFinder.class)
318            protected BlogsEntryFinder blogsEntryFinder;
319            @BeanReference(type = BlogsStatsUserLocalService.class)
320            protected BlogsStatsUserLocalService blogsStatsUserLocalService;
321            @BeanReference(type = BlogsStatsUserPersistence.class)
322            protected BlogsStatsUserPersistence blogsStatsUserPersistence;
323            @BeanReference(type = BlogsStatsUserFinder.class)
324            protected BlogsStatsUserFinder blogsStatsUserFinder;
325            @BeanReference(type = CounterLocalService.class)
326            protected CounterLocalService counterLocalService;
327            @BeanReference(type = GroupLocalService.class)
328            protected GroupLocalService groupLocalService;
329            @BeanReference(type = GroupService.class)
330            protected GroupService groupService;
331            @BeanReference(type = GroupPersistence.class)
332            protected GroupPersistence groupPersistence;
333            @BeanReference(type = GroupFinder.class)
334            protected GroupFinder groupFinder;
335            @BeanReference(type = ResourceLocalService.class)
336            protected ResourceLocalService resourceLocalService;
337            @BeanReference(type = ResourceService.class)
338            protected ResourceService resourceService;
339            @BeanReference(type = ResourcePersistence.class)
340            protected ResourcePersistence resourcePersistence;
341            @BeanReference(type = ResourceFinder.class)
342            protected ResourceFinder resourceFinder;
343            @BeanReference(type = UserLocalService.class)
344            protected UserLocalService userLocalService;
345            @BeanReference(type = UserService.class)
346            protected UserService userService;
347            @BeanReference(type = UserPersistence.class)
348            protected UserPersistence userPersistence;
349            @BeanReference(type = UserFinder.class)
350            protected UserFinder userFinder;
351    }