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.announcements.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
029    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
030    import com.liferay.portal.kernel.dao.orm.Projection;
031    import com.liferay.portal.kernel.dao.orm.Property;
032    import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
033    import com.liferay.portal.kernel.exception.PortalException;
034    import com.liferay.portal.kernel.exception.SystemException;
035    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
036    import com.liferay.portal.kernel.search.Indexable;
037    import com.liferay.portal.kernel.search.IndexableType;
038    import com.liferay.portal.kernel.util.OrderByComparator;
039    import com.liferay.portal.model.PersistedModel;
040    import com.liferay.portal.service.BaseLocalServiceImpl;
041    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
042    import com.liferay.portal.service.persistence.CompanyPersistence;
043    import com.liferay.portal.service.persistence.GroupFinder;
044    import com.liferay.portal.service.persistence.GroupPersistence;
045    import com.liferay.portal.service.persistence.OrganizationFinder;
046    import com.liferay.portal.service.persistence.OrganizationPersistence;
047    import com.liferay.portal.service.persistence.RoleFinder;
048    import com.liferay.portal.service.persistence.RolePersistence;
049    import com.liferay.portal.service.persistence.TeamFinder;
050    import com.liferay.portal.service.persistence.TeamPersistence;
051    import com.liferay.portal.service.persistence.UserFinder;
052    import com.liferay.portal.service.persistence.UserGroupFinder;
053    import com.liferay.portal.service.persistence.UserGroupPersistence;
054    import com.liferay.portal.service.persistence.UserPersistence;
055    import com.liferay.portal.util.PortalUtil;
056    
057    import com.liferay.portlet.announcements.model.AnnouncementsEntry;
058    import com.liferay.portlet.announcements.service.AnnouncementsEntryLocalService;
059    import com.liferay.portlet.announcements.service.persistence.AnnouncementsDeliveryPersistence;
060    import com.liferay.portlet.announcements.service.persistence.AnnouncementsEntryFinder;
061    import com.liferay.portlet.announcements.service.persistence.AnnouncementsEntryPersistence;
062    import com.liferay.portlet.announcements.service.persistence.AnnouncementsFlagPersistence;
063    import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
064    import com.liferay.portlet.exportimport.lar.ManifestSummary;
065    import com.liferay.portlet.exportimport.lar.PortletDataContext;
066    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
067    import com.liferay.portlet.exportimport.lar.StagedModelType;
068    
069    import java.io.Serializable;
070    
071    import java.util.List;
072    
073    import javax.sql.DataSource;
074    
075    /**
076     * Provides the base implementation for the announcements entry local service.
077     *
078     * <p>
079     * 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.announcements.service.impl.AnnouncementsEntryLocalServiceImpl}.
080     * </p>
081     *
082     * @author Brian Wing Shun Chan
083     * @see com.liferay.portlet.announcements.service.impl.AnnouncementsEntryLocalServiceImpl
084     * @see com.liferay.portlet.announcements.service.AnnouncementsEntryLocalServiceUtil
085     * @generated
086     */
087    @ProviderType
088    public abstract class AnnouncementsEntryLocalServiceBaseImpl
089            extends BaseLocalServiceImpl implements AnnouncementsEntryLocalService,
090                    IdentifiableOSGiService {
091            /*
092             * NOTE FOR DEVELOPERS:
093             *
094             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.announcements.service.AnnouncementsEntryLocalServiceUtil} to access the announcements entry local service.
095             */
096    
097            /**
098             * Adds the announcements entry to the database. Also notifies the appropriate model listeners.
099             *
100             * @param announcementsEntry the announcements entry
101             * @return the announcements entry that was added
102             */
103            @Indexable(type = IndexableType.REINDEX)
104            @Override
105            public AnnouncementsEntry addAnnouncementsEntry(
106                    AnnouncementsEntry announcementsEntry) {
107                    announcementsEntry.setNew(true);
108    
109                    return announcementsEntryPersistence.update(announcementsEntry);
110            }
111    
112            /**
113             * Creates a new announcements entry with the primary key. Does not add the announcements entry to the database.
114             *
115             * @param entryId the primary key for the new announcements entry
116             * @return the new announcements entry
117             */
118            @Override
119            public AnnouncementsEntry createAnnouncementsEntry(long entryId) {
120                    return announcementsEntryPersistence.create(entryId);
121            }
122    
123            /**
124             * Deletes the announcements entry with the primary key from the database. Also notifies the appropriate model listeners.
125             *
126             * @param entryId the primary key of the announcements entry
127             * @return the announcements entry that was removed
128             * @throws PortalException if a announcements entry with the primary key could not be found
129             */
130            @Indexable(type = IndexableType.DELETE)
131            @Override
132            public AnnouncementsEntry deleteAnnouncementsEntry(long entryId)
133                    throws PortalException {
134                    return announcementsEntryPersistence.remove(entryId);
135            }
136    
137            /**
138             * Deletes the announcements entry from the database. Also notifies the appropriate model listeners.
139             *
140             * @param announcementsEntry the announcements entry
141             * @return the announcements entry that was removed
142             */
143            @Indexable(type = IndexableType.DELETE)
144            @Override
145            public AnnouncementsEntry deleteAnnouncementsEntry(
146                    AnnouncementsEntry announcementsEntry) {
147                    return announcementsEntryPersistence.remove(announcementsEntry);
148            }
149    
150            @Override
151            public DynamicQuery dynamicQuery() {
152                    Class<?> clazz = getClass();
153    
154                    return DynamicQueryFactoryUtil.forClass(AnnouncementsEntry.class,
155                            clazz.getClassLoader());
156            }
157    
158            /**
159             * Performs a dynamic query on the database and returns the matching rows.
160             *
161             * @param dynamicQuery the dynamic query
162             * @return the matching rows
163             */
164            @Override
165            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
166                    return announcementsEntryPersistence.findWithDynamicQuery(dynamicQuery);
167            }
168    
169            /**
170             * Performs a dynamic query on the database and returns a range of the matching rows.
171             *
172             * <p>
173             * 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.announcements.model.impl.AnnouncementsEntryModelImpl}. 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.
174             * </p>
175             *
176             * @param dynamicQuery the dynamic query
177             * @param start the lower bound of the range of model instances
178             * @param end the upper bound of the range of model instances (not inclusive)
179             * @return the range of matching rows
180             */
181            @Override
182            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
183                    int end) {
184                    return announcementsEntryPersistence.findWithDynamicQuery(dynamicQuery,
185                            start, end);
186            }
187    
188            /**
189             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
190             *
191             * <p>
192             * 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.announcements.model.impl.AnnouncementsEntryModelImpl}. 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.
193             * </p>
194             *
195             * @param dynamicQuery the dynamic query
196             * @param start the lower bound of the range of model instances
197             * @param end the upper bound of the range of model instances (not inclusive)
198             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
199             * @return the ordered range of matching rows
200             */
201            @Override
202            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
203                    int end, OrderByComparator<T> orderByComparator) {
204                    return announcementsEntryPersistence.findWithDynamicQuery(dynamicQuery,
205                            start, end, orderByComparator);
206            }
207    
208            /**
209             * Returns the number of rows matching the dynamic query.
210             *
211             * @param dynamicQuery the dynamic query
212             * @return the number of rows matching the dynamic query
213             */
214            @Override
215            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
216                    return announcementsEntryPersistence.countWithDynamicQuery(dynamicQuery);
217            }
218    
219            /**
220             * Returns the number of rows matching the dynamic query.
221             *
222             * @param dynamicQuery the dynamic query
223             * @param projection the projection to apply to the query
224             * @return the number of rows matching the dynamic query
225             */
226            @Override
227            public long dynamicQueryCount(DynamicQuery dynamicQuery,
228                    Projection projection) {
229                    return announcementsEntryPersistence.countWithDynamicQuery(dynamicQuery,
230                            projection);
231            }
232    
233            @Override
234            public AnnouncementsEntry fetchAnnouncementsEntry(long entryId) {
235                    return announcementsEntryPersistence.fetchByPrimaryKey(entryId);
236            }
237    
238            /**
239             * Returns the announcements entry with the matching UUID and company.
240             *
241             * @param uuid the announcements entry's UUID
242             * @param companyId the primary key of the company
243             * @return the matching announcements entry, or <code>null</code> if a matching announcements entry could not be found
244             */
245            @Override
246            public AnnouncementsEntry fetchAnnouncementsEntryByUuidAndCompanyId(
247                    String uuid, long companyId) {
248                    return announcementsEntryPersistence.fetchByUuid_C_First(uuid,
249                            companyId, null);
250            }
251    
252            /**
253             * Returns the announcements entry with the primary key.
254             *
255             * @param entryId the primary key of the announcements entry
256             * @return the announcements entry
257             * @throws PortalException if a announcements entry with the primary key could not be found
258             */
259            @Override
260            public AnnouncementsEntry getAnnouncementsEntry(long entryId)
261                    throws PortalException {
262                    return announcementsEntryPersistence.findByPrimaryKey(entryId);
263            }
264    
265            @Override
266            public ActionableDynamicQuery getActionableDynamicQuery() {
267                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
268    
269                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.announcements.service.AnnouncementsEntryLocalServiceUtil.getService());
270                    actionableDynamicQuery.setClassLoader(getClassLoader());
271                    actionableDynamicQuery.setModelClass(AnnouncementsEntry.class);
272    
273                    actionableDynamicQuery.setPrimaryKeyPropertyName("entryId");
274    
275                    return actionableDynamicQuery;
276            }
277    
278            @Override
279            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
280                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
281    
282                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portlet.announcements.service.AnnouncementsEntryLocalServiceUtil.getService());
283                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
284                    indexableActionableDynamicQuery.setModelClass(AnnouncementsEntry.class);
285    
286                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName("entryId");
287    
288                    return indexableActionableDynamicQuery;
289            }
290    
291            protected void initActionableDynamicQuery(
292                    ActionableDynamicQuery actionableDynamicQuery) {
293                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.announcements.service.AnnouncementsEntryLocalServiceUtil.getService());
294                    actionableDynamicQuery.setClassLoader(getClassLoader());
295                    actionableDynamicQuery.setModelClass(AnnouncementsEntry.class);
296    
297                    actionableDynamicQuery.setPrimaryKeyPropertyName("entryId");
298            }
299    
300            @Override
301            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
302                    final PortletDataContext portletDataContext) {
303                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
304                                    @Override
305                                    public long performCount() throws PortalException {
306                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
307    
308                                            StagedModelType stagedModelType = getStagedModelType();
309    
310                                            long modelAdditionCount = super.performCount();
311    
312                                            manifestSummary.addModelAdditionCount(stagedModelType,
313                                                    modelAdditionCount);
314    
315                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
316                                                            stagedModelType);
317    
318                                            manifestSummary.addModelDeletionCount(stagedModelType,
319                                                    modelDeletionCount);
320    
321                                            return modelAdditionCount;
322                                    }
323                            };
324    
325                    initActionableDynamicQuery(exportActionableDynamicQuery);
326    
327                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
328                                    @Override
329                                    public void addCriteria(DynamicQuery dynamicQuery) {
330                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
331                                                    "modifiedDate");
332    
333                                            StagedModelType stagedModelType = exportActionableDynamicQuery.getStagedModelType();
334    
335                                            long referrerClassNameId = stagedModelType.getReferrerClassNameId();
336    
337                                            Property classNameIdProperty = PropertyFactoryUtil.forName(
338                                                            "classNameId");
339    
340                                            if ((referrerClassNameId != StagedModelType.REFERRER_CLASS_NAME_ID_ALL) &&
341                                                            (referrerClassNameId != StagedModelType.REFERRER_CLASS_NAME_ID_ANY)) {
342                                                    dynamicQuery.add(classNameIdProperty.eq(
343                                                                    stagedModelType.getReferrerClassNameId()));
344                                            }
345                                            else if (referrerClassNameId == StagedModelType.REFERRER_CLASS_NAME_ID_ANY) {
346                                                    dynamicQuery.add(classNameIdProperty.isNotNull());
347                                            }
348                                    }
349                            });
350    
351                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
352    
353                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<AnnouncementsEntry>() {
354                                    @Override
355                                    public void performAction(AnnouncementsEntry announcementsEntry)
356                                            throws PortalException {
357                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
358                                                    announcementsEntry);
359                                    }
360                            });
361                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
362                                    PortalUtil.getClassNameId(AnnouncementsEntry.class.getName()),
363                                    StagedModelType.REFERRER_CLASS_NAME_ID_ALL));
364    
365                    return exportActionableDynamicQuery;
366            }
367    
368            /**
369             * @throws PortalException
370             */
371            @Override
372            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
373                    throws PortalException {
374                    return announcementsEntryLocalService.deleteAnnouncementsEntry((AnnouncementsEntry)persistedModel);
375            }
376    
377            @Override
378            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
379                    throws PortalException {
380                    return announcementsEntryPersistence.findByPrimaryKey(primaryKeyObj);
381            }
382    
383            /**
384             * Returns the announcements entry with the matching UUID and company.
385             *
386             * @param uuid the announcements entry's UUID
387             * @param companyId the primary key of the company
388             * @return the matching announcements entry
389             * @throws PortalException if a matching announcements entry could not be found
390             */
391            @Override
392            public AnnouncementsEntry getAnnouncementsEntryByUuidAndCompanyId(
393                    String uuid, long companyId) throws PortalException {
394                    return announcementsEntryPersistence.findByUuid_C_First(uuid,
395                            companyId, null);
396            }
397    
398            /**
399             * Returns a range of all the announcements entries.
400             *
401             * <p>
402             * 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.announcements.model.impl.AnnouncementsEntryModelImpl}. 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.
403             * </p>
404             *
405             * @param start the lower bound of the range of announcements entries
406             * @param end the upper bound of the range of announcements entries (not inclusive)
407             * @return the range of announcements entries
408             */
409            @Override
410            public List<AnnouncementsEntry> getAnnouncementsEntries(int start, int end) {
411                    return announcementsEntryPersistence.findAll(start, end);
412            }
413    
414            /**
415             * Returns the number of announcements entries.
416             *
417             * @return the number of announcements entries
418             */
419            @Override
420            public int getAnnouncementsEntriesCount() {
421                    return announcementsEntryPersistence.countAll();
422            }
423    
424            /**
425             * Updates the announcements entry in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
426             *
427             * @param announcementsEntry the announcements entry
428             * @return the announcements entry that was updated
429             */
430            @Indexable(type = IndexableType.REINDEX)
431            @Override
432            public AnnouncementsEntry updateAnnouncementsEntry(
433                    AnnouncementsEntry announcementsEntry) {
434                    return announcementsEntryPersistence.update(announcementsEntry);
435            }
436    
437            /**
438             * Returns the announcements entry local service.
439             *
440             * @return the announcements entry local service
441             */
442            public AnnouncementsEntryLocalService getAnnouncementsEntryLocalService() {
443                    return announcementsEntryLocalService;
444            }
445    
446            /**
447             * Sets the announcements entry local service.
448             *
449             * @param announcementsEntryLocalService the announcements entry local service
450             */
451            public void setAnnouncementsEntryLocalService(
452                    AnnouncementsEntryLocalService announcementsEntryLocalService) {
453                    this.announcementsEntryLocalService = announcementsEntryLocalService;
454            }
455    
456            /**
457             * Returns the announcements entry persistence.
458             *
459             * @return the announcements entry persistence
460             */
461            public AnnouncementsEntryPersistence getAnnouncementsEntryPersistence() {
462                    return announcementsEntryPersistence;
463            }
464    
465            /**
466             * Sets the announcements entry persistence.
467             *
468             * @param announcementsEntryPersistence the announcements entry persistence
469             */
470            public void setAnnouncementsEntryPersistence(
471                    AnnouncementsEntryPersistence announcementsEntryPersistence) {
472                    this.announcementsEntryPersistence = announcementsEntryPersistence;
473            }
474    
475            /**
476             * Returns the announcements entry finder.
477             *
478             * @return the announcements entry finder
479             */
480            public AnnouncementsEntryFinder getAnnouncementsEntryFinder() {
481                    return announcementsEntryFinder;
482            }
483    
484            /**
485             * Sets the announcements entry finder.
486             *
487             * @param announcementsEntryFinder the announcements entry finder
488             */
489            public void setAnnouncementsEntryFinder(
490                    AnnouncementsEntryFinder announcementsEntryFinder) {
491                    this.announcementsEntryFinder = announcementsEntryFinder;
492            }
493    
494            /**
495             * Returns the counter local service.
496             *
497             * @return the counter local service
498             */
499            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
500                    return counterLocalService;
501            }
502    
503            /**
504             * Sets the counter local service.
505             *
506             * @param counterLocalService the counter local service
507             */
508            public void setCounterLocalService(
509                    com.liferay.counter.service.CounterLocalService counterLocalService) {
510                    this.counterLocalService = counterLocalService;
511            }
512    
513            /**
514             * Returns the company local service.
515             *
516             * @return the company local service
517             */
518            public com.liferay.portal.service.CompanyLocalService getCompanyLocalService() {
519                    return companyLocalService;
520            }
521    
522            /**
523             * Sets the company local service.
524             *
525             * @param companyLocalService the company local service
526             */
527            public void setCompanyLocalService(
528                    com.liferay.portal.service.CompanyLocalService companyLocalService) {
529                    this.companyLocalService = companyLocalService;
530            }
531    
532            /**
533             * Returns the company persistence.
534             *
535             * @return the company persistence
536             */
537            public CompanyPersistence getCompanyPersistence() {
538                    return companyPersistence;
539            }
540    
541            /**
542             * Sets the company persistence.
543             *
544             * @param companyPersistence the company persistence
545             */
546            public void setCompanyPersistence(CompanyPersistence companyPersistence) {
547                    this.companyPersistence = companyPersistence;
548            }
549    
550            /**
551             * Returns the group local service.
552             *
553             * @return the group local service
554             */
555            public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
556                    return groupLocalService;
557            }
558    
559            /**
560             * Sets the group local service.
561             *
562             * @param groupLocalService the group local service
563             */
564            public void setGroupLocalService(
565                    com.liferay.portal.service.GroupLocalService groupLocalService) {
566                    this.groupLocalService = groupLocalService;
567            }
568    
569            /**
570             * Returns the group persistence.
571             *
572             * @return the group persistence
573             */
574            public GroupPersistence getGroupPersistence() {
575                    return groupPersistence;
576            }
577    
578            /**
579             * Sets the group persistence.
580             *
581             * @param groupPersistence the group persistence
582             */
583            public void setGroupPersistence(GroupPersistence groupPersistence) {
584                    this.groupPersistence = groupPersistence;
585            }
586    
587            /**
588             * Returns the group finder.
589             *
590             * @return the group finder
591             */
592            public GroupFinder getGroupFinder() {
593                    return groupFinder;
594            }
595    
596            /**
597             * Sets the group finder.
598             *
599             * @param groupFinder the group finder
600             */
601            public void setGroupFinder(GroupFinder groupFinder) {
602                    this.groupFinder = groupFinder;
603            }
604    
605            /**
606             * Returns the organization local service.
607             *
608             * @return the organization local service
609             */
610            public com.liferay.portal.service.OrganizationLocalService getOrganizationLocalService() {
611                    return organizationLocalService;
612            }
613    
614            /**
615             * Sets the organization local service.
616             *
617             * @param organizationLocalService the organization local service
618             */
619            public void setOrganizationLocalService(
620                    com.liferay.portal.service.OrganizationLocalService organizationLocalService) {
621                    this.organizationLocalService = organizationLocalService;
622            }
623    
624            /**
625             * Returns the organization persistence.
626             *
627             * @return the organization persistence
628             */
629            public OrganizationPersistence getOrganizationPersistence() {
630                    return organizationPersistence;
631            }
632    
633            /**
634             * Sets the organization persistence.
635             *
636             * @param organizationPersistence the organization persistence
637             */
638            public void setOrganizationPersistence(
639                    OrganizationPersistence organizationPersistence) {
640                    this.organizationPersistence = organizationPersistence;
641            }
642    
643            /**
644             * Returns the organization finder.
645             *
646             * @return the organization finder
647             */
648            public OrganizationFinder getOrganizationFinder() {
649                    return organizationFinder;
650            }
651    
652            /**
653             * Sets the organization finder.
654             *
655             * @param organizationFinder the organization finder
656             */
657            public void setOrganizationFinder(OrganizationFinder organizationFinder) {
658                    this.organizationFinder = organizationFinder;
659            }
660    
661            /**
662             * Returns the resource local service.
663             *
664             * @return the resource local service
665             */
666            public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
667                    return resourceLocalService;
668            }
669    
670            /**
671             * Sets the resource local service.
672             *
673             * @param resourceLocalService the resource local service
674             */
675            public void setResourceLocalService(
676                    com.liferay.portal.service.ResourceLocalService resourceLocalService) {
677                    this.resourceLocalService = resourceLocalService;
678            }
679    
680            /**
681             * Returns the role local service.
682             *
683             * @return the role local service
684             */
685            public com.liferay.portal.service.RoleLocalService getRoleLocalService() {
686                    return roleLocalService;
687            }
688    
689            /**
690             * Sets the role local service.
691             *
692             * @param roleLocalService the role local service
693             */
694            public void setRoleLocalService(
695                    com.liferay.portal.service.RoleLocalService roleLocalService) {
696                    this.roleLocalService = roleLocalService;
697            }
698    
699            /**
700             * Returns the role persistence.
701             *
702             * @return the role persistence
703             */
704            public RolePersistence getRolePersistence() {
705                    return rolePersistence;
706            }
707    
708            /**
709             * Sets the role persistence.
710             *
711             * @param rolePersistence the role persistence
712             */
713            public void setRolePersistence(RolePersistence rolePersistence) {
714                    this.rolePersistence = rolePersistence;
715            }
716    
717            /**
718             * Returns the role finder.
719             *
720             * @return the role finder
721             */
722            public RoleFinder getRoleFinder() {
723                    return roleFinder;
724            }
725    
726            /**
727             * Sets the role finder.
728             *
729             * @param roleFinder the role finder
730             */
731            public void setRoleFinder(RoleFinder roleFinder) {
732                    this.roleFinder = roleFinder;
733            }
734    
735            /**
736             * Returns the team local service.
737             *
738             * @return the team local service
739             */
740            public com.liferay.portal.service.TeamLocalService getTeamLocalService() {
741                    return teamLocalService;
742            }
743    
744            /**
745             * Sets the team local service.
746             *
747             * @param teamLocalService the team local service
748             */
749            public void setTeamLocalService(
750                    com.liferay.portal.service.TeamLocalService teamLocalService) {
751                    this.teamLocalService = teamLocalService;
752            }
753    
754            /**
755             * Returns the team persistence.
756             *
757             * @return the team persistence
758             */
759            public TeamPersistence getTeamPersistence() {
760                    return teamPersistence;
761            }
762    
763            /**
764             * Sets the team persistence.
765             *
766             * @param teamPersistence the team persistence
767             */
768            public void setTeamPersistence(TeamPersistence teamPersistence) {
769                    this.teamPersistence = teamPersistence;
770            }
771    
772            /**
773             * Returns the team finder.
774             *
775             * @return the team finder
776             */
777            public TeamFinder getTeamFinder() {
778                    return teamFinder;
779            }
780    
781            /**
782             * Sets the team finder.
783             *
784             * @param teamFinder the team finder
785             */
786            public void setTeamFinder(TeamFinder teamFinder) {
787                    this.teamFinder = teamFinder;
788            }
789    
790            /**
791             * Returns the user local service.
792             *
793             * @return the user local service
794             */
795            public com.liferay.portal.service.UserLocalService getUserLocalService() {
796                    return userLocalService;
797            }
798    
799            /**
800             * Sets the user local service.
801             *
802             * @param userLocalService the user local service
803             */
804            public void setUserLocalService(
805                    com.liferay.portal.service.UserLocalService userLocalService) {
806                    this.userLocalService = userLocalService;
807            }
808    
809            /**
810             * Returns the user persistence.
811             *
812             * @return the user persistence
813             */
814            public UserPersistence getUserPersistence() {
815                    return userPersistence;
816            }
817    
818            /**
819             * Sets the user persistence.
820             *
821             * @param userPersistence the user persistence
822             */
823            public void setUserPersistence(UserPersistence userPersistence) {
824                    this.userPersistence = userPersistence;
825            }
826    
827            /**
828             * Returns the user finder.
829             *
830             * @return the user finder
831             */
832            public UserFinder getUserFinder() {
833                    return userFinder;
834            }
835    
836            /**
837             * Sets the user finder.
838             *
839             * @param userFinder the user finder
840             */
841            public void setUserFinder(UserFinder userFinder) {
842                    this.userFinder = userFinder;
843            }
844    
845            /**
846             * Returns the user group local service.
847             *
848             * @return the user group local service
849             */
850            public com.liferay.portal.service.UserGroupLocalService getUserGroupLocalService() {
851                    return userGroupLocalService;
852            }
853    
854            /**
855             * Sets the user group local service.
856             *
857             * @param userGroupLocalService the user group local service
858             */
859            public void setUserGroupLocalService(
860                    com.liferay.portal.service.UserGroupLocalService userGroupLocalService) {
861                    this.userGroupLocalService = userGroupLocalService;
862            }
863    
864            /**
865             * Returns the user group persistence.
866             *
867             * @return the user group persistence
868             */
869            public UserGroupPersistence getUserGroupPersistence() {
870                    return userGroupPersistence;
871            }
872    
873            /**
874             * Sets the user group persistence.
875             *
876             * @param userGroupPersistence the user group persistence
877             */
878            public void setUserGroupPersistence(
879                    UserGroupPersistence userGroupPersistence) {
880                    this.userGroupPersistence = userGroupPersistence;
881            }
882    
883            /**
884             * Returns the user group finder.
885             *
886             * @return the user group finder
887             */
888            public UserGroupFinder getUserGroupFinder() {
889                    return userGroupFinder;
890            }
891    
892            /**
893             * Sets the user group finder.
894             *
895             * @param userGroupFinder the user group finder
896             */
897            public void setUserGroupFinder(UserGroupFinder userGroupFinder) {
898                    this.userGroupFinder = userGroupFinder;
899            }
900    
901            /**
902             * Returns the announcements delivery local service.
903             *
904             * @return the announcements delivery local service
905             */
906            public com.liferay.portlet.announcements.service.AnnouncementsDeliveryLocalService getAnnouncementsDeliveryLocalService() {
907                    return announcementsDeliveryLocalService;
908            }
909    
910            /**
911             * Sets the announcements delivery local service.
912             *
913             * @param announcementsDeliveryLocalService the announcements delivery local service
914             */
915            public void setAnnouncementsDeliveryLocalService(
916                    com.liferay.portlet.announcements.service.AnnouncementsDeliveryLocalService announcementsDeliveryLocalService) {
917                    this.announcementsDeliveryLocalService = announcementsDeliveryLocalService;
918            }
919    
920            /**
921             * Returns the announcements delivery persistence.
922             *
923             * @return the announcements delivery persistence
924             */
925            public AnnouncementsDeliveryPersistence getAnnouncementsDeliveryPersistence() {
926                    return announcementsDeliveryPersistence;
927            }
928    
929            /**
930             * Sets the announcements delivery persistence.
931             *
932             * @param announcementsDeliveryPersistence the announcements delivery persistence
933             */
934            public void setAnnouncementsDeliveryPersistence(
935                    AnnouncementsDeliveryPersistence announcementsDeliveryPersistence) {
936                    this.announcementsDeliveryPersistence = announcementsDeliveryPersistence;
937            }
938    
939            /**
940             * Returns the announcements flag local service.
941             *
942             * @return the announcements flag local service
943             */
944            public com.liferay.portlet.announcements.service.AnnouncementsFlagLocalService getAnnouncementsFlagLocalService() {
945                    return announcementsFlagLocalService;
946            }
947    
948            /**
949             * Sets the announcements flag local service.
950             *
951             * @param announcementsFlagLocalService the announcements flag local service
952             */
953            public void setAnnouncementsFlagLocalService(
954                    com.liferay.portlet.announcements.service.AnnouncementsFlagLocalService announcementsFlagLocalService) {
955                    this.announcementsFlagLocalService = announcementsFlagLocalService;
956            }
957    
958            /**
959             * Returns the announcements flag persistence.
960             *
961             * @return the announcements flag persistence
962             */
963            public AnnouncementsFlagPersistence getAnnouncementsFlagPersistence() {
964                    return announcementsFlagPersistence;
965            }
966    
967            /**
968             * Sets the announcements flag persistence.
969             *
970             * @param announcementsFlagPersistence the announcements flag persistence
971             */
972            public void setAnnouncementsFlagPersistence(
973                    AnnouncementsFlagPersistence announcementsFlagPersistence) {
974                    this.announcementsFlagPersistence = announcementsFlagPersistence;
975            }
976    
977            public void afterPropertiesSet() {
978                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.announcements.model.AnnouncementsEntry",
979                            announcementsEntryLocalService);
980            }
981    
982            public void destroy() {
983                    persistedModelLocalServiceRegistry.unregister(
984                            "com.liferay.portlet.announcements.model.AnnouncementsEntry");
985            }
986    
987            /**
988             * Returns the OSGi service identifier.
989             *
990             * @return the OSGi service identifier
991             */
992            @Override
993            public String getOSGiServiceIdentifier() {
994                    return AnnouncementsEntryLocalService.class.getName();
995            }
996    
997            protected Class<?> getModelClass() {
998                    return AnnouncementsEntry.class;
999            }
1000    
1001            protected String getModelClassName() {
1002                    return AnnouncementsEntry.class.getName();
1003            }
1004    
1005            /**
1006             * Performs a SQL query.
1007             *
1008             * @param sql the sql query
1009             */
1010            protected void runSQL(String sql) {
1011                    try {
1012                            DataSource dataSource = announcementsEntryPersistence.getDataSource();
1013    
1014                            DB db = DBManagerUtil.getDB();
1015    
1016                            sql = db.buildSQL(sql);
1017                            sql = PortalUtil.transformSQL(sql);
1018    
1019                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
1020                                            sql, new int[0]);
1021    
1022                            sqlUpdate.update();
1023                    }
1024                    catch (Exception e) {
1025                            throw new SystemException(e);
1026                    }
1027            }
1028    
1029            @BeanReference(type = com.liferay.portlet.announcements.service.AnnouncementsEntryLocalService.class)
1030            protected AnnouncementsEntryLocalService announcementsEntryLocalService;
1031            @BeanReference(type = AnnouncementsEntryPersistence.class)
1032            protected AnnouncementsEntryPersistence announcementsEntryPersistence;
1033            @BeanReference(type = AnnouncementsEntryFinder.class)
1034            protected AnnouncementsEntryFinder announcementsEntryFinder;
1035            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
1036            protected com.liferay.counter.service.CounterLocalService counterLocalService;
1037            @BeanReference(type = com.liferay.portal.service.CompanyLocalService.class)
1038            protected com.liferay.portal.service.CompanyLocalService companyLocalService;
1039            @BeanReference(type = CompanyPersistence.class)
1040            protected CompanyPersistence companyPersistence;
1041            @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
1042            protected com.liferay.portal.service.GroupLocalService groupLocalService;
1043            @BeanReference(type = GroupPersistence.class)
1044            protected GroupPersistence groupPersistence;
1045            @BeanReference(type = GroupFinder.class)
1046            protected GroupFinder groupFinder;
1047            @BeanReference(type = com.liferay.portal.service.OrganizationLocalService.class)
1048            protected com.liferay.portal.service.OrganizationLocalService organizationLocalService;
1049            @BeanReference(type = OrganizationPersistence.class)
1050            protected OrganizationPersistence organizationPersistence;
1051            @BeanReference(type = OrganizationFinder.class)
1052            protected OrganizationFinder organizationFinder;
1053            @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
1054            protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
1055            @BeanReference(type = com.liferay.portal.service.RoleLocalService.class)
1056            protected com.liferay.portal.service.RoleLocalService roleLocalService;
1057            @BeanReference(type = RolePersistence.class)
1058            protected RolePersistence rolePersistence;
1059            @BeanReference(type = RoleFinder.class)
1060            protected RoleFinder roleFinder;
1061            @BeanReference(type = com.liferay.portal.service.TeamLocalService.class)
1062            protected com.liferay.portal.service.TeamLocalService teamLocalService;
1063            @BeanReference(type = TeamPersistence.class)
1064            protected TeamPersistence teamPersistence;
1065            @BeanReference(type = TeamFinder.class)
1066            protected TeamFinder teamFinder;
1067            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
1068            protected com.liferay.portal.service.UserLocalService userLocalService;
1069            @BeanReference(type = UserPersistence.class)
1070            protected UserPersistence userPersistence;
1071            @BeanReference(type = UserFinder.class)
1072            protected UserFinder userFinder;
1073            @BeanReference(type = com.liferay.portal.service.UserGroupLocalService.class)
1074            protected com.liferay.portal.service.UserGroupLocalService userGroupLocalService;
1075            @BeanReference(type = UserGroupPersistence.class)
1076            protected UserGroupPersistence userGroupPersistence;
1077            @BeanReference(type = UserGroupFinder.class)
1078            protected UserGroupFinder userGroupFinder;
1079            @BeanReference(type = com.liferay.portlet.announcements.service.AnnouncementsDeliveryLocalService.class)
1080            protected com.liferay.portlet.announcements.service.AnnouncementsDeliveryLocalService announcementsDeliveryLocalService;
1081            @BeanReference(type = AnnouncementsDeliveryPersistence.class)
1082            protected AnnouncementsDeliveryPersistence announcementsDeliveryPersistence;
1083            @BeanReference(type = com.liferay.portlet.announcements.service.AnnouncementsFlagLocalService.class)
1084            protected com.liferay.portlet.announcements.service.AnnouncementsFlagLocalService announcementsFlagLocalService;
1085            @BeanReference(type = AnnouncementsFlagPersistence.class)
1086            protected AnnouncementsFlagPersistence announcementsFlagPersistence;
1087            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
1088            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
1089    }