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     * The base implementation of the blogs stats user local service.
054     *
055     * <p>
056     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portlet.blogs.service.impl.BlogsStatsUserLocalServiceImpl}.
057     * </p>
058     *
059     * <p>
060     * Never modify or reference this class directly. Always use {@link com.liferay.portlet.blogs.service.BlogsStatsUserLocalServiceUtil} to access the blogs stats user local service.
061     * </p>
062     *
063     * @author Brian Wing Shun Chan
064     * @see com.liferay.portlet.blogs.service.impl.BlogsStatsUserLocalServiceImpl
065     * @see com.liferay.portlet.blogs.service.BlogsStatsUserLocalServiceUtil
066     * @generated
067     */
068    public abstract class BlogsStatsUserLocalServiceBaseImpl
069            implements BlogsStatsUserLocalService {
070            /**
071             * Adds the blogs stats user to the database. Also notifies the appropriate model listeners.
072             *
073             * @param blogsStatsUser the blogs stats user to add
074             * @return the blogs stats user that was added
075             * @throws SystemException if a system exception occurred
076             */
077            public BlogsStatsUser addBlogsStatsUser(BlogsStatsUser blogsStatsUser)
078                    throws SystemException {
079                    blogsStatsUser.setNew(true);
080    
081                    return blogsStatsUserPersistence.update(blogsStatsUser, false);
082            }
083    
084            /**
085             * Creates a new blogs stats user with the primary key. Does not add the blogs stats user to the database.
086             *
087             * @param statsUserId the primary key for the new blogs stats user
088             * @return the new blogs stats user
089             */
090            public BlogsStatsUser createBlogsStatsUser(long statsUserId) {
091                    return blogsStatsUserPersistence.create(statsUserId);
092            }
093    
094            /**
095             * Deletes the blogs stats user with the primary key from the database. Also notifies the appropriate model listeners.
096             *
097             * @param statsUserId the primary key of the blogs stats user to delete
098             * @throws PortalException if a blogs stats user with the primary key could not be found
099             * @throws SystemException if a system exception occurred
100             */
101            public void deleteBlogsStatsUser(long statsUserId)
102                    throws PortalException, SystemException {
103                    blogsStatsUserPersistence.remove(statsUserId);
104            }
105    
106            /**
107             * Deletes the blogs stats user from the database. Also notifies the appropriate model listeners.
108             *
109             * @param blogsStatsUser the blogs stats user to delete
110             * @throws SystemException if a system exception occurred
111             */
112            public void deleteBlogsStatsUser(BlogsStatsUser blogsStatsUser)
113                    throws SystemException {
114                    blogsStatsUserPersistence.remove(blogsStatsUser);
115            }
116    
117            /**
118             * Performs a dynamic query on the database and returns the matching rows.
119             *
120             * @param dynamicQuery the dynamic query to search with
121             * @return the matching rows
122             * @throws SystemException if a system exception occurred
123             */
124            @SuppressWarnings("rawtypes")
125            public List dynamicQuery(DynamicQuery dynamicQuery)
126                    throws SystemException {
127                    return blogsStatsUserPersistence.findWithDynamicQuery(dynamicQuery);
128            }
129    
130            /**
131             * Performs a dynamic query on the database and returns a range of the matching rows.
132             *
133             * <p>
134             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
135             * </p>
136             *
137             * @param dynamicQuery the dynamic query to search with
138             * @param start the lower bound of the range of model instances to return
139             * @param end the upper bound of the range of model instances to return (not inclusive)
140             * @return the range of matching rows
141             * @throws SystemException if a system exception occurred
142             */
143            @SuppressWarnings("rawtypes")
144            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
145                    throws SystemException {
146                    return blogsStatsUserPersistence.findWithDynamicQuery(dynamicQuery,
147                            start, end);
148            }
149    
150            /**
151             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
152             *
153             * <p>
154             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
155             * </p>
156             *
157             * @param dynamicQuery the dynamic query to search with
158             * @param start the lower bound of the range of model instances to return
159             * @param end the upper bound of the range of model instances to return (not inclusive)
160             * @param orderByComparator the comparator to order the results by
161             * @return the ordered range of matching rows
162             * @throws SystemException if a system exception occurred
163             */
164            @SuppressWarnings("rawtypes")
165            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
166                    OrderByComparator orderByComparator) throws SystemException {
167                    return blogsStatsUserPersistence.findWithDynamicQuery(dynamicQuery,
168                            start, end, orderByComparator);
169            }
170    
171            /**
172             * Counts the number of rows that match the dynamic query.
173             *
174             * @param dynamicQuery the dynamic query to search with
175             * @return the number of rows that match the dynamic query
176             * @throws SystemException if a system exception occurred
177             */
178            public long dynamicQueryCount(DynamicQuery dynamicQuery)
179                    throws SystemException {
180                    return blogsStatsUserPersistence.countWithDynamicQuery(dynamicQuery);
181            }
182    
183            /**
184             * Gets the blogs stats user with the primary key.
185             *
186             * @param statsUserId the primary key of the blogs stats user to get
187             * @return the blogs stats user
188             * @throws PortalException if a blogs stats user with the primary key could not be found
189             * @throws SystemException if a system exception occurred
190             */
191            public BlogsStatsUser getBlogsStatsUser(long statsUserId)
192                    throws PortalException, SystemException {
193                    return blogsStatsUserPersistence.findByPrimaryKey(statsUserId);
194            }
195    
196            /**
197             * Gets a range of all the blogs stats users.
198             *
199             * <p>
200             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
201             * </p>
202             *
203             * @param start the lower bound of the range of blogs stats users to return
204             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
205             * @return the range of blogs stats users
206             * @throws SystemException if a system exception occurred
207             */
208            public List<BlogsStatsUser> getBlogsStatsUsers(int start, int end)
209                    throws SystemException {
210                    return blogsStatsUserPersistence.findAll(start, end);
211            }
212    
213            /**
214             * Gets the number of blogs stats users.
215             *
216             * @return the number of blogs stats users
217             * @throws SystemException if a system exception occurred
218             */
219            public int getBlogsStatsUsersCount() throws SystemException {
220                    return blogsStatsUserPersistence.countAll();
221            }
222    
223            /**
224             * Updates the blogs stats user in the database. Also notifies the appropriate model listeners.
225             *
226             * @param blogsStatsUser the blogs stats user to update
227             * @return the blogs stats user that was updated
228             * @throws SystemException if a system exception occurred
229             */
230            public BlogsStatsUser updateBlogsStatsUser(BlogsStatsUser blogsStatsUser)
231                    throws SystemException {
232                    blogsStatsUser.setNew(false);
233    
234                    return blogsStatsUserPersistence.update(blogsStatsUser, true);
235            }
236    
237            /**
238             * Updates the blogs stats user in the database. Also notifies the appropriate model listeners.
239             *
240             * @param blogsStatsUser the blogs stats user to update
241             * @param merge whether to merge the blogs stats user with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
242             * @return the blogs stats user that was updated
243             * @throws SystemException if a system exception occurred
244             */
245            public BlogsStatsUser updateBlogsStatsUser(BlogsStatsUser blogsStatsUser,
246                    boolean merge) throws SystemException {
247                    blogsStatsUser.setNew(false);
248    
249                    return blogsStatsUserPersistence.update(blogsStatsUser, merge);
250            }
251    
252            /**
253             * Gets the blogs entry local service.
254             *
255             * @return the blogs entry local service
256             */
257            public BlogsEntryLocalService getBlogsEntryLocalService() {
258                    return blogsEntryLocalService;
259            }
260    
261            /**
262             * Sets the blogs entry local service.
263             *
264             * @param blogsEntryLocalService the blogs entry local service
265             */
266            public void setBlogsEntryLocalService(
267                    BlogsEntryLocalService blogsEntryLocalService) {
268                    this.blogsEntryLocalService = blogsEntryLocalService;
269            }
270    
271            /**
272             * Gets the blogs entry remote service.
273             *
274             * @return the blogs entry remote service
275             */
276            public BlogsEntryService getBlogsEntryService() {
277                    return blogsEntryService;
278            }
279    
280            /**
281             * Sets the blogs entry remote service.
282             *
283             * @param blogsEntryService the blogs entry remote service
284             */
285            public void setBlogsEntryService(BlogsEntryService blogsEntryService) {
286                    this.blogsEntryService = blogsEntryService;
287            }
288    
289            /**
290             * Gets the blogs entry persistence.
291             *
292             * @return the blogs entry persistence
293             */
294            public BlogsEntryPersistence getBlogsEntryPersistence() {
295                    return blogsEntryPersistence;
296            }
297    
298            /**
299             * Sets the blogs entry persistence.
300             *
301             * @param blogsEntryPersistence the blogs entry persistence
302             */
303            public void setBlogsEntryPersistence(
304                    BlogsEntryPersistence blogsEntryPersistence) {
305                    this.blogsEntryPersistence = blogsEntryPersistence;
306            }
307    
308            /**
309             * Gets the blogs entry finder.
310             *
311             * @return the blogs entry finder
312             */
313            public BlogsEntryFinder getBlogsEntryFinder() {
314                    return blogsEntryFinder;
315            }
316    
317            /**
318             * Sets the blogs entry finder.
319             *
320             * @param blogsEntryFinder the blogs entry finder
321             */
322            public void setBlogsEntryFinder(BlogsEntryFinder blogsEntryFinder) {
323                    this.blogsEntryFinder = blogsEntryFinder;
324            }
325    
326            /**
327             * Gets the blogs stats user local service.
328             *
329             * @return the blogs stats user local service
330             */
331            public BlogsStatsUserLocalService getBlogsStatsUserLocalService() {
332                    return blogsStatsUserLocalService;
333            }
334    
335            /**
336             * Sets the blogs stats user local service.
337             *
338             * @param blogsStatsUserLocalService the blogs stats user local service
339             */
340            public void setBlogsStatsUserLocalService(
341                    BlogsStatsUserLocalService blogsStatsUserLocalService) {
342                    this.blogsStatsUserLocalService = blogsStatsUserLocalService;
343            }
344    
345            /**
346             * Gets the blogs stats user persistence.
347             *
348             * @return the blogs stats user persistence
349             */
350            public BlogsStatsUserPersistence getBlogsStatsUserPersistence() {
351                    return blogsStatsUserPersistence;
352            }
353    
354            /**
355             * Sets the blogs stats user persistence.
356             *
357             * @param blogsStatsUserPersistence the blogs stats user persistence
358             */
359            public void setBlogsStatsUserPersistence(
360                    BlogsStatsUserPersistence blogsStatsUserPersistence) {
361                    this.blogsStatsUserPersistence = blogsStatsUserPersistence;
362            }
363    
364            /**
365             * Gets the blogs stats user finder.
366             *
367             * @return the blogs stats user finder
368             */
369            public BlogsStatsUserFinder getBlogsStatsUserFinder() {
370                    return blogsStatsUserFinder;
371            }
372    
373            /**
374             * Sets the blogs stats user finder.
375             *
376             * @param blogsStatsUserFinder the blogs stats user finder
377             */
378            public void setBlogsStatsUserFinder(
379                    BlogsStatsUserFinder blogsStatsUserFinder) {
380                    this.blogsStatsUserFinder = blogsStatsUserFinder;
381            }
382    
383            /**
384             * Gets the counter local service.
385             *
386             * @return the counter local service
387             */
388            public CounterLocalService getCounterLocalService() {
389                    return counterLocalService;
390            }
391    
392            /**
393             * Sets the counter local service.
394             *
395             * @param counterLocalService the counter local service
396             */
397            public void setCounterLocalService(CounterLocalService counterLocalService) {
398                    this.counterLocalService = counterLocalService;
399            }
400    
401            /**
402             * Gets the group local service.
403             *
404             * @return the group local service
405             */
406            public GroupLocalService getGroupLocalService() {
407                    return groupLocalService;
408            }
409    
410            /**
411             * Sets the group local service.
412             *
413             * @param groupLocalService the group local service
414             */
415            public void setGroupLocalService(GroupLocalService groupLocalService) {
416                    this.groupLocalService = groupLocalService;
417            }
418    
419            /**
420             * Gets the group remote service.
421             *
422             * @return the group remote service
423             */
424            public GroupService getGroupService() {
425                    return groupService;
426            }
427    
428            /**
429             * Sets the group remote service.
430             *
431             * @param groupService the group remote service
432             */
433            public void setGroupService(GroupService groupService) {
434                    this.groupService = groupService;
435            }
436    
437            /**
438             * Gets the group persistence.
439             *
440             * @return the group persistence
441             */
442            public GroupPersistence getGroupPersistence() {
443                    return groupPersistence;
444            }
445    
446            /**
447             * Sets the group persistence.
448             *
449             * @param groupPersistence the group persistence
450             */
451            public void setGroupPersistence(GroupPersistence groupPersistence) {
452                    this.groupPersistence = groupPersistence;
453            }
454    
455            /**
456             * Gets the group finder.
457             *
458             * @return the group finder
459             */
460            public GroupFinder getGroupFinder() {
461                    return groupFinder;
462            }
463    
464            /**
465             * Sets the group finder.
466             *
467             * @param groupFinder the group finder
468             */
469            public void setGroupFinder(GroupFinder groupFinder) {
470                    this.groupFinder = groupFinder;
471            }
472    
473            /**
474             * Gets the resource local service.
475             *
476             * @return the resource local service
477             */
478            public ResourceLocalService getResourceLocalService() {
479                    return resourceLocalService;
480            }
481    
482            /**
483             * Sets the resource local service.
484             *
485             * @param resourceLocalService the resource local service
486             */
487            public void setResourceLocalService(
488                    ResourceLocalService resourceLocalService) {
489                    this.resourceLocalService = resourceLocalService;
490            }
491    
492            /**
493             * Gets the resource remote service.
494             *
495             * @return the resource remote service
496             */
497            public ResourceService getResourceService() {
498                    return resourceService;
499            }
500    
501            /**
502             * Sets the resource remote service.
503             *
504             * @param resourceService the resource remote service
505             */
506            public void setResourceService(ResourceService resourceService) {
507                    this.resourceService = resourceService;
508            }
509    
510            /**
511             * Gets the resource persistence.
512             *
513             * @return the resource persistence
514             */
515            public ResourcePersistence getResourcePersistence() {
516                    return resourcePersistence;
517            }
518    
519            /**
520             * Sets the resource persistence.
521             *
522             * @param resourcePersistence the resource persistence
523             */
524            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
525                    this.resourcePersistence = resourcePersistence;
526            }
527    
528            /**
529             * Gets the resource finder.
530             *
531             * @return the resource finder
532             */
533            public ResourceFinder getResourceFinder() {
534                    return resourceFinder;
535            }
536    
537            /**
538             * Sets the resource finder.
539             *
540             * @param resourceFinder the resource finder
541             */
542            public void setResourceFinder(ResourceFinder resourceFinder) {
543                    this.resourceFinder = resourceFinder;
544            }
545    
546            /**
547             * Gets the user local service.
548             *
549             * @return the user local service
550             */
551            public UserLocalService getUserLocalService() {
552                    return userLocalService;
553            }
554    
555            /**
556             * Sets the user local service.
557             *
558             * @param userLocalService the user local service
559             */
560            public void setUserLocalService(UserLocalService userLocalService) {
561                    this.userLocalService = userLocalService;
562            }
563    
564            /**
565             * Gets the user remote service.
566             *
567             * @return the user remote service
568             */
569            public UserService getUserService() {
570                    return userService;
571            }
572    
573            /**
574             * Sets the user remote service.
575             *
576             * @param userService the user remote service
577             */
578            public void setUserService(UserService userService) {
579                    this.userService = userService;
580            }
581    
582            /**
583             * Gets the user persistence.
584             *
585             * @return the user persistence
586             */
587            public UserPersistence getUserPersistence() {
588                    return userPersistence;
589            }
590    
591            /**
592             * Sets the user persistence.
593             *
594             * @param userPersistence the user persistence
595             */
596            public void setUserPersistence(UserPersistence userPersistence) {
597                    this.userPersistence = userPersistence;
598            }
599    
600            /**
601             * Gets the user finder.
602             *
603             * @return the user finder
604             */
605            public UserFinder getUserFinder() {
606                    return userFinder;
607            }
608    
609            /**
610             * Sets the user finder.
611             *
612             * @param userFinder the user finder
613             */
614            public void setUserFinder(UserFinder userFinder) {
615                    this.userFinder = userFinder;
616            }
617    
618            /**
619             * Performs an SQL query.
620             *
621             * @param sql the sql query to perform
622             */
623            protected void runSQL(String sql) throws SystemException {
624                    try {
625                            DataSource dataSource = blogsStatsUserPersistence.getDataSource();
626    
627                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
628                                            sql, new int[0]);
629    
630                            sqlUpdate.update();
631                    }
632                    catch (Exception e) {
633                            throw new SystemException(e);
634                    }
635            }
636    
637            @BeanReference(type = BlogsEntryLocalService.class)
638            protected BlogsEntryLocalService blogsEntryLocalService;
639            @BeanReference(type = BlogsEntryService.class)
640            protected BlogsEntryService blogsEntryService;
641            @BeanReference(type = BlogsEntryPersistence.class)
642            protected BlogsEntryPersistence blogsEntryPersistence;
643            @BeanReference(type = BlogsEntryFinder.class)
644            protected BlogsEntryFinder blogsEntryFinder;
645            @BeanReference(type = BlogsStatsUserLocalService.class)
646            protected BlogsStatsUserLocalService blogsStatsUserLocalService;
647            @BeanReference(type = BlogsStatsUserPersistence.class)
648            protected BlogsStatsUserPersistence blogsStatsUserPersistence;
649            @BeanReference(type = BlogsStatsUserFinder.class)
650            protected BlogsStatsUserFinder blogsStatsUserFinder;
651            @BeanReference(type = CounterLocalService.class)
652            protected CounterLocalService counterLocalService;
653            @BeanReference(type = GroupLocalService.class)
654            protected GroupLocalService groupLocalService;
655            @BeanReference(type = GroupService.class)
656            protected GroupService groupService;
657            @BeanReference(type = GroupPersistence.class)
658            protected GroupPersistence groupPersistence;
659            @BeanReference(type = GroupFinder.class)
660            protected GroupFinder groupFinder;
661            @BeanReference(type = ResourceLocalService.class)
662            protected ResourceLocalService resourceLocalService;
663            @BeanReference(type = ResourceService.class)
664            protected ResourceService resourceService;
665            @BeanReference(type = ResourcePersistence.class)
666            protected ResourcePersistence resourcePersistence;
667            @BeanReference(type = ResourceFinder.class)
668            protected ResourceFinder resourceFinder;
669            @BeanReference(type = UserLocalService.class)
670            protected UserLocalService userLocalService;
671            @BeanReference(type = UserService.class)
672            protected UserService userService;
673            @BeanReference(type = UserPersistence.class)
674            protected UserPersistence userPersistence;
675            @BeanReference(type = UserFinder.class)
676            protected UserFinder userFinder;
677    }