001    /**
002     * Copyright (c) 2000-present 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.social.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028    import com.liferay.portal.kernel.dao.orm.Projection;
029    import com.liferay.portal.kernel.exception.PortalException;
030    import com.liferay.portal.kernel.exception.SystemException;
031    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
032    import com.liferay.portal.kernel.search.Indexable;
033    import com.liferay.portal.kernel.search.IndexableType;
034    import com.liferay.portal.kernel.util.OrderByComparator;
035    import com.liferay.portal.model.PersistedModel;
036    import com.liferay.portal.service.BaseLocalServiceImpl;
037    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
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    import com.liferay.portal.util.PortalUtil;
043    
044    import com.liferay.portlet.social.model.SocialActivityLimit;
045    import com.liferay.portlet.social.service.SocialActivityLimitLocalService;
046    import com.liferay.portlet.social.service.persistence.SocialActivityLimitPersistence;
047    
048    import java.io.Serializable;
049    
050    import java.util.List;
051    
052    import javax.sql.DataSource;
053    
054    /**
055     * Provides the base implementation for the social activity limit local service.
056     *
057     * <p>
058     * 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.social.service.impl.SocialActivityLimitLocalServiceImpl}.
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see com.liferay.portlet.social.service.impl.SocialActivityLimitLocalServiceImpl
063     * @see com.liferay.portlet.social.service.SocialActivityLimitLocalServiceUtil
064     * @generated
065     */
066    @ProviderType
067    public abstract class SocialActivityLimitLocalServiceBaseImpl
068            extends BaseLocalServiceImpl implements SocialActivityLimitLocalService,
069                    IdentifiableOSGiService {
070            /*
071             * NOTE FOR DEVELOPERS:
072             *
073             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.social.service.SocialActivityLimitLocalServiceUtil} to access the social activity limit local service.
074             */
075    
076            /**
077             * Adds the social activity limit to the database. Also notifies the appropriate model listeners.
078             *
079             * @param socialActivityLimit the social activity limit
080             * @return the social activity limit that was added
081             */
082            @Indexable(type = IndexableType.REINDEX)
083            @Override
084            public SocialActivityLimit addSocialActivityLimit(
085                    SocialActivityLimit socialActivityLimit) {
086                    socialActivityLimit.setNew(true);
087    
088                    return socialActivityLimitPersistence.update(socialActivityLimit);
089            }
090    
091            /**
092             * Creates a new social activity limit with the primary key. Does not add the social activity limit to the database.
093             *
094             * @param activityLimitId the primary key for the new social activity limit
095             * @return the new social activity limit
096             */
097            @Override
098            public SocialActivityLimit createSocialActivityLimit(long activityLimitId) {
099                    return socialActivityLimitPersistence.create(activityLimitId);
100            }
101    
102            /**
103             * Deletes the social activity limit with the primary key from the database. Also notifies the appropriate model listeners.
104             *
105             * @param activityLimitId the primary key of the social activity limit
106             * @return the social activity limit that was removed
107             * @throws PortalException if a social activity limit with the primary key could not be found
108             */
109            @Indexable(type = IndexableType.DELETE)
110            @Override
111            public SocialActivityLimit deleteSocialActivityLimit(long activityLimitId)
112                    throws PortalException {
113                    return socialActivityLimitPersistence.remove(activityLimitId);
114            }
115    
116            /**
117             * Deletes the social activity limit from the database. Also notifies the appropriate model listeners.
118             *
119             * @param socialActivityLimit the social activity limit
120             * @return the social activity limit that was removed
121             */
122            @Indexable(type = IndexableType.DELETE)
123            @Override
124            public SocialActivityLimit deleteSocialActivityLimit(
125                    SocialActivityLimit socialActivityLimit) {
126                    return socialActivityLimitPersistence.remove(socialActivityLimit);
127            }
128    
129            @Override
130            public DynamicQuery dynamicQuery() {
131                    Class<?> clazz = getClass();
132    
133                    return DynamicQueryFactoryUtil.forClass(SocialActivityLimit.class,
134                            clazz.getClassLoader());
135            }
136    
137            /**
138             * Performs a dynamic query on the database and returns the matching rows.
139             *
140             * @param dynamicQuery the dynamic query
141             * @return the matching rows
142             */
143            @Override
144            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
145                    return socialActivityLimitPersistence.findWithDynamicQuery(dynamicQuery);
146            }
147    
148            /**
149             * Performs a dynamic query on the database and returns a range of the matching rows.
150             *
151             * <p>
152             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialActivityLimitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
153             * </p>
154             *
155             * @param dynamicQuery the dynamic query
156             * @param start the lower bound of the range of model instances
157             * @param end the upper bound of the range of model instances (not inclusive)
158             * @return the range of matching rows
159             */
160            @Override
161            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
162                    int end) {
163                    return socialActivityLimitPersistence.findWithDynamicQuery(dynamicQuery,
164                            start, end);
165            }
166    
167            /**
168             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
169             *
170             * <p>
171             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialActivityLimitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
172             * </p>
173             *
174             * @param dynamicQuery the dynamic query
175             * @param start the lower bound of the range of model instances
176             * @param end the upper bound of the range of model instances (not inclusive)
177             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
178             * @return the ordered range of matching rows
179             */
180            @Override
181            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
182                    int end, OrderByComparator<T> orderByComparator) {
183                    return socialActivityLimitPersistence.findWithDynamicQuery(dynamicQuery,
184                            start, end, orderByComparator);
185            }
186    
187            /**
188             * Returns the number of rows matching the dynamic query.
189             *
190             * @param dynamicQuery the dynamic query
191             * @return the number of rows matching the dynamic query
192             */
193            @Override
194            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
195                    return socialActivityLimitPersistence.countWithDynamicQuery(dynamicQuery);
196            }
197    
198            /**
199             * Returns the number of rows matching the dynamic query.
200             *
201             * @param dynamicQuery the dynamic query
202             * @param projection the projection to apply to the query
203             * @return the number of rows matching the dynamic query
204             */
205            @Override
206            public long dynamicQueryCount(DynamicQuery dynamicQuery,
207                    Projection projection) {
208                    return socialActivityLimitPersistence.countWithDynamicQuery(dynamicQuery,
209                            projection);
210            }
211    
212            @Override
213            public SocialActivityLimit fetchSocialActivityLimit(long activityLimitId) {
214                    return socialActivityLimitPersistence.fetchByPrimaryKey(activityLimitId);
215            }
216    
217            /**
218             * Returns the social activity limit with the primary key.
219             *
220             * @param activityLimitId the primary key of the social activity limit
221             * @return the social activity limit
222             * @throws PortalException if a social activity limit with the primary key could not be found
223             */
224            @Override
225            public SocialActivityLimit getSocialActivityLimit(long activityLimitId)
226                    throws PortalException {
227                    return socialActivityLimitPersistence.findByPrimaryKey(activityLimitId);
228            }
229    
230            @Override
231            public ActionableDynamicQuery getActionableDynamicQuery() {
232                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
233    
234                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialActivityLimitLocalServiceUtil.getService());
235                    actionableDynamicQuery.setClass(SocialActivityLimit.class);
236                    actionableDynamicQuery.setClassLoader(getClassLoader());
237    
238                    actionableDynamicQuery.setPrimaryKeyPropertyName("activityLimitId");
239    
240                    return actionableDynamicQuery;
241            }
242    
243            protected void initActionableDynamicQuery(
244                    ActionableDynamicQuery actionableDynamicQuery) {
245                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialActivityLimitLocalServiceUtil.getService());
246                    actionableDynamicQuery.setClass(SocialActivityLimit.class);
247                    actionableDynamicQuery.setClassLoader(getClassLoader());
248    
249                    actionableDynamicQuery.setPrimaryKeyPropertyName("activityLimitId");
250            }
251    
252            /**
253             * @throws PortalException
254             */
255            @Override
256            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
257                    throws PortalException {
258                    return socialActivityLimitLocalService.deleteSocialActivityLimit((SocialActivityLimit)persistedModel);
259            }
260    
261            @Override
262            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
263                    throws PortalException {
264                    return socialActivityLimitPersistence.findByPrimaryKey(primaryKeyObj);
265            }
266    
267            /**
268             * Returns a range of all the social activity limits.
269             *
270             * <p>
271             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialActivityLimitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
272             * </p>
273             *
274             * @param start the lower bound of the range of social activity limits
275             * @param end the upper bound of the range of social activity limits (not inclusive)
276             * @return the range of social activity limits
277             */
278            @Override
279            public List<SocialActivityLimit> getSocialActivityLimits(int start, int end) {
280                    return socialActivityLimitPersistence.findAll(start, end);
281            }
282    
283            /**
284             * Returns the number of social activity limits.
285             *
286             * @return the number of social activity limits
287             */
288            @Override
289            public int getSocialActivityLimitsCount() {
290                    return socialActivityLimitPersistence.countAll();
291            }
292    
293            /**
294             * Updates the social activity limit in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
295             *
296             * @param socialActivityLimit the social activity limit
297             * @return the social activity limit that was updated
298             */
299            @Indexable(type = IndexableType.REINDEX)
300            @Override
301            public SocialActivityLimit updateSocialActivityLimit(
302                    SocialActivityLimit socialActivityLimit) {
303                    return socialActivityLimitPersistence.update(socialActivityLimit);
304            }
305    
306            /**
307             * Returns the social activity limit local service.
308             *
309             * @return the social activity limit local service
310             */
311            public SocialActivityLimitLocalService getSocialActivityLimitLocalService() {
312                    return socialActivityLimitLocalService;
313            }
314    
315            /**
316             * Sets the social activity limit local service.
317             *
318             * @param socialActivityLimitLocalService the social activity limit local service
319             */
320            public void setSocialActivityLimitLocalService(
321                    SocialActivityLimitLocalService socialActivityLimitLocalService) {
322                    this.socialActivityLimitLocalService = socialActivityLimitLocalService;
323            }
324    
325            /**
326             * Returns the social activity limit persistence.
327             *
328             * @return the social activity limit persistence
329             */
330            public SocialActivityLimitPersistence getSocialActivityLimitPersistence() {
331                    return socialActivityLimitPersistence;
332            }
333    
334            /**
335             * Sets the social activity limit persistence.
336             *
337             * @param socialActivityLimitPersistence the social activity limit persistence
338             */
339            public void setSocialActivityLimitPersistence(
340                    SocialActivityLimitPersistence socialActivityLimitPersistence) {
341                    this.socialActivityLimitPersistence = socialActivityLimitPersistence;
342            }
343    
344            /**
345             * Returns the counter local service.
346             *
347             * @return the counter local service
348             */
349            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
350                    return counterLocalService;
351            }
352    
353            /**
354             * Sets the counter local service.
355             *
356             * @param counterLocalService the counter local service
357             */
358            public void setCounterLocalService(
359                    com.liferay.counter.service.CounterLocalService counterLocalService) {
360                    this.counterLocalService = counterLocalService;
361            }
362    
363            /**
364             * Returns the group local service.
365             *
366             * @return the group local service
367             */
368            public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
369                    return groupLocalService;
370            }
371    
372            /**
373             * Sets the group local service.
374             *
375             * @param groupLocalService the group local service
376             */
377            public void setGroupLocalService(
378                    com.liferay.portal.service.GroupLocalService groupLocalService) {
379                    this.groupLocalService = groupLocalService;
380            }
381    
382            /**
383             * Returns the group remote service.
384             *
385             * @return the group remote service
386             */
387            public com.liferay.portal.service.GroupService getGroupService() {
388                    return groupService;
389            }
390    
391            /**
392             * Sets the group remote service.
393             *
394             * @param groupService the group remote service
395             */
396            public void setGroupService(
397                    com.liferay.portal.service.GroupService groupService) {
398                    this.groupService = groupService;
399            }
400    
401            /**
402             * Returns the group persistence.
403             *
404             * @return the group persistence
405             */
406            public GroupPersistence getGroupPersistence() {
407                    return groupPersistence;
408            }
409    
410            /**
411             * Sets the group persistence.
412             *
413             * @param groupPersistence the group persistence
414             */
415            public void setGroupPersistence(GroupPersistence groupPersistence) {
416                    this.groupPersistence = groupPersistence;
417            }
418    
419            /**
420             * Returns the group finder.
421             *
422             * @return the group finder
423             */
424            public GroupFinder getGroupFinder() {
425                    return groupFinder;
426            }
427    
428            /**
429             * Sets the group finder.
430             *
431             * @param groupFinder the group finder
432             */
433            public void setGroupFinder(GroupFinder groupFinder) {
434                    this.groupFinder = groupFinder;
435            }
436    
437            /**
438             * Returns the user local service.
439             *
440             * @return the user local service
441             */
442            public com.liferay.portal.service.UserLocalService getUserLocalService() {
443                    return userLocalService;
444            }
445    
446            /**
447             * Sets the user local service.
448             *
449             * @param userLocalService the user local service
450             */
451            public void setUserLocalService(
452                    com.liferay.portal.service.UserLocalService userLocalService) {
453                    this.userLocalService = userLocalService;
454            }
455    
456            /**
457             * Returns the user remote service.
458             *
459             * @return the user remote service
460             */
461            public com.liferay.portal.service.UserService getUserService() {
462                    return userService;
463            }
464    
465            /**
466             * Sets the user remote service.
467             *
468             * @param userService the user remote service
469             */
470            public void setUserService(
471                    com.liferay.portal.service.UserService userService) {
472                    this.userService = userService;
473            }
474    
475            /**
476             * Returns the user persistence.
477             *
478             * @return the user persistence
479             */
480            public UserPersistence getUserPersistence() {
481                    return userPersistence;
482            }
483    
484            /**
485             * Sets the user persistence.
486             *
487             * @param userPersistence the user persistence
488             */
489            public void setUserPersistence(UserPersistence userPersistence) {
490                    this.userPersistence = userPersistence;
491            }
492    
493            /**
494             * Returns the user finder.
495             *
496             * @return the user finder
497             */
498            public UserFinder getUserFinder() {
499                    return userFinder;
500            }
501    
502            /**
503             * Sets the user finder.
504             *
505             * @param userFinder the user finder
506             */
507            public void setUserFinder(UserFinder userFinder) {
508                    this.userFinder = userFinder;
509            }
510    
511            public void afterPropertiesSet() {
512                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.social.model.SocialActivityLimit",
513                            socialActivityLimitLocalService);
514            }
515    
516            public void destroy() {
517                    persistedModelLocalServiceRegistry.unregister(
518                            "com.liferay.portlet.social.model.SocialActivityLimit");
519            }
520    
521            /**
522             * Returns the OSGi service identifier.
523             *
524             * @return the OSGi service identifier
525             */
526            @Override
527            public String getOSGiServiceIdentifier() {
528                    return SocialActivityLimitLocalService.class.getName();
529            }
530    
531            protected Class<?> getModelClass() {
532                    return SocialActivityLimit.class;
533            }
534    
535            protected String getModelClassName() {
536                    return SocialActivityLimit.class.getName();
537            }
538    
539            /**
540             * Performs a SQL query.
541             *
542             * @param sql the sql query
543             */
544            protected void runSQL(String sql) {
545                    try {
546                            DataSource dataSource = socialActivityLimitPersistence.getDataSource();
547    
548                            DB db = DBFactoryUtil.getDB();
549    
550                            sql = db.buildSQL(sql);
551                            sql = PortalUtil.transformSQL(sql);
552    
553                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
554                                            sql, new int[0]);
555    
556                            sqlUpdate.update();
557                    }
558                    catch (Exception e) {
559                            throw new SystemException(e);
560                    }
561            }
562    
563            @BeanReference(type = com.liferay.portlet.social.service.SocialActivityLimitLocalService.class)
564            protected SocialActivityLimitLocalService socialActivityLimitLocalService;
565            @BeanReference(type = SocialActivityLimitPersistence.class)
566            protected SocialActivityLimitPersistence socialActivityLimitPersistence;
567            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
568            protected com.liferay.counter.service.CounterLocalService counterLocalService;
569            @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
570            protected com.liferay.portal.service.GroupLocalService groupLocalService;
571            @BeanReference(type = com.liferay.portal.service.GroupService.class)
572            protected com.liferay.portal.service.GroupService groupService;
573            @BeanReference(type = GroupPersistence.class)
574            protected GroupPersistence groupPersistence;
575            @BeanReference(type = GroupFinder.class)
576            protected GroupFinder groupFinder;
577            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
578            protected com.liferay.portal.service.UserLocalService userLocalService;
579            @BeanReference(type = com.liferay.portal.service.UserService.class)
580            protected com.liferay.portal.service.UserService userService;
581            @BeanReference(type = UserPersistence.class)
582            protected UserPersistence userPersistence;
583            @BeanReference(type = UserFinder.class)
584            protected UserFinder userFinder;
585            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
586            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
587    }