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