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