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