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