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.bean.IdentifiableBean;
021    import com.liferay.portal.kernel.dao.db.DB;
022    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
028    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
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.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.ClassNamePersistence;
039    import com.liferay.portal.service.persistence.GroupFinder;
040    import com.liferay.portal.service.persistence.GroupPersistence;
041    import com.liferay.portal.util.PortalUtil;
042    
043    import com.liferay.portlet.social.model.SocialActivitySetting;
044    import com.liferay.portlet.social.service.SocialActivitySettingLocalService;
045    import com.liferay.portlet.social.service.persistence.SocialActivitySettingPersistence;
046    
047    import java.io.Serializable;
048    
049    import java.util.List;
050    
051    import javax.sql.DataSource;
052    
053    /**
054     * Provides the base implementation for the social activity setting local service.
055     *
056     * <p>
057     * 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.SocialActivitySettingLocalServiceImpl}.
058     * </p>
059     *
060     * @author Brian Wing Shun Chan
061     * @see com.liferay.portlet.social.service.impl.SocialActivitySettingLocalServiceImpl
062     * @see com.liferay.portlet.social.service.SocialActivitySettingLocalServiceUtil
063     * @generated
064     */
065    @ProviderType
066    public abstract class SocialActivitySettingLocalServiceBaseImpl
067            extends BaseLocalServiceImpl implements SocialActivitySettingLocalService,
068                    IdentifiableBean {
069            /*
070             * NOTE FOR DEVELOPERS:
071             *
072             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.social.service.SocialActivitySettingLocalServiceUtil} to access the social activity setting local service.
073             */
074    
075            /**
076             * Adds the social activity setting to the database. Also notifies the appropriate model listeners.
077             *
078             * @param socialActivitySetting the social activity setting
079             * @return the social activity setting that was added
080             */
081            @Indexable(type = IndexableType.REINDEX)
082            @Override
083            public SocialActivitySetting addSocialActivitySetting(
084                    SocialActivitySetting socialActivitySetting) {
085                    socialActivitySetting.setNew(true);
086    
087                    return socialActivitySettingPersistence.update(socialActivitySetting);
088            }
089    
090            /**
091             * Creates a new social activity setting with the primary key. Does not add the social activity setting to the database.
092             *
093             * @param activitySettingId the primary key for the new social activity setting
094             * @return the new social activity setting
095             */
096            @Override
097            public SocialActivitySetting createSocialActivitySetting(
098                    long activitySettingId) {
099                    return socialActivitySettingPersistence.create(activitySettingId);
100            }
101    
102            /**
103             * Deletes the social activity setting with the primary key from the database. Also notifies the appropriate model listeners.
104             *
105             * @param activitySettingId the primary key of the social activity setting
106             * @return the social activity setting that was removed
107             * @throws PortalException if a social activity setting with the primary key could not be found
108             */
109            @Indexable(type = IndexableType.DELETE)
110            @Override
111            public SocialActivitySetting deleteSocialActivitySetting(
112                    long activitySettingId) throws PortalException {
113                    return socialActivitySettingPersistence.remove(activitySettingId);
114            }
115    
116            /**
117             * Deletes the social activity setting from the database. Also notifies the appropriate model listeners.
118             *
119             * @param socialActivitySetting the social activity setting
120             * @return the social activity setting that was removed
121             */
122            @Indexable(type = IndexableType.DELETE)
123            @Override
124            public SocialActivitySetting deleteSocialActivitySetting(
125                    SocialActivitySetting socialActivitySetting) {
126                    return socialActivitySettingPersistence.remove(socialActivitySetting);
127            }
128    
129            @Override
130            public DynamicQuery dynamicQuery() {
131                    Class<?> clazz = getClass();
132    
133                    return DynamicQueryFactoryUtil.forClass(SocialActivitySetting.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 socialActivitySettingPersistence.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.SocialActivitySettingModelImpl}. 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 socialActivitySettingPersistence.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.SocialActivitySettingModelImpl}. 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 socialActivitySettingPersistence.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 socialActivitySettingPersistence.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 socialActivitySettingPersistence.countWithDynamicQuery(dynamicQuery,
209                            projection);
210            }
211    
212            @Override
213            public SocialActivitySetting fetchSocialActivitySetting(
214                    long activitySettingId) {
215                    return socialActivitySettingPersistence.fetchByPrimaryKey(activitySettingId);
216            }
217    
218            /**
219             * Returns the social activity setting with the primary key.
220             *
221             * @param activitySettingId the primary key of the social activity setting
222             * @return the social activity setting
223             * @throws PortalException if a social activity setting with the primary key could not be found
224             */
225            @Override
226            public SocialActivitySetting getSocialActivitySetting(
227                    long activitySettingId) throws PortalException {
228                    return socialActivitySettingPersistence.findByPrimaryKey(activitySettingId);
229            }
230    
231            @Override
232            public ActionableDynamicQuery getActionableDynamicQuery() {
233                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
234    
235                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialActivitySettingLocalServiceUtil.getService());
236                    actionableDynamicQuery.setClass(SocialActivitySetting.class);
237                    actionableDynamicQuery.setClassLoader(getClassLoader());
238    
239                    actionableDynamicQuery.setPrimaryKeyPropertyName("activitySettingId");
240    
241                    return actionableDynamicQuery;
242            }
243    
244            protected void initActionableDynamicQuery(
245                    ActionableDynamicQuery actionableDynamicQuery) {
246                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialActivitySettingLocalServiceUtil.getService());
247                    actionableDynamicQuery.setClass(SocialActivitySetting.class);
248                    actionableDynamicQuery.setClassLoader(getClassLoader());
249    
250                    actionableDynamicQuery.setPrimaryKeyPropertyName("activitySettingId");
251            }
252    
253            /**
254             * @throws PortalException
255             */
256            @Override
257            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
258                    throws PortalException {
259                    return socialActivitySettingLocalService.deleteSocialActivitySetting((SocialActivitySetting)persistedModel);
260            }
261    
262            @Override
263            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
264                    throws PortalException {
265                    return socialActivitySettingPersistence.findByPrimaryKey(primaryKeyObj);
266            }
267    
268            /**
269             * Returns a range of all the social activity settings.
270             *
271             * <p>
272             * 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.SocialActivitySettingModelImpl}. 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.
273             * </p>
274             *
275             * @param start the lower bound of the range of social activity settings
276             * @param end the upper bound of the range of social activity settings (not inclusive)
277             * @return the range of social activity settings
278             */
279            @Override
280            public List<SocialActivitySetting> getSocialActivitySettings(int start,
281                    int end) {
282                    return socialActivitySettingPersistence.findAll(start, end);
283            }
284    
285            /**
286             * Returns the number of social activity settings.
287             *
288             * @return the number of social activity settings
289             */
290            @Override
291            public int getSocialActivitySettingsCount() {
292                    return socialActivitySettingPersistence.countAll();
293            }
294    
295            /**
296             * Updates the social activity setting in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
297             *
298             * @param socialActivitySetting the social activity setting
299             * @return the social activity setting that was updated
300             */
301            @Indexable(type = IndexableType.REINDEX)
302            @Override
303            public SocialActivitySetting updateSocialActivitySetting(
304                    SocialActivitySetting socialActivitySetting) {
305                    return socialActivitySettingPersistence.update(socialActivitySetting);
306            }
307    
308            /**
309             * Returns the social activity setting local service.
310             *
311             * @return the social activity setting local service
312             */
313            public SocialActivitySettingLocalService getSocialActivitySettingLocalService() {
314                    return socialActivitySettingLocalService;
315            }
316    
317            /**
318             * Sets the social activity setting local service.
319             *
320             * @param socialActivitySettingLocalService the social activity setting local service
321             */
322            public void setSocialActivitySettingLocalService(
323                    SocialActivitySettingLocalService socialActivitySettingLocalService) {
324                    this.socialActivitySettingLocalService = socialActivitySettingLocalService;
325            }
326    
327            /**
328             * Returns the social activity setting remote service.
329             *
330             * @return the social activity setting remote service
331             */
332            public com.liferay.portlet.social.service.SocialActivitySettingService getSocialActivitySettingService() {
333                    return socialActivitySettingService;
334            }
335    
336            /**
337             * Sets the social activity setting remote service.
338             *
339             * @param socialActivitySettingService the social activity setting remote service
340             */
341            public void setSocialActivitySettingService(
342                    com.liferay.portlet.social.service.SocialActivitySettingService socialActivitySettingService) {
343                    this.socialActivitySettingService = socialActivitySettingService;
344            }
345    
346            /**
347             * Returns the social activity setting persistence.
348             *
349             * @return the social activity setting persistence
350             */
351            public SocialActivitySettingPersistence getSocialActivitySettingPersistence() {
352                    return socialActivitySettingPersistence;
353            }
354    
355            /**
356             * Sets the social activity setting persistence.
357             *
358             * @param socialActivitySettingPersistence the social activity setting persistence
359             */
360            public void setSocialActivitySettingPersistence(
361                    SocialActivitySettingPersistence socialActivitySettingPersistence) {
362                    this.socialActivitySettingPersistence = socialActivitySettingPersistence;
363            }
364    
365            /**
366             * Returns the counter local service.
367             *
368             * @return the counter local service
369             */
370            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
371                    return counterLocalService;
372            }
373    
374            /**
375             * Sets the counter local service.
376             *
377             * @param counterLocalService the counter local service
378             */
379            public void setCounterLocalService(
380                    com.liferay.counter.service.CounterLocalService counterLocalService) {
381                    this.counterLocalService = counterLocalService;
382            }
383    
384            /**
385             * Returns the class name local service.
386             *
387             * @return the class name local service
388             */
389            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
390                    return classNameLocalService;
391            }
392    
393            /**
394             * Sets the class name local service.
395             *
396             * @param classNameLocalService the class name local service
397             */
398            public void setClassNameLocalService(
399                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
400                    this.classNameLocalService = classNameLocalService;
401            }
402    
403            /**
404             * Returns the class name remote service.
405             *
406             * @return the class name remote service
407             */
408            public com.liferay.portal.service.ClassNameService getClassNameService() {
409                    return classNameService;
410            }
411    
412            /**
413             * Sets the class name remote service.
414             *
415             * @param classNameService the class name remote service
416             */
417            public void setClassNameService(
418                    com.liferay.portal.service.ClassNameService classNameService) {
419                    this.classNameService = classNameService;
420            }
421    
422            /**
423             * Returns the class name persistence.
424             *
425             * @return the class name persistence
426             */
427            public ClassNamePersistence getClassNamePersistence() {
428                    return classNamePersistence;
429            }
430    
431            /**
432             * Sets the class name persistence.
433             *
434             * @param classNamePersistence the class name persistence
435             */
436            public void setClassNamePersistence(
437                    ClassNamePersistence classNamePersistence) {
438                    this.classNamePersistence = classNamePersistence;
439            }
440    
441            /**
442             * Returns the group local service.
443             *
444             * @return the group local service
445             */
446            public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
447                    return groupLocalService;
448            }
449    
450            /**
451             * Sets the group local service.
452             *
453             * @param groupLocalService the group local service
454             */
455            public void setGroupLocalService(
456                    com.liferay.portal.service.GroupLocalService groupLocalService) {
457                    this.groupLocalService = groupLocalService;
458            }
459    
460            /**
461             * Returns the group remote service.
462             *
463             * @return the group remote service
464             */
465            public com.liferay.portal.service.GroupService getGroupService() {
466                    return groupService;
467            }
468    
469            /**
470             * Sets the group remote service.
471             *
472             * @param groupService the group remote service
473             */
474            public void setGroupService(
475                    com.liferay.portal.service.GroupService groupService) {
476                    this.groupService = groupService;
477            }
478    
479            /**
480             * Returns the group persistence.
481             *
482             * @return the group persistence
483             */
484            public GroupPersistence getGroupPersistence() {
485                    return groupPersistence;
486            }
487    
488            /**
489             * Sets the group persistence.
490             *
491             * @param groupPersistence the group persistence
492             */
493            public void setGroupPersistence(GroupPersistence groupPersistence) {
494                    this.groupPersistence = groupPersistence;
495            }
496    
497            /**
498             * Returns the group finder.
499             *
500             * @return the group finder
501             */
502            public GroupFinder getGroupFinder() {
503                    return groupFinder;
504            }
505    
506            /**
507             * Sets the group finder.
508             *
509             * @param groupFinder the group finder
510             */
511            public void setGroupFinder(GroupFinder groupFinder) {
512                    this.groupFinder = groupFinder;
513            }
514    
515            public void afterPropertiesSet() {
516                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.social.model.SocialActivitySetting",
517                            socialActivitySettingLocalService);
518            }
519    
520            public void destroy() {
521                    persistedModelLocalServiceRegistry.unregister(
522                            "com.liferay.portlet.social.model.SocialActivitySetting");
523            }
524    
525            /**
526             * Returns the Spring bean ID for this bean.
527             *
528             * @return the Spring bean ID for this bean
529             */
530            @Override
531            public String getBeanIdentifier() {
532                    return _beanIdentifier;
533            }
534    
535            /**
536             * Sets the Spring bean ID for this bean.
537             *
538             * @param beanIdentifier the Spring bean ID for this bean
539             */
540            @Override
541            public void setBeanIdentifier(String beanIdentifier) {
542                    _beanIdentifier = beanIdentifier;
543            }
544    
545            protected Class<?> getModelClass() {
546                    return SocialActivitySetting.class;
547            }
548    
549            protected String getModelClassName() {
550                    return SocialActivitySetting.class.getName();
551            }
552    
553            /**
554             * Performs a SQL query.
555             *
556             * @param sql the sql query
557             */
558            protected void runSQL(String sql) {
559                    try {
560                            DataSource dataSource = socialActivitySettingPersistence.getDataSource();
561    
562                            DB db = DBFactoryUtil.getDB();
563    
564                            sql = db.buildSQL(sql);
565                            sql = PortalUtil.transformSQL(sql);
566    
567                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
568                                            sql, new int[0]);
569    
570                            sqlUpdate.update();
571                    }
572                    catch (Exception e) {
573                            throw new SystemException(e);
574                    }
575            }
576    
577            @BeanReference(type = SocialActivitySettingLocalService.class)
578            protected SocialActivitySettingLocalService socialActivitySettingLocalService;
579            @BeanReference(type = com.liferay.portlet.social.service.SocialActivitySettingService.class)
580            protected com.liferay.portlet.social.service.SocialActivitySettingService socialActivitySettingService;
581            @BeanReference(type = SocialActivitySettingPersistence.class)
582            protected SocialActivitySettingPersistence socialActivitySettingPersistence;
583            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
584            protected com.liferay.counter.service.CounterLocalService counterLocalService;
585            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
586            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
587            @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
588            protected com.liferay.portal.service.ClassNameService classNameService;
589            @BeanReference(type = ClassNamePersistence.class)
590            protected ClassNamePersistence classNamePersistence;
591            @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
592            protected com.liferay.portal.service.GroupLocalService groupLocalService;
593            @BeanReference(type = com.liferay.portal.service.GroupService.class)
594            protected com.liferay.portal.service.GroupService groupService;
595            @BeanReference(type = GroupPersistence.class)
596            protected GroupPersistence groupPersistence;
597            @BeanReference(type = GroupFinder.class)
598            protected GroupFinder groupFinder;
599            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
600            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
601            private String _beanIdentifier;
602    }