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.util.PortalUtil;
039    
040    import com.liferay.portlet.social.model.SocialActivitySet;
041    import com.liferay.portlet.social.service.SocialActivitySetLocalService;
042    import com.liferay.portlet.social.service.persistence.SocialActivityFinder;
043    import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
044    import com.liferay.portlet.social.service.persistence.SocialActivitySetFinder;
045    import com.liferay.portlet.social.service.persistence.SocialActivitySetPersistence;
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 set 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.SocialActivitySetLocalServiceImpl}.
058     * </p>
059     *
060     * @author Brian Wing Shun Chan
061     * @see com.liferay.portlet.social.service.impl.SocialActivitySetLocalServiceImpl
062     * @see com.liferay.portlet.social.service.SocialActivitySetLocalServiceUtil
063     * @generated
064     */
065    @ProviderType
066    public abstract class SocialActivitySetLocalServiceBaseImpl
067            extends BaseLocalServiceImpl implements SocialActivitySetLocalService,
068                    IdentifiableBean {
069            /*
070             * NOTE FOR DEVELOPERS:
071             *
072             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.social.service.SocialActivitySetLocalServiceUtil} to access the social activity set local service.
073             */
074    
075            /**
076             * Adds the social activity set to the database. Also notifies the appropriate model listeners.
077             *
078             * @param socialActivitySet the social activity set
079             * @return the social activity set that was added
080             */
081            @Indexable(type = IndexableType.REINDEX)
082            @Override
083            public SocialActivitySet addSocialActivitySet(
084                    SocialActivitySet socialActivitySet) {
085                    socialActivitySet.setNew(true);
086    
087                    return socialActivitySetPersistence.update(socialActivitySet);
088            }
089    
090            /**
091             * Creates a new social activity set with the primary key. Does not add the social activity set to the database.
092             *
093             * @param activitySetId the primary key for the new social activity set
094             * @return the new social activity set
095             */
096            @Override
097            public SocialActivitySet createSocialActivitySet(long activitySetId) {
098                    return socialActivitySetPersistence.create(activitySetId);
099            }
100    
101            /**
102             * Deletes the social activity set with the primary key from the database. Also notifies the appropriate model listeners.
103             *
104             * @param activitySetId the primary key of the social activity set
105             * @return the social activity set that was removed
106             * @throws PortalException if a social activity set with the primary key could not be found
107             */
108            @Indexable(type = IndexableType.DELETE)
109            @Override
110            public SocialActivitySet deleteSocialActivitySet(long activitySetId)
111                    throws PortalException {
112                    return socialActivitySetPersistence.remove(activitySetId);
113            }
114    
115            /**
116             * Deletes the social activity set from the database. Also notifies the appropriate model listeners.
117             *
118             * @param socialActivitySet the social activity set
119             * @return the social activity set that was removed
120             */
121            @Indexable(type = IndexableType.DELETE)
122            @Override
123            public SocialActivitySet deleteSocialActivitySet(
124                    SocialActivitySet socialActivitySet) {
125                    return socialActivitySetPersistence.remove(socialActivitySet);
126            }
127    
128            @Override
129            public DynamicQuery dynamicQuery() {
130                    Class<?> clazz = getClass();
131    
132                    return DynamicQueryFactoryUtil.forClass(SocialActivitySet.class,
133                            clazz.getClassLoader());
134            }
135    
136            /**
137             * Performs a dynamic query on the database and returns the matching rows.
138             *
139             * @param dynamicQuery the dynamic query
140             * @return the matching rows
141             */
142            @Override
143            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
144                    return socialActivitySetPersistence.findWithDynamicQuery(dynamicQuery);
145            }
146    
147            /**
148             * Performs a dynamic query on the database and returns a range of the matching rows.
149             *
150             * <p>
151             * 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.SocialActivitySetModelImpl}. 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.
152             * </p>
153             *
154             * @param dynamicQuery the dynamic query
155             * @param start the lower bound of the range of model instances
156             * @param end the upper bound of the range of model instances (not inclusive)
157             * @return the range of matching rows
158             */
159            @Override
160            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
161                    int end) {
162                    return socialActivitySetPersistence.findWithDynamicQuery(dynamicQuery,
163                            start, end);
164            }
165    
166            /**
167             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
168             *
169             * <p>
170             * 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.SocialActivitySetModelImpl}. 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.
171             * </p>
172             *
173             * @param dynamicQuery the dynamic query
174             * @param start the lower bound of the range of model instances
175             * @param end the upper bound of the range of model instances (not inclusive)
176             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
177             * @return the ordered range of matching rows
178             */
179            @Override
180            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
181                    int end, OrderByComparator<T> orderByComparator) {
182                    return socialActivitySetPersistence.findWithDynamicQuery(dynamicQuery,
183                            start, end, orderByComparator);
184            }
185    
186            /**
187             * Returns the number of rows matching the dynamic query.
188             *
189             * @param dynamicQuery the dynamic query
190             * @return the number of rows matching the dynamic query
191             */
192            @Override
193            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
194                    return socialActivitySetPersistence.countWithDynamicQuery(dynamicQuery);
195            }
196    
197            /**
198             * Returns the number of rows matching the dynamic query.
199             *
200             * @param dynamicQuery the dynamic query
201             * @param projection the projection to apply to the query
202             * @return the number of rows matching the dynamic query
203             */
204            @Override
205            public long dynamicQueryCount(DynamicQuery dynamicQuery,
206                    Projection projection) {
207                    return socialActivitySetPersistence.countWithDynamicQuery(dynamicQuery,
208                            projection);
209            }
210    
211            @Override
212            public SocialActivitySet fetchSocialActivitySet(long activitySetId) {
213                    return socialActivitySetPersistence.fetchByPrimaryKey(activitySetId);
214            }
215    
216            /**
217             * Returns the social activity set with the primary key.
218             *
219             * @param activitySetId the primary key of the social activity set
220             * @return the social activity set
221             * @throws PortalException if a social activity set with the primary key could not be found
222             */
223            @Override
224            public SocialActivitySet getSocialActivitySet(long activitySetId)
225                    throws PortalException {
226                    return socialActivitySetPersistence.findByPrimaryKey(activitySetId);
227            }
228    
229            @Override
230            public ActionableDynamicQuery getActionableDynamicQuery() {
231                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
232    
233                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialActivitySetLocalServiceUtil.getService());
234                    actionableDynamicQuery.setClass(SocialActivitySet.class);
235                    actionableDynamicQuery.setClassLoader(getClassLoader());
236    
237                    actionableDynamicQuery.setPrimaryKeyPropertyName("activitySetId");
238    
239                    return actionableDynamicQuery;
240            }
241    
242            protected void initActionableDynamicQuery(
243                    ActionableDynamicQuery actionableDynamicQuery) {
244                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialActivitySetLocalServiceUtil.getService());
245                    actionableDynamicQuery.setClass(SocialActivitySet.class);
246                    actionableDynamicQuery.setClassLoader(getClassLoader());
247    
248                    actionableDynamicQuery.setPrimaryKeyPropertyName("activitySetId");
249            }
250    
251            /**
252             * @throws PortalException
253             */
254            @Override
255            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
256                    throws PortalException {
257                    return socialActivitySetLocalService.deleteSocialActivitySet((SocialActivitySet)persistedModel);
258            }
259    
260            @Override
261            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
262                    throws PortalException {
263                    return socialActivitySetPersistence.findByPrimaryKey(primaryKeyObj);
264            }
265    
266            /**
267             * Returns a range of all the social activity sets.
268             *
269             * <p>
270             * 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.SocialActivitySetModelImpl}. 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.
271             * </p>
272             *
273             * @param start the lower bound of the range of social activity sets
274             * @param end the upper bound of the range of social activity sets (not inclusive)
275             * @return the range of social activity sets
276             */
277            @Override
278            public List<SocialActivitySet> getSocialActivitySets(int start, int end) {
279                    return socialActivitySetPersistence.findAll(start, end);
280            }
281    
282            /**
283             * Returns the number of social activity sets.
284             *
285             * @return the number of social activity sets
286             */
287            @Override
288            public int getSocialActivitySetsCount() {
289                    return socialActivitySetPersistence.countAll();
290            }
291    
292            /**
293             * Updates the social activity set in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
294             *
295             * @param socialActivitySet the social activity set
296             * @return the social activity set that was updated
297             */
298            @Indexable(type = IndexableType.REINDEX)
299            @Override
300            public SocialActivitySet updateSocialActivitySet(
301                    SocialActivitySet socialActivitySet) {
302                    return socialActivitySetPersistence.update(socialActivitySet);
303            }
304    
305            /**
306             * Returns the social activity set local service.
307             *
308             * @return the social activity set local service
309             */
310            public com.liferay.portlet.social.service.SocialActivitySetLocalService getSocialActivitySetLocalService() {
311                    return socialActivitySetLocalService;
312            }
313    
314            /**
315             * Sets the social activity set local service.
316             *
317             * @param socialActivitySetLocalService the social activity set local service
318             */
319            public void setSocialActivitySetLocalService(
320                    com.liferay.portlet.social.service.SocialActivitySetLocalService socialActivitySetLocalService) {
321                    this.socialActivitySetLocalService = socialActivitySetLocalService;
322            }
323    
324            /**
325             * Returns the social activity set persistence.
326             *
327             * @return the social activity set persistence
328             */
329            public SocialActivitySetPersistence getSocialActivitySetPersistence() {
330                    return socialActivitySetPersistence;
331            }
332    
333            /**
334             * Sets the social activity set persistence.
335             *
336             * @param socialActivitySetPersistence the social activity set persistence
337             */
338            public void setSocialActivitySetPersistence(
339                    SocialActivitySetPersistence socialActivitySetPersistence) {
340                    this.socialActivitySetPersistence = socialActivitySetPersistence;
341            }
342    
343            /**
344             * Returns the social activity set finder.
345             *
346             * @return the social activity set finder
347             */
348            public SocialActivitySetFinder getSocialActivitySetFinder() {
349                    return socialActivitySetFinder;
350            }
351    
352            /**
353             * Sets the social activity set finder.
354             *
355             * @param socialActivitySetFinder the social activity set finder
356             */
357            public void setSocialActivitySetFinder(
358                    SocialActivitySetFinder socialActivitySetFinder) {
359                    this.socialActivitySetFinder = socialActivitySetFinder;
360            }
361    
362            /**
363             * Returns the counter local service.
364             *
365             * @return the counter local service
366             */
367            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
368                    return counterLocalService;
369            }
370    
371            /**
372             * Sets the counter local service.
373             *
374             * @param counterLocalService the counter local service
375             */
376            public void setCounterLocalService(
377                    com.liferay.counter.service.CounterLocalService counterLocalService) {
378                    this.counterLocalService = counterLocalService;
379            }
380    
381            /**
382             * Returns the social activity local service.
383             *
384             * @return the social activity local service
385             */
386            public com.liferay.portlet.social.service.SocialActivityLocalService getSocialActivityLocalService() {
387                    return socialActivityLocalService;
388            }
389    
390            /**
391             * Sets the social activity local service.
392             *
393             * @param socialActivityLocalService the social activity local service
394             */
395            public void setSocialActivityLocalService(
396                    com.liferay.portlet.social.service.SocialActivityLocalService socialActivityLocalService) {
397                    this.socialActivityLocalService = socialActivityLocalService;
398            }
399    
400            /**
401             * Returns the social activity remote service.
402             *
403             * @return the social activity remote service
404             */
405            public com.liferay.portlet.social.service.SocialActivityService getSocialActivityService() {
406                    return socialActivityService;
407            }
408    
409            /**
410             * Sets the social activity remote service.
411             *
412             * @param socialActivityService the social activity remote service
413             */
414            public void setSocialActivityService(
415                    com.liferay.portlet.social.service.SocialActivityService socialActivityService) {
416                    this.socialActivityService = socialActivityService;
417            }
418    
419            /**
420             * Returns the social activity persistence.
421             *
422             * @return the social activity persistence
423             */
424            public SocialActivityPersistence getSocialActivityPersistence() {
425                    return socialActivityPersistence;
426            }
427    
428            /**
429             * Sets the social activity persistence.
430             *
431             * @param socialActivityPersistence the social activity persistence
432             */
433            public void setSocialActivityPersistence(
434                    SocialActivityPersistence socialActivityPersistence) {
435                    this.socialActivityPersistence = socialActivityPersistence;
436            }
437    
438            /**
439             * Returns the social activity finder.
440             *
441             * @return the social activity finder
442             */
443            public SocialActivityFinder getSocialActivityFinder() {
444                    return socialActivityFinder;
445            }
446    
447            /**
448             * Sets the social activity finder.
449             *
450             * @param socialActivityFinder the social activity finder
451             */
452            public void setSocialActivityFinder(
453                    SocialActivityFinder socialActivityFinder) {
454                    this.socialActivityFinder = socialActivityFinder;
455            }
456    
457            public void afterPropertiesSet() {
458                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.social.model.SocialActivitySet",
459                            socialActivitySetLocalService);
460            }
461    
462            public void destroy() {
463                    persistedModelLocalServiceRegistry.unregister(
464                            "com.liferay.portlet.social.model.SocialActivitySet");
465            }
466    
467            /**
468             * Returns the Spring bean ID for this bean.
469             *
470             * @return the Spring bean ID for this bean
471             */
472            @Override
473            public String getBeanIdentifier() {
474                    return _beanIdentifier;
475            }
476    
477            /**
478             * Sets the Spring bean ID for this bean.
479             *
480             * @param beanIdentifier the Spring bean ID for this bean
481             */
482            @Override
483            public void setBeanIdentifier(String beanIdentifier) {
484                    _beanIdentifier = beanIdentifier;
485            }
486    
487            protected Class<?> getModelClass() {
488                    return SocialActivitySet.class;
489            }
490    
491            protected String getModelClassName() {
492                    return SocialActivitySet.class.getName();
493            }
494    
495            /**
496             * Performs a SQL query.
497             *
498             * @param sql the sql query
499             */
500            protected void runSQL(String sql) {
501                    try {
502                            DataSource dataSource = socialActivitySetPersistence.getDataSource();
503    
504                            DB db = DBFactoryUtil.getDB();
505    
506                            sql = db.buildSQL(sql);
507                            sql = PortalUtil.transformSQL(sql);
508    
509                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
510                                            sql, new int[0]);
511    
512                            sqlUpdate.update();
513                    }
514                    catch (Exception e) {
515                            throw new SystemException(e);
516                    }
517            }
518    
519            @BeanReference(type = com.liferay.portlet.social.service.SocialActivitySetLocalService.class)
520            protected com.liferay.portlet.social.service.SocialActivitySetLocalService socialActivitySetLocalService;
521            @BeanReference(type = SocialActivitySetPersistence.class)
522            protected SocialActivitySetPersistence socialActivitySetPersistence;
523            @BeanReference(type = SocialActivitySetFinder.class)
524            protected SocialActivitySetFinder socialActivitySetFinder;
525            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
526            protected com.liferay.counter.service.CounterLocalService counterLocalService;
527            @BeanReference(type = com.liferay.portlet.social.service.SocialActivityLocalService.class)
528            protected com.liferay.portlet.social.service.SocialActivityLocalService socialActivityLocalService;
529            @BeanReference(type = com.liferay.portlet.social.service.SocialActivityService.class)
530            protected com.liferay.portlet.social.service.SocialActivityService socialActivityService;
531            @BeanReference(type = SocialActivityPersistence.class)
532            protected SocialActivityPersistence socialActivityPersistence;
533            @BeanReference(type = SocialActivityFinder.class)
534            protected SocialActivityFinder socialActivityFinder;
535            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
536            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
537            private String _beanIdentifier;
538    }