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