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