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 matching the dynamic query.
200             *
201             * @param dynamicQuery the dynamic query
202             * @return the number of rows matching the dynamic query
203             */
204            @Override
205            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
206                    return mbDiscussionPersistence.countWithDynamicQuery(dynamicQuery);
207            }
208    
209            /**
210             * Returns the number of rows matching the dynamic query.
211             *
212             * @param dynamicQuery the dynamic query
213             * @param projection the projection to apply to the query
214             * @return the number of rows matching the dynamic query
215             */
216            @Override
217            public long dynamicQueryCount(DynamicQuery dynamicQuery,
218                    Projection projection) {
219                    return mbDiscussionPersistence.countWithDynamicQuery(dynamicQuery,
220                            projection);
221            }
222    
223            @Override
224            public MBDiscussion fetchMBDiscussion(long discussionId) {
225                    return mbDiscussionPersistence.fetchByPrimaryKey(discussionId);
226            }
227    
228            /**
229             * Returns the message boards discussion matching the UUID and group.
230             *
231             * @param uuid the message boards discussion's UUID
232             * @param groupId the primary key of the group
233             * @return the matching message boards discussion, or <code>null</code> if a matching message boards discussion could not be found
234             */
235            @Override
236            public MBDiscussion fetchMBDiscussionByUuidAndGroupId(String uuid,
237                    long groupId) {
238                    return mbDiscussionPersistence.fetchByUUID_G(uuid, groupId);
239            }
240    
241            /**
242             * Returns the message boards discussion with the primary key.
243             *
244             * @param discussionId the primary key of the message boards discussion
245             * @return the message boards discussion
246             * @throws PortalException if a message boards discussion with the primary key could not be found
247             */
248            @Override
249            public MBDiscussion getMBDiscussion(long discussionId)
250                    throws PortalException {
251                    return mbDiscussionPersistence.findByPrimaryKey(discussionId);
252            }
253    
254            @Override
255            public ActionableDynamicQuery getActionableDynamicQuery() {
256                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
257    
258                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.messageboards.service.MBDiscussionLocalServiceUtil.getService());
259                    actionableDynamicQuery.setClass(MBDiscussion.class);
260                    actionableDynamicQuery.setClassLoader(getClassLoader());
261    
262                    actionableDynamicQuery.setPrimaryKeyPropertyName("discussionId");
263    
264                    return actionableDynamicQuery;
265            }
266    
267            protected void initActionableDynamicQuery(
268                    ActionableDynamicQuery actionableDynamicQuery) {
269                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.messageboards.service.MBDiscussionLocalServiceUtil.getService());
270                    actionableDynamicQuery.setClass(MBDiscussion.class);
271                    actionableDynamicQuery.setClassLoader(getClassLoader());
272    
273                    actionableDynamicQuery.setPrimaryKeyPropertyName("discussionId");
274            }
275    
276            @Override
277            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
278                    final PortletDataContext portletDataContext) {
279                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
280                                    @Override
281                                    public long performCount() throws PortalException {
282                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
283    
284                                            StagedModelType stagedModelType = getStagedModelType();
285    
286                                            long modelAdditionCount = super.performCount();
287    
288                                            manifestSummary.addModelAdditionCount(stagedModelType.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            /**
357             * Returns all the message boards discussions matching the UUID and company.
358             *
359             * @param uuid the UUID of the message boards discussions
360             * @param companyId the primary key of the company
361             * @return the matching message boards discussions, or an empty list if no matches were found
362             */
363            @Override
364            public List<MBDiscussion> getMBDiscussionsByUuidAndCompanyId(String uuid,
365                    long companyId) {
366                    return mbDiscussionPersistence.findByUuid_C(uuid, companyId);
367            }
368    
369            /**
370             * Returns a range of message boards discussions matching the UUID and company.
371             *
372             * @param uuid the UUID of the message boards discussions
373             * @param companyId the primary key of the company
374             * @param start the lower bound of the range of message boards discussions
375             * @param end the upper bound of the range of message boards discussions (not inclusive)
376             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
377             * @return the range of matching message boards discussions, or an empty list if no matches were found
378             */
379            @Override
380            public List<MBDiscussion> getMBDiscussionsByUuidAndCompanyId(String uuid,
381                    long companyId, int start, int end,
382                    OrderByComparator<MBDiscussion> orderByComparator) {
383                    return mbDiscussionPersistence.findByUuid_C(uuid, companyId, start,
384                            end, orderByComparator);
385            }
386    
387            /**
388             * Returns the message boards discussion matching the UUID and group.
389             *
390             * @param uuid the message boards discussion's UUID
391             * @param groupId the primary key of the group
392             * @return the matching message boards discussion
393             * @throws PortalException if a matching message boards discussion could not be found
394             */
395            @Override
396            public MBDiscussion getMBDiscussionByUuidAndGroupId(String uuid,
397                    long groupId) throws PortalException {
398                    return mbDiscussionPersistence.findByUUID_G(uuid, groupId);
399            }
400    
401            /**
402             * Returns a range of all the message boards discussions.
403             *
404             * <p>
405             * 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.
406             * </p>
407             *
408             * @param start the lower bound of the range of message boards discussions
409             * @param end the upper bound of the range of message boards discussions (not inclusive)
410             * @return the range of message boards discussions
411             */
412            @Override
413            public List<MBDiscussion> getMBDiscussions(int start, int end) {
414                    return mbDiscussionPersistence.findAll(start, end);
415            }
416    
417            /**
418             * Returns the number of message boards discussions.
419             *
420             * @return the number of message boards discussions
421             */
422            @Override
423            public int getMBDiscussionsCount() {
424                    return mbDiscussionPersistence.countAll();
425            }
426    
427            /**
428             * Updates the message boards discussion in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
429             *
430             * @param mbDiscussion the message boards discussion
431             * @return the message boards discussion that was updated
432             */
433            @Indexable(type = IndexableType.REINDEX)
434            @Override
435            public MBDiscussion updateMBDiscussion(MBDiscussion mbDiscussion) {
436                    return mbDiscussionPersistence.update(mbDiscussion);
437            }
438    
439            /**
440             * Returns the message boards discussion local service.
441             *
442             * @return the message boards discussion local service
443             */
444            public com.liferay.portlet.messageboards.service.MBDiscussionLocalService getMBDiscussionLocalService() {
445                    return mbDiscussionLocalService;
446            }
447    
448            /**
449             * Sets the message boards discussion local service.
450             *
451             * @param mbDiscussionLocalService the message boards discussion local service
452             */
453            public void setMBDiscussionLocalService(
454                    com.liferay.portlet.messageboards.service.MBDiscussionLocalService mbDiscussionLocalService) {
455                    this.mbDiscussionLocalService = mbDiscussionLocalService;
456            }
457    
458            /**
459             * Returns the message boards discussion persistence.
460             *
461             * @return the message boards discussion persistence
462             */
463            public MBDiscussionPersistence getMBDiscussionPersistence() {
464                    return mbDiscussionPersistence;
465            }
466    
467            /**
468             * Sets the message boards discussion persistence.
469             *
470             * @param mbDiscussionPersistence the message boards discussion persistence
471             */
472            public void setMBDiscussionPersistence(
473                    MBDiscussionPersistence mbDiscussionPersistence) {
474                    this.mbDiscussionPersistence = mbDiscussionPersistence;
475            }
476    
477            /**
478             * Returns the counter local service.
479             *
480             * @return the counter local service
481             */
482            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
483                    return counterLocalService;
484            }
485    
486            /**
487             * Sets the counter local service.
488             *
489             * @param counterLocalService the counter local service
490             */
491            public void setCounterLocalService(
492                    com.liferay.counter.service.CounterLocalService counterLocalService) {
493                    this.counterLocalService = counterLocalService;
494            }
495    
496            /**
497             * Returns the class name local service.
498             *
499             * @return the class name local service
500             */
501            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
502                    return classNameLocalService;
503            }
504    
505            /**
506             * Sets the class name local service.
507             *
508             * @param classNameLocalService the class name local service
509             */
510            public void setClassNameLocalService(
511                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
512                    this.classNameLocalService = classNameLocalService;
513            }
514    
515            /**
516             * Returns the class name remote service.
517             *
518             * @return the class name remote service
519             */
520            public com.liferay.portal.service.ClassNameService getClassNameService() {
521                    return classNameService;
522            }
523    
524            /**
525             * Sets the class name remote service.
526             *
527             * @param classNameService the class name remote service
528             */
529            public void setClassNameService(
530                    com.liferay.portal.service.ClassNameService classNameService) {
531                    this.classNameService = classNameService;
532            }
533    
534            /**
535             * Returns the class name persistence.
536             *
537             * @return the class name persistence
538             */
539            public ClassNamePersistence getClassNamePersistence() {
540                    return classNamePersistence;
541            }
542    
543            /**
544             * Sets the class name persistence.
545             *
546             * @param classNamePersistence the class name persistence
547             */
548            public void setClassNamePersistence(
549                    ClassNamePersistence classNamePersistence) {
550                    this.classNamePersistence = classNamePersistence;
551            }
552    
553            /**
554             * Returns the subscription local service.
555             *
556             * @return the subscription local service
557             */
558            public com.liferay.portal.service.SubscriptionLocalService getSubscriptionLocalService() {
559                    return subscriptionLocalService;
560            }
561    
562            /**
563             * Sets the subscription local service.
564             *
565             * @param subscriptionLocalService the subscription local service
566             */
567            public void setSubscriptionLocalService(
568                    com.liferay.portal.service.SubscriptionLocalService subscriptionLocalService) {
569                    this.subscriptionLocalService = subscriptionLocalService;
570            }
571    
572            /**
573             * Returns the subscription persistence.
574             *
575             * @return the subscription persistence
576             */
577            public SubscriptionPersistence getSubscriptionPersistence() {
578                    return subscriptionPersistence;
579            }
580    
581            /**
582             * Sets the subscription persistence.
583             *
584             * @param subscriptionPersistence the subscription persistence
585             */
586            public void setSubscriptionPersistence(
587                    SubscriptionPersistence subscriptionPersistence) {
588                    this.subscriptionPersistence = subscriptionPersistence;
589            }
590    
591            /**
592             * Returns the user local service.
593             *
594             * @return the user local service
595             */
596            public com.liferay.portal.service.UserLocalService getUserLocalService() {
597                    return userLocalService;
598            }
599    
600            /**
601             * Sets the user local service.
602             *
603             * @param userLocalService the user local service
604             */
605            public void setUserLocalService(
606                    com.liferay.portal.service.UserLocalService userLocalService) {
607                    this.userLocalService = userLocalService;
608            }
609    
610            /**
611             * Returns the user remote service.
612             *
613             * @return the user remote service
614             */
615            public com.liferay.portal.service.UserService getUserService() {
616                    return userService;
617            }
618    
619            /**
620             * Sets the user remote service.
621             *
622             * @param userService the user remote service
623             */
624            public void setUserService(
625                    com.liferay.portal.service.UserService userService) {
626                    this.userService = userService;
627            }
628    
629            /**
630             * Returns the user persistence.
631             *
632             * @return the user persistence
633             */
634            public UserPersistence getUserPersistence() {
635                    return userPersistence;
636            }
637    
638            /**
639             * Sets the user persistence.
640             *
641             * @param userPersistence the user persistence
642             */
643            public void setUserPersistence(UserPersistence userPersistence) {
644                    this.userPersistence = userPersistence;
645            }
646    
647            /**
648             * Returns the user finder.
649             *
650             * @return the user finder
651             */
652            public UserFinder getUserFinder() {
653                    return userFinder;
654            }
655    
656            /**
657             * Sets the user finder.
658             *
659             * @param userFinder the user finder
660             */
661            public void setUserFinder(UserFinder userFinder) {
662                    this.userFinder = userFinder;
663            }
664    
665            /**
666             * Returns the message boards mailing list local service.
667             *
668             * @return the message boards mailing list local service
669             */
670            public com.liferay.portlet.messageboards.service.MBMailingListLocalService getMBMailingListLocalService() {
671                    return mbMailingListLocalService;
672            }
673    
674            /**
675             * Sets the message boards mailing list local service.
676             *
677             * @param mbMailingListLocalService the message boards mailing list local service
678             */
679            public void setMBMailingListLocalService(
680                    com.liferay.portlet.messageboards.service.MBMailingListLocalService mbMailingListLocalService) {
681                    this.mbMailingListLocalService = mbMailingListLocalService;
682            }
683    
684            /**
685             * Returns the message boards mailing list persistence.
686             *
687             * @return the message boards mailing list persistence
688             */
689            public MBMailingListPersistence getMBMailingListPersistence() {
690                    return mbMailingListPersistence;
691            }
692    
693            /**
694             * Sets the message boards mailing list persistence.
695             *
696             * @param mbMailingListPersistence the message boards mailing list persistence
697             */
698            public void setMBMailingListPersistence(
699                    MBMailingListPersistence mbMailingListPersistence) {
700                    this.mbMailingListPersistence = mbMailingListPersistence;
701            }
702    
703            /**
704             * Returns the message-boards message local service.
705             *
706             * @return the message-boards message local service
707             */
708            public com.liferay.portlet.messageboards.service.MBMessageLocalService getMBMessageLocalService() {
709                    return mbMessageLocalService;
710            }
711    
712            /**
713             * Sets the message-boards message local service.
714             *
715             * @param mbMessageLocalService the message-boards message local service
716             */
717            public void setMBMessageLocalService(
718                    com.liferay.portlet.messageboards.service.MBMessageLocalService mbMessageLocalService) {
719                    this.mbMessageLocalService = mbMessageLocalService;
720            }
721    
722            /**
723             * Returns the message-boards message remote service.
724             *
725             * @return the message-boards message remote service
726             */
727            public com.liferay.portlet.messageboards.service.MBMessageService getMBMessageService() {
728                    return mbMessageService;
729            }
730    
731            /**
732             * Sets the message-boards message remote service.
733             *
734             * @param mbMessageService the message-boards message remote service
735             */
736            public void setMBMessageService(
737                    com.liferay.portlet.messageboards.service.MBMessageService mbMessageService) {
738                    this.mbMessageService = mbMessageService;
739            }
740    
741            /**
742             * Returns the message-boards message persistence.
743             *
744             * @return the message-boards message persistence
745             */
746            public MBMessagePersistence getMBMessagePersistence() {
747                    return mbMessagePersistence;
748            }
749    
750            /**
751             * Sets the message-boards message persistence.
752             *
753             * @param mbMessagePersistence the message-boards message persistence
754             */
755            public void setMBMessagePersistence(
756                    MBMessagePersistence mbMessagePersistence) {
757                    this.mbMessagePersistence = mbMessagePersistence;
758            }
759    
760            /**
761             * Returns the message-boards message finder.
762             *
763             * @return the message-boards message finder
764             */
765            public MBMessageFinder getMBMessageFinder() {
766                    return mbMessageFinder;
767            }
768    
769            /**
770             * Sets the message-boards message finder.
771             *
772             * @param mbMessageFinder the message-boards message finder
773             */
774            public void setMBMessageFinder(MBMessageFinder mbMessageFinder) {
775                    this.mbMessageFinder = mbMessageFinder;
776            }
777    
778            /**
779             * Returns the message boards thread local service.
780             *
781             * @return the message boards thread local service
782             */
783            public com.liferay.portlet.messageboards.service.MBThreadLocalService getMBThreadLocalService() {
784                    return mbThreadLocalService;
785            }
786    
787            /**
788             * Sets the message boards thread local service.
789             *
790             * @param mbThreadLocalService the message boards thread local service
791             */
792            public void setMBThreadLocalService(
793                    com.liferay.portlet.messageboards.service.MBThreadLocalService mbThreadLocalService) {
794                    this.mbThreadLocalService = mbThreadLocalService;
795            }
796    
797            /**
798             * Returns the message boards thread remote service.
799             *
800             * @return the message boards thread remote service
801             */
802            public com.liferay.portlet.messageboards.service.MBThreadService getMBThreadService() {
803                    return mbThreadService;
804            }
805    
806            /**
807             * Sets the message boards thread remote service.
808             *
809             * @param mbThreadService the message boards thread remote service
810             */
811            public void setMBThreadService(
812                    com.liferay.portlet.messageboards.service.MBThreadService mbThreadService) {
813                    this.mbThreadService = mbThreadService;
814            }
815    
816            /**
817             * Returns the message boards thread persistence.
818             *
819             * @return the message boards thread persistence
820             */
821            public MBThreadPersistence getMBThreadPersistence() {
822                    return mbThreadPersistence;
823            }
824    
825            /**
826             * Sets the message boards thread persistence.
827             *
828             * @param mbThreadPersistence the message boards thread persistence
829             */
830            public void setMBThreadPersistence(MBThreadPersistence mbThreadPersistence) {
831                    this.mbThreadPersistence = mbThreadPersistence;
832            }
833    
834            /**
835             * Returns the message boards thread finder.
836             *
837             * @return the message boards thread finder
838             */
839            public MBThreadFinder getMBThreadFinder() {
840                    return mbThreadFinder;
841            }
842    
843            /**
844             * Sets the message boards thread finder.
845             *
846             * @param mbThreadFinder the message boards thread finder
847             */
848            public void setMBThreadFinder(MBThreadFinder mbThreadFinder) {
849                    this.mbThreadFinder = mbThreadFinder;
850            }
851    
852            public void afterPropertiesSet() {
853                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.messageboards.model.MBDiscussion",
854                            mbDiscussionLocalService);
855            }
856    
857            public void destroy() {
858                    persistedModelLocalServiceRegistry.unregister(
859                            "com.liferay.portlet.messageboards.model.MBDiscussion");
860            }
861    
862            /**
863             * Returns the Spring bean ID for this bean.
864             *
865             * @return the Spring bean ID for this bean
866             */
867            @Override
868            public String getBeanIdentifier() {
869                    return _beanIdentifier;
870            }
871    
872            /**
873             * Sets the Spring bean ID for this bean.
874             *
875             * @param beanIdentifier the Spring bean ID for this bean
876             */
877            @Override
878            public void setBeanIdentifier(String beanIdentifier) {
879                    _beanIdentifier = beanIdentifier;
880            }
881    
882            protected Class<?> getModelClass() {
883                    return MBDiscussion.class;
884            }
885    
886            protected String getModelClassName() {
887                    return MBDiscussion.class.getName();
888            }
889    
890            /**
891             * Performs a SQL query.
892             *
893             * @param sql the sql query
894             */
895            protected void runSQL(String sql) {
896                    try {
897                            DataSource dataSource = mbDiscussionPersistence.getDataSource();
898    
899                            DB db = DBFactoryUtil.getDB();
900    
901                            sql = db.buildSQL(sql);
902                            sql = PortalUtil.transformSQL(sql);
903    
904                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
905                                            sql, new int[0]);
906    
907                            sqlUpdate.update();
908                    }
909                    catch (Exception e) {
910                            throw new SystemException(e);
911                    }
912            }
913    
914            @BeanReference(type = com.liferay.portlet.messageboards.service.MBDiscussionLocalService.class)
915            protected com.liferay.portlet.messageboards.service.MBDiscussionLocalService mbDiscussionLocalService;
916            @BeanReference(type = MBDiscussionPersistence.class)
917            protected MBDiscussionPersistence mbDiscussionPersistence;
918            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
919            protected com.liferay.counter.service.CounterLocalService counterLocalService;
920            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
921            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
922            @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
923            protected com.liferay.portal.service.ClassNameService classNameService;
924            @BeanReference(type = ClassNamePersistence.class)
925            protected ClassNamePersistence classNamePersistence;
926            @BeanReference(type = com.liferay.portal.service.SubscriptionLocalService.class)
927            protected com.liferay.portal.service.SubscriptionLocalService subscriptionLocalService;
928            @BeanReference(type = SubscriptionPersistence.class)
929            protected SubscriptionPersistence subscriptionPersistence;
930            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
931            protected com.liferay.portal.service.UserLocalService userLocalService;
932            @BeanReference(type = com.liferay.portal.service.UserService.class)
933            protected com.liferay.portal.service.UserService userService;
934            @BeanReference(type = UserPersistence.class)
935            protected UserPersistence userPersistence;
936            @BeanReference(type = UserFinder.class)
937            protected UserFinder userFinder;
938            @BeanReference(type = com.liferay.portlet.messageboards.service.MBMailingListLocalService.class)
939            protected com.liferay.portlet.messageboards.service.MBMailingListLocalService mbMailingListLocalService;
940            @BeanReference(type = MBMailingListPersistence.class)
941            protected MBMailingListPersistence mbMailingListPersistence;
942            @BeanReference(type = com.liferay.portlet.messageboards.service.MBMessageLocalService.class)
943            protected com.liferay.portlet.messageboards.service.MBMessageLocalService mbMessageLocalService;
944            @BeanReference(type = com.liferay.portlet.messageboards.service.MBMessageService.class)
945            protected com.liferay.portlet.messageboards.service.MBMessageService mbMessageService;
946            @BeanReference(type = MBMessagePersistence.class)
947            protected MBMessagePersistence mbMessagePersistence;
948            @BeanReference(type = MBMessageFinder.class)
949            protected MBMessageFinder mbMessageFinder;
950            @BeanReference(type = com.liferay.portlet.messageboards.service.MBThreadLocalService.class)
951            protected com.liferay.portlet.messageboards.service.MBThreadLocalService mbThreadLocalService;
952            @BeanReference(type = com.liferay.portlet.messageboards.service.MBThreadService.class)
953            protected com.liferay.portlet.messageboards.service.MBThreadService mbThreadService;
954            @BeanReference(type = MBThreadPersistence.class)
955            protected MBThreadPersistence mbThreadPersistence;
956            @BeanReference(type = MBThreadFinder.class)
957            protected MBThreadFinder mbThreadFinder;
958            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
959            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
960            private String _beanIdentifier;
961    }