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