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.messageboards.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
029    import com.liferay.portal.kernel.dao.orm.Projection;
030    import com.liferay.portal.kernel.dao.orm.Property;
031    import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
032    import com.liferay.portal.kernel.exception.PortalException;
033    import com.liferay.portal.kernel.exception.SystemException;
034    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
035    import com.liferay.portal.kernel.search.Indexable;
036    import com.liferay.portal.kernel.search.IndexableType;
037    import com.liferay.portal.kernel.util.OrderByComparator;
038    import com.liferay.portal.model.PersistedModel;
039    import com.liferay.portal.service.BaseLocalServiceImpl;
040    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
041    import com.liferay.portal.service.persistence.ClassNamePersistence;
042    import com.liferay.portal.service.persistence.SubscriptionPersistence;
043    import com.liferay.portal.service.persistence.UserFinder;
044    import com.liferay.portal.service.persistence.UserPersistence;
045    import com.liferay.portal.util.PortalUtil;
046    
047    import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
048    import com.liferay.portlet.exportimport.lar.ManifestSummary;
049    import com.liferay.portlet.exportimport.lar.PortletDataContext;
050    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
051    import com.liferay.portlet.exportimport.lar.StagedModelType;
052    import com.liferay.portlet.messageboards.model.MBDiscussion;
053    import com.liferay.portlet.messageboards.service.MBDiscussionLocalService;
054    import com.liferay.portlet.messageboards.service.persistence.MBDiscussionPersistence;
055    import com.liferay.portlet.messageboards.service.persistence.MBMailingListPersistence;
056    import com.liferay.portlet.messageboards.service.persistence.MBMessageFinder;
057    import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
058    import com.liferay.portlet.messageboards.service.persistence.MBThreadFinder;
059    import com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence;
060    
061    import java.io.Serializable;
062    
063    import java.util.List;
064    
065    import javax.sql.DataSource;
066    
067    /**
068     * Provides the base implementation for the message boards discussion local service.
069     *
070     * <p>
071     * 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.messageboards.service.impl.MBDiscussionLocalServiceImpl}.
072     * </p>
073     *
074     * @author Brian Wing Shun Chan
075     * @see com.liferay.portlet.messageboards.service.impl.MBDiscussionLocalServiceImpl
076     * @see com.liferay.portlet.messageboards.service.MBDiscussionLocalServiceUtil
077     * @generated
078     */
079    @ProviderType
080    public abstract class MBDiscussionLocalServiceBaseImpl
081            extends BaseLocalServiceImpl implements MBDiscussionLocalService,
082                    IdentifiableOSGiService {
083            /*
084             * NOTE FOR DEVELOPERS:
085             *
086             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.messageboards.service.MBDiscussionLocalServiceUtil} to access the message boards discussion local service.
087             */
088    
089            /**
090             * Adds the message boards discussion to the database. Also notifies the appropriate model listeners.
091             *
092             * @param mbDiscussion the message boards discussion
093             * @return the message boards discussion that was added
094             */
095            @Indexable(type = IndexableType.REINDEX)
096            @Override
097            public MBDiscussion addMBDiscussion(MBDiscussion mbDiscussion) {
098                    mbDiscussion.setNew(true);
099    
100                    return mbDiscussionPersistence.update(mbDiscussion);
101            }
102    
103            /**
104             * Creates a new message boards discussion with the primary key. Does not add the message boards discussion to the database.
105             *
106             * @param discussionId the primary key for the new message boards discussion
107             * @return the new message boards discussion
108             */
109            @Override
110            public MBDiscussion createMBDiscussion(long discussionId) {
111                    return mbDiscussionPersistence.create(discussionId);
112            }
113    
114            /**
115             * Deletes the message boards discussion with the primary key from the database. Also notifies the appropriate model listeners.
116             *
117             * @param discussionId the primary key of the message boards discussion
118             * @return the message boards discussion that was removed
119             * @throws PortalException if a message boards discussion with the primary key could not be found
120             */
121            @Indexable(type = IndexableType.DELETE)
122            @Override
123            public MBDiscussion deleteMBDiscussion(long discussionId)
124                    throws PortalException {
125                    return mbDiscussionPersistence.remove(discussionId);
126            }
127    
128            /**
129             * Deletes the message boards discussion from the database. Also notifies the appropriate model listeners.
130             *
131             * @param mbDiscussion the message boards discussion
132             * @return the message boards discussion that was removed
133             */
134            @Indexable(type = IndexableType.DELETE)
135            @Override
136            public MBDiscussion deleteMBDiscussion(MBDiscussion mbDiscussion) {
137                    return mbDiscussionPersistence.remove(mbDiscussion);
138            }
139    
140            @Override
141            public DynamicQuery dynamicQuery() {
142                    Class<?> clazz = getClass();
143    
144                    return DynamicQueryFactoryUtil.forClass(MBDiscussion.class,
145                            clazz.getClassLoader());
146            }
147    
148            /**
149             * Performs a dynamic query on the database and returns the matching rows.
150             *
151             * @param dynamicQuery the dynamic query
152             * @return the matching rows
153             */
154            @Override
155            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
156                    return mbDiscussionPersistence.findWithDynamicQuery(dynamicQuery);
157            }
158    
159            /**
160             * Performs a dynamic query on the database and returns a range of the matching rows.
161             *
162             * <p>
163             * 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.messageboards.model.impl.MBDiscussionModelImpl}. 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.
164             * </p>
165             *
166             * @param dynamicQuery the dynamic query
167             * @param start the lower bound of the range of model instances
168             * @param end the upper bound of the range of model instances (not inclusive)
169             * @return the range of matching rows
170             */
171            @Override
172            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
173                    int end) {
174                    return mbDiscussionPersistence.findWithDynamicQuery(dynamicQuery,
175                            start, end);
176            }
177    
178            /**
179             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
180             *
181             * <p>
182             * 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.messageboards.model.impl.MBDiscussionModelImpl}. 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.
183             * </p>
184             *
185             * @param dynamicQuery the dynamic query
186             * @param start the lower bound of the range of model instances
187             * @param end the upper bound of the range of model instances (not inclusive)
188             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
189             * @return the ordered range of matching rows
190             */
191            @Override
192            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
193                    int end, OrderByComparator<T> orderByComparator) {
194                    return mbDiscussionPersistence.findWithDynamicQuery(dynamicQuery,
195                            start, end, orderByComparator);
196            }
197    
198            /**
199             * Returns the number of rows matching the dynamic query.
200             *
201             * @param dynamicQuery the dynamic query
202             * @return the number of rows matching the dynamic query
203             */
204            @Override
205            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
206                    return mbDiscussionPersistence.countWithDynamicQuery(dynamicQuery);
207            }
208    
209            /**
210             * Returns the number of rows matching the dynamic query.
211             *
212             * @param dynamicQuery the dynamic query
213             * @param projection the projection to apply to the query
214             * @return the number of rows matching the dynamic query
215             */
216            @Override
217            public long dynamicQueryCount(DynamicQuery dynamicQuery,
218                    Projection projection) {
219                    return mbDiscussionPersistence.countWithDynamicQuery(dynamicQuery,
220                            projection);
221            }
222    
223            @Override
224            public MBDiscussion fetchMBDiscussion(long discussionId) {
225                    return mbDiscussionPersistence.fetchByPrimaryKey(discussionId);
226            }
227    
228            /**
229             * Returns the message boards discussion matching the UUID and group.
230             *
231             * @param uuid the message boards discussion's UUID
232             * @param groupId the primary key of the group
233             * @return the matching message boards discussion, or <code>null</code> if a matching message boards discussion could not be found
234             */
235            @Override
236            public MBDiscussion fetchMBDiscussionByUuidAndGroupId(String uuid,
237                    long groupId) {
238                    return mbDiscussionPersistence.fetchByUUID_G(uuid, groupId);
239            }
240    
241            /**
242             * Returns the message boards discussion with the primary key.
243             *
244             * @param discussionId the primary key of the message boards discussion
245             * @return the message boards discussion
246             * @throws PortalException if a message boards discussion with the primary key could not be found
247             */
248            @Override
249            public MBDiscussion getMBDiscussion(long discussionId)
250                    throws PortalException {
251                    return mbDiscussionPersistence.findByPrimaryKey(discussionId);
252            }
253    
254            @Override
255            public ActionableDynamicQuery getActionableDynamicQuery() {
256                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
257    
258                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.messageboards.service.MBDiscussionLocalServiceUtil.getService());
259                    actionableDynamicQuery.setClass(MBDiscussion.class);
260                    actionableDynamicQuery.setClassLoader(getClassLoader());
261    
262                    actionableDynamicQuery.setPrimaryKeyPropertyName("discussionId");
263    
264                    return actionableDynamicQuery;
265            }
266    
267            protected void initActionableDynamicQuery(
268                    ActionableDynamicQuery actionableDynamicQuery) {
269                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.messageboards.service.MBDiscussionLocalServiceUtil.getService());
270                    actionableDynamicQuery.setClass(MBDiscussion.class);
271                    actionableDynamicQuery.setClassLoader(getClassLoader());
272    
273                    actionableDynamicQuery.setPrimaryKeyPropertyName("discussionId");
274            }
275    
276            @Override
277            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
278                    final PortletDataContext portletDataContext) {
279                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
280                                    @Override
281                                    public long performCount() throws PortalException {
282                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
283    
284                                            StagedModelType stagedModelType = getStagedModelType();
285    
286                                            long modelAdditionCount = super.performCount();
287    
288                                            manifestSummary.addModelAdditionCount(stagedModelType,
289                                                    modelAdditionCount);
290    
291                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
292                                                            stagedModelType);
293    
294                                            manifestSummary.addModelDeletionCount(stagedModelType,
295                                                    modelDeletionCount);
296    
297                                            return modelAdditionCount;
298                                    }
299                            };
300    
301                    initActionableDynamicQuery(exportActionableDynamicQuery);
302    
303                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
304                                    @Override
305                                    public void addCriteria(DynamicQuery dynamicQuery) {
306                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
307                                                    "modifiedDate");
308    
309                                            StagedModelType stagedModelType = exportActionableDynamicQuery.getStagedModelType();
310    
311                                            long referrerClassNameId = stagedModelType.getReferrerClassNameId();
312    
313                                            Property classNameIdProperty = PropertyFactoryUtil.forName(
314                                                            "classNameId");
315    
316                                            if ((referrerClassNameId != StagedModelType.REFERRER_CLASS_NAME_ID_ALL) &&
317                                                            (referrerClassNameId != StagedModelType.REFERRER_CLASS_NAME_ID_ANY)) {
318                                                    dynamicQuery.add(classNameIdProperty.eq(
319                                                                    stagedModelType.getReferrerClassNameId()));
320                                            }
321                                            else if (referrerClassNameId == StagedModelType.REFERRER_CLASS_NAME_ID_ANY) {
322                                                    dynamicQuery.add(classNameIdProperty.isNotNull());
323                                            }
324                                    }
325                            });
326    
327                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
328    
329                    exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
330    
331                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<MBDiscussion>() {
332                                    @Override
333                                    public void performAction(MBDiscussion mbDiscussion)
334                                            throws PortalException {
335                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
336                                                    mbDiscussion);
337                                    }
338                            });
339                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
340                                    PortalUtil.getClassNameId(MBDiscussion.class.getName()),
341                                    StagedModelType.REFERRER_CLASS_NAME_ID_ALL));
342    
343                    return exportActionableDynamicQuery;
344            }
345    
346            /**
347             * @throws PortalException
348             */
349            @Override
350            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
351                    throws PortalException {
352                    return mbDiscussionLocalService.deleteMBDiscussion((MBDiscussion)persistedModel);
353            }
354    
355            @Override
356            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
357                    throws PortalException {
358                    return mbDiscussionPersistence.findByPrimaryKey(primaryKeyObj);
359            }
360    
361            /**
362             * Returns all the message boards discussions matching the UUID and company.
363             *
364             * @param uuid the UUID of the message boards discussions
365             * @param companyId the primary key of the company
366             * @return the matching message boards discussions, or an empty list if no matches were found
367             */
368            @Override
369            public List<MBDiscussion> getMBDiscussionsByUuidAndCompanyId(String uuid,
370                    long companyId) {
371                    return mbDiscussionPersistence.findByUuid_C(uuid, companyId);
372            }
373    
374            /**
375             * Returns a range of message boards discussions matching the UUID and company.
376             *
377             * @param uuid the UUID of the message boards discussions
378             * @param companyId the primary key of the company
379             * @param start the lower bound of the range of message boards discussions
380             * @param end the upper bound of the range of message boards discussions (not inclusive)
381             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
382             * @return the range of matching message boards discussions, or an empty list if no matches were found
383             */
384            @Override
385            public List<MBDiscussion> getMBDiscussionsByUuidAndCompanyId(String uuid,
386                    long companyId, int start, int end,
387                    OrderByComparator<MBDiscussion> orderByComparator) {
388                    return mbDiscussionPersistence.findByUuid_C(uuid, companyId, start,
389                            end, orderByComparator);
390            }
391    
392            /**
393             * Returns the message boards discussion matching the UUID and group.
394             *
395             * @param uuid the message boards discussion's UUID
396             * @param groupId the primary key of the group
397             * @return the matching message boards discussion
398             * @throws PortalException if a matching message boards discussion could not be found
399             */
400            @Override
401            public MBDiscussion getMBDiscussionByUuidAndGroupId(String uuid,
402                    long groupId) throws PortalException {
403                    return mbDiscussionPersistence.findByUUID_G(uuid, groupId);
404            }
405    
406            /**
407             * Returns a range of all the message boards discussions.
408             *
409             * <p>
410             * 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.messageboards.model.impl.MBDiscussionModelImpl}. 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.
411             * </p>
412             *
413             * @param start the lower bound of the range of message boards discussions
414             * @param end the upper bound of the range of message boards discussions (not inclusive)
415             * @return the range of message boards discussions
416             */
417            @Override
418            public List<MBDiscussion> getMBDiscussions(int start, int end) {
419                    return mbDiscussionPersistence.findAll(start, end);
420            }
421    
422            /**
423             * Returns the number of message boards discussions.
424             *
425             * @return the number of message boards discussions
426             */
427            @Override
428            public int getMBDiscussionsCount() {
429                    return mbDiscussionPersistence.countAll();
430            }
431    
432            /**
433             * Updates the message boards discussion in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
434             *
435             * @param mbDiscussion the message boards discussion
436             * @return the message boards discussion that was updated
437             */
438            @Indexable(type = IndexableType.REINDEX)
439            @Override
440            public MBDiscussion updateMBDiscussion(MBDiscussion mbDiscussion) {
441                    return mbDiscussionPersistence.update(mbDiscussion);
442            }
443    
444            /**
445             * Returns the message boards discussion local service.
446             *
447             * @return the message boards discussion local service
448             */
449            public MBDiscussionLocalService getMBDiscussionLocalService() {
450                    return mbDiscussionLocalService;
451            }
452    
453            /**
454             * Sets the message boards discussion local service.
455             *
456             * @param mbDiscussionLocalService the message boards discussion local service
457             */
458            public void setMBDiscussionLocalService(
459                    MBDiscussionLocalService mbDiscussionLocalService) {
460                    this.mbDiscussionLocalService = mbDiscussionLocalService;
461            }
462    
463            /**
464             * Returns the message boards discussion persistence.
465             *
466             * @return the message boards discussion persistence
467             */
468            public MBDiscussionPersistence getMBDiscussionPersistence() {
469                    return mbDiscussionPersistence;
470            }
471    
472            /**
473             * Sets the message boards discussion persistence.
474             *
475             * @param mbDiscussionPersistence the message boards discussion persistence
476             */
477            public void setMBDiscussionPersistence(
478                    MBDiscussionPersistence mbDiscussionPersistence) {
479                    this.mbDiscussionPersistence = mbDiscussionPersistence;
480            }
481    
482            /**
483             * Returns the counter local service.
484             *
485             * @return the counter local service
486             */
487            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
488                    return counterLocalService;
489            }
490    
491            /**
492             * Sets the counter local service.
493             *
494             * @param counterLocalService the counter local service
495             */
496            public void setCounterLocalService(
497                    com.liferay.counter.service.CounterLocalService counterLocalService) {
498                    this.counterLocalService = counterLocalService;
499            }
500    
501            /**
502             * Returns the class name local service.
503             *
504             * @return the class name local service
505             */
506            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
507                    return classNameLocalService;
508            }
509    
510            /**
511             * Sets the class name local service.
512             *
513             * @param classNameLocalService the class name local service
514             */
515            public void setClassNameLocalService(
516                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
517                    this.classNameLocalService = classNameLocalService;
518            }
519    
520            /**
521             * Returns the class name remote service.
522             *
523             * @return the class name remote service
524             */
525            public com.liferay.portal.service.ClassNameService getClassNameService() {
526                    return classNameService;
527            }
528    
529            /**
530             * Sets the class name remote service.
531             *
532             * @param classNameService the class name remote service
533             */
534            public void setClassNameService(
535                    com.liferay.portal.service.ClassNameService classNameService) {
536                    this.classNameService = classNameService;
537            }
538    
539            /**
540             * Returns the class name persistence.
541             *
542             * @return the class name persistence
543             */
544            public ClassNamePersistence getClassNamePersistence() {
545                    return classNamePersistence;
546            }
547    
548            /**
549             * Sets the class name persistence.
550             *
551             * @param classNamePersistence the class name persistence
552             */
553            public void setClassNamePersistence(
554                    ClassNamePersistence classNamePersistence) {
555                    this.classNamePersistence = classNamePersistence;
556            }
557    
558            /**
559             * Returns the subscription local service.
560             *
561             * @return the subscription local service
562             */
563            public com.liferay.portal.service.SubscriptionLocalService getSubscriptionLocalService() {
564                    return subscriptionLocalService;
565            }
566    
567            /**
568             * Sets the subscription local service.
569             *
570             * @param subscriptionLocalService the subscription local service
571             */
572            public void setSubscriptionLocalService(
573                    com.liferay.portal.service.SubscriptionLocalService subscriptionLocalService) {
574                    this.subscriptionLocalService = subscriptionLocalService;
575            }
576    
577            /**
578             * Returns the subscription persistence.
579             *
580             * @return the subscription persistence
581             */
582            public SubscriptionPersistence getSubscriptionPersistence() {
583                    return subscriptionPersistence;
584            }
585    
586            /**
587             * Sets the subscription persistence.
588             *
589             * @param subscriptionPersistence the subscription persistence
590             */
591            public void setSubscriptionPersistence(
592                    SubscriptionPersistence subscriptionPersistence) {
593                    this.subscriptionPersistence = subscriptionPersistence;
594            }
595    
596            /**
597             * Returns the user local service.
598             *
599             * @return the user local service
600             */
601            public com.liferay.portal.service.UserLocalService getUserLocalService() {
602                    return userLocalService;
603            }
604    
605            /**
606             * Sets the user local service.
607             *
608             * @param userLocalService the user local service
609             */
610            public void setUserLocalService(
611                    com.liferay.portal.service.UserLocalService userLocalService) {
612                    this.userLocalService = userLocalService;
613            }
614    
615            /**
616             * Returns the user remote service.
617             *
618             * @return the user remote service
619             */
620            public com.liferay.portal.service.UserService getUserService() {
621                    return userService;
622            }
623    
624            /**
625             * Sets the user remote service.
626             *
627             * @param userService the user remote service
628             */
629            public void setUserService(
630                    com.liferay.portal.service.UserService userService) {
631                    this.userService = userService;
632            }
633    
634            /**
635             * Returns the user persistence.
636             *
637             * @return the user persistence
638             */
639            public UserPersistence getUserPersistence() {
640                    return userPersistence;
641            }
642    
643            /**
644             * Sets the user persistence.
645             *
646             * @param userPersistence the user persistence
647             */
648            public void setUserPersistence(UserPersistence userPersistence) {
649                    this.userPersistence = userPersistence;
650            }
651    
652            /**
653             * Returns the user finder.
654             *
655             * @return the user finder
656             */
657            public UserFinder getUserFinder() {
658                    return userFinder;
659            }
660    
661            /**
662             * Sets the user finder.
663             *
664             * @param userFinder the user finder
665             */
666            public void setUserFinder(UserFinder userFinder) {
667                    this.userFinder = userFinder;
668            }
669    
670            /**
671             * Returns the message boards mailing list local service.
672             *
673             * @return the message boards mailing list local service
674             */
675            public com.liferay.portlet.messageboards.service.MBMailingListLocalService getMBMailingListLocalService() {
676                    return mbMailingListLocalService;
677            }
678    
679            /**
680             * Sets the message boards mailing list local service.
681             *
682             * @param mbMailingListLocalService the message boards mailing list local service
683             */
684            public void setMBMailingListLocalService(
685                    com.liferay.portlet.messageboards.service.MBMailingListLocalService mbMailingListLocalService) {
686                    this.mbMailingListLocalService = mbMailingListLocalService;
687            }
688    
689            /**
690             * Returns the message boards mailing list persistence.
691             *
692             * @return the message boards mailing list persistence
693             */
694            public MBMailingListPersistence getMBMailingListPersistence() {
695                    return mbMailingListPersistence;
696            }
697    
698            /**
699             * Sets the message boards mailing list persistence.
700             *
701             * @param mbMailingListPersistence the message boards mailing list persistence
702             */
703            public void setMBMailingListPersistence(
704                    MBMailingListPersistence mbMailingListPersistence) {
705                    this.mbMailingListPersistence = mbMailingListPersistence;
706            }
707    
708            /**
709             * Returns the message-boards message local service.
710             *
711             * @return the message-boards message local service
712             */
713            public com.liferay.portlet.messageboards.service.MBMessageLocalService getMBMessageLocalService() {
714                    return mbMessageLocalService;
715            }
716    
717            /**
718             * Sets the message-boards message local service.
719             *
720             * @param mbMessageLocalService the message-boards message local service
721             */
722            public void setMBMessageLocalService(
723                    com.liferay.portlet.messageboards.service.MBMessageLocalService mbMessageLocalService) {
724                    this.mbMessageLocalService = mbMessageLocalService;
725            }
726    
727            /**
728             * Returns the message-boards message remote service.
729             *
730             * @return the message-boards message remote service
731             */
732            public com.liferay.portlet.messageboards.service.MBMessageService getMBMessageService() {
733                    return mbMessageService;
734            }
735    
736            /**
737             * Sets the message-boards message remote service.
738             *
739             * @param mbMessageService the message-boards message remote service
740             */
741            public void setMBMessageService(
742                    com.liferay.portlet.messageboards.service.MBMessageService mbMessageService) {
743                    this.mbMessageService = mbMessageService;
744            }
745    
746            /**
747             * Returns the message-boards message persistence.
748             *
749             * @return the message-boards message persistence
750             */
751            public MBMessagePersistence getMBMessagePersistence() {
752                    return mbMessagePersistence;
753            }
754    
755            /**
756             * Sets the message-boards message persistence.
757             *
758             * @param mbMessagePersistence the message-boards message persistence
759             */
760            public void setMBMessagePersistence(
761                    MBMessagePersistence mbMessagePersistence) {
762                    this.mbMessagePersistence = mbMessagePersistence;
763            }
764    
765            /**
766             * Returns the message-boards message finder.
767             *
768             * @return the message-boards message finder
769             */
770            public MBMessageFinder getMBMessageFinder() {
771                    return mbMessageFinder;
772            }
773    
774            /**
775             * Sets the message-boards message finder.
776             *
777             * @param mbMessageFinder the message-boards message finder
778             */
779            public void setMBMessageFinder(MBMessageFinder mbMessageFinder) {
780                    this.mbMessageFinder = mbMessageFinder;
781            }
782    
783            /**
784             * Returns the message boards thread local service.
785             *
786             * @return the message boards thread local service
787             */
788            public com.liferay.portlet.messageboards.service.MBThreadLocalService getMBThreadLocalService() {
789                    return mbThreadLocalService;
790            }
791    
792            /**
793             * Sets the message boards thread local service.
794             *
795             * @param mbThreadLocalService the message boards thread local service
796             */
797            public void setMBThreadLocalService(
798                    com.liferay.portlet.messageboards.service.MBThreadLocalService mbThreadLocalService) {
799                    this.mbThreadLocalService = mbThreadLocalService;
800            }
801    
802            /**
803             * Returns the message boards thread remote service.
804             *
805             * @return the message boards thread remote service
806             */
807            public com.liferay.portlet.messageboards.service.MBThreadService getMBThreadService() {
808                    return mbThreadService;
809            }
810    
811            /**
812             * Sets the message boards thread remote service.
813             *
814             * @param mbThreadService the message boards thread remote service
815             */
816            public void setMBThreadService(
817                    com.liferay.portlet.messageboards.service.MBThreadService mbThreadService) {
818                    this.mbThreadService = mbThreadService;
819            }
820    
821            /**
822             * Returns the message boards thread persistence.
823             *
824             * @return the message boards thread persistence
825             */
826            public MBThreadPersistence getMBThreadPersistence() {
827                    return mbThreadPersistence;
828            }
829    
830            /**
831             * Sets the message boards thread persistence.
832             *
833             * @param mbThreadPersistence the message boards thread persistence
834             */
835            public void setMBThreadPersistence(MBThreadPersistence mbThreadPersistence) {
836                    this.mbThreadPersistence = mbThreadPersistence;
837            }
838    
839            /**
840             * Returns the message boards thread finder.
841             *
842             * @return the message boards thread finder
843             */
844            public MBThreadFinder getMBThreadFinder() {
845                    return mbThreadFinder;
846            }
847    
848            /**
849             * Sets the message boards thread finder.
850             *
851             * @param mbThreadFinder the message boards thread finder
852             */
853            public void setMBThreadFinder(MBThreadFinder mbThreadFinder) {
854                    this.mbThreadFinder = mbThreadFinder;
855            }
856    
857            public void afterPropertiesSet() {
858                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.messageboards.model.MBDiscussion",
859                            mbDiscussionLocalService);
860            }
861    
862            public void destroy() {
863                    persistedModelLocalServiceRegistry.unregister(
864                            "com.liferay.portlet.messageboards.model.MBDiscussion");
865            }
866    
867            /**
868             * Returns the OSGi service identifier.
869             *
870             * @return the OSGi service identifier
871             */
872            @Override
873            public String getOSGiServiceIdentifier() {
874                    return MBDiscussionLocalService.class.getName();
875            }
876    
877            protected Class<?> getModelClass() {
878                    return MBDiscussion.class;
879            }
880    
881            protected String getModelClassName() {
882                    return MBDiscussion.class.getName();
883            }
884    
885            /**
886             * Performs a SQL query.
887             *
888             * @param sql the sql query
889             */
890            protected void runSQL(String sql) {
891                    try {
892                            DataSource dataSource = mbDiscussionPersistence.getDataSource();
893    
894                            DB db = DBFactoryUtil.getDB();
895    
896                            sql = db.buildSQL(sql);
897                            sql = PortalUtil.transformSQL(sql);
898    
899                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
900                                            sql, new int[0]);
901    
902                            sqlUpdate.update();
903                    }
904                    catch (Exception e) {
905                            throw new SystemException(e);
906                    }
907            }
908    
909            @BeanReference(type = com.liferay.portlet.messageboards.service.MBDiscussionLocalService.class)
910            protected MBDiscussionLocalService mbDiscussionLocalService;
911            @BeanReference(type = MBDiscussionPersistence.class)
912            protected MBDiscussionPersistence mbDiscussionPersistence;
913            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
914            protected com.liferay.counter.service.CounterLocalService counterLocalService;
915            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
916            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
917            @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
918            protected com.liferay.portal.service.ClassNameService classNameService;
919            @BeanReference(type = ClassNamePersistence.class)
920            protected ClassNamePersistence classNamePersistence;
921            @BeanReference(type = com.liferay.portal.service.SubscriptionLocalService.class)
922            protected com.liferay.portal.service.SubscriptionLocalService subscriptionLocalService;
923            @BeanReference(type = SubscriptionPersistence.class)
924            protected SubscriptionPersistence subscriptionPersistence;
925            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
926            protected com.liferay.portal.service.UserLocalService userLocalService;
927            @BeanReference(type = com.liferay.portal.service.UserService.class)
928            protected com.liferay.portal.service.UserService userService;
929            @BeanReference(type = UserPersistence.class)
930            protected UserPersistence userPersistence;
931            @BeanReference(type = UserFinder.class)
932            protected UserFinder userFinder;
933            @BeanReference(type = com.liferay.portlet.messageboards.service.MBMailingListLocalService.class)
934            protected com.liferay.portlet.messageboards.service.MBMailingListLocalService mbMailingListLocalService;
935            @BeanReference(type = MBMailingListPersistence.class)
936            protected MBMailingListPersistence mbMailingListPersistence;
937            @BeanReference(type = com.liferay.portlet.messageboards.service.MBMessageLocalService.class)
938            protected com.liferay.portlet.messageboards.service.MBMessageLocalService mbMessageLocalService;
939            @BeanReference(type = com.liferay.portlet.messageboards.service.MBMessageService.class)
940            protected com.liferay.portlet.messageboards.service.MBMessageService mbMessageService;
941            @BeanReference(type = MBMessagePersistence.class)
942            protected MBMessagePersistence mbMessagePersistence;
943            @BeanReference(type = MBMessageFinder.class)
944            protected MBMessageFinder mbMessageFinder;
945            @BeanReference(type = com.liferay.portlet.messageboards.service.MBThreadLocalService.class)
946            protected com.liferay.portlet.messageboards.service.MBThreadLocalService mbThreadLocalService;
947            @BeanReference(type = com.liferay.portlet.messageboards.service.MBThreadService.class)
948            protected com.liferay.portlet.messageboards.service.MBThreadService mbThreadService;
949            @BeanReference(type = MBThreadPersistence.class)
950            protected MBThreadPersistence mbThreadPersistence;
951            @BeanReference(type = MBThreadFinder.class)
952            protected MBThreadFinder mbThreadFinder;
953            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
954            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
955    }