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.documentlibrary.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.document.library.kernel.model.DLFileVersion;
020    import com.liferay.document.library.kernel.service.DLFileVersionLocalService;
021    import com.liferay.document.library.kernel.service.persistence.DLFileEntryFinder;
022    import com.liferay.document.library.kernel.service.persistence.DLFileEntryPersistence;
023    import com.liferay.document.library.kernel.service.persistence.DLFileVersionPersistence;
024    import com.liferay.document.library.kernel.service.persistence.DLFolderFinder;
025    import com.liferay.document.library.kernel.service.persistence.DLFolderPersistence;
026    
027    import com.liferay.exportimport.kernel.lar.ExportImportHelperUtil;
028    import com.liferay.exportimport.kernel.lar.ManifestSummary;
029    import com.liferay.exportimport.kernel.lar.PortletDataContext;
030    import com.liferay.exportimport.kernel.lar.StagedModelDataHandler;
031    import com.liferay.exportimport.kernel.lar.StagedModelDataHandlerRegistryUtil;
032    import com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil;
033    import com.liferay.exportimport.kernel.lar.StagedModelType;
034    
035    import com.liferay.portal.kernel.bean.BeanReference;
036    import com.liferay.portal.kernel.dao.db.DB;
037    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
038    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
039    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
040    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
041    import com.liferay.portal.kernel.dao.orm.Criterion;
042    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
043    import com.liferay.portal.kernel.dao.orm.Disjunction;
044    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
045    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
046    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
047    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
048    import com.liferay.portal.kernel.dao.orm.Projection;
049    import com.liferay.portal.kernel.dao.orm.Property;
050    import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
051    import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil;
052    import com.liferay.portal.kernel.exception.PortalException;
053    import com.liferay.portal.kernel.exception.SystemException;
054    import com.liferay.portal.kernel.model.PersistedModel;
055    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
056    import com.liferay.portal.kernel.search.Indexable;
057    import com.liferay.portal.kernel.search.IndexableType;
058    import com.liferay.portal.kernel.service.BaseLocalServiceImpl;
059    import com.liferay.portal.kernel.service.PersistedModelLocalServiceRegistry;
060    import com.liferay.portal.kernel.util.OrderByComparator;
061    import com.liferay.portal.kernel.util.PortalUtil;
062    import com.liferay.portal.kernel.workflow.WorkflowConstants;
063    
064    import java.io.Serializable;
065    
066    import java.util.List;
067    
068    import javax.sql.DataSource;
069    
070    /**
071     * Provides the base implementation for the document library file version local service.
072     *
073     * <p>
074     * 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.documentlibrary.service.impl.DLFileVersionLocalServiceImpl}.
075     * </p>
076     *
077     * @author Brian Wing Shun Chan
078     * @see com.liferay.portlet.documentlibrary.service.impl.DLFileVersionLocalServiceImpl
079     * @see com.liferay.document.library.kernel.service.DLFileVersionLocalServiceUtil
080     * @generated
081     */
082    @ProviderType
083    public abstract class DLFileVersionLocalServiceBaseImpl
084            extends BaseLocalServiceImpl implements DLFileVersionLocalService,
085                    IdentifiableOSGiService {
086            /*
087             * NOTE FOR DEVELOPERS:
088             *
089             * Never modify or reference this class directly. Always use {@link com.liferay.document.library.kernel.service.DLFileVersionLocalServiceUtil} to access the document library file version local service.
090             */
091    
092            /**
093             * Adds the document library file version to the database. Also notifies the appropriate model listeners.
094             *
095             * @param dlFileVersion the document library file version
096             * @return the document library file version that was added
097             */
098            @Indexable(type = IndexableType.REINDEX)
099            @Override
100            public DLFileVersion addDLFileVersion(DLFileVersion dlFileVersion) {
101                    dlFileVersion.setNew(true);
102    
103                    return dlFileVersionPersistence.update(dlFileVersion);
104            }
105    
106            /**
107             * Creates a new document library file version with the primary key. Does not add the document library file version to the database.
108             *
109             * @param fileVersionId the primary key for the new document library file version
110             * @return the new document library file version
111             */
112            @Override
113            public DLFileVersion createDLFileVersion(long fileVersionId) {
114                    return dlFileVersionPersistence.create(fileVersionId);
115            }
116    
117            /**
118             * Deletes the document library file version with the primary key from the database. Also notifies the appropriate model listeners.
119             *
120             * @param fileVersionId the primary key of the document library file version
121             * @return the document library file version that was removed
122             * @throws PortalException if a document library file version with the primary key could not be found
123             */
124            @Indexable(type = IndexableType.DELETE)
125            @Override
126            public DLFileVersion deleteDLFileVersion(long fileVersionId)
127                    throws PortalException {
128                    return dlFileVersionPersistence.remove(fileVersionId);
129            }
130    
131            /**
132             * Deletes the document library file version from the database. Also notifies the appropriate model listeners.
133             *
134             * @param dlFileVersion the document library file version
135             * @return the document library file version that was removed
136             */
137            @Indexable(type = IndexableType.DELETE)
138            @Override
139            public DLFileVersion deleteDLFileVersion(DLFileVersion dlFileVersion) {
140                    return dlFileVersionPersistence.remove(dlFileVersion);
141            }
142    
143            @Override
144            public DynamicQuery dynamicQuery() {
145                    Class<?> clazz = getClass();
146    
147                    return DynamicQueryFactoryUtil.forClass(DLFileVersion.class,
148                            clazz.getClassLoader());
149            }
150    
151            /**
152             * Performs a dynamic query on the database and returns the matching rows.
153             *
154             * @param dynamicQuery the dynamic query
155             * @return the matching rows
156             */
157            @Override
158            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
159                    return dlFileVersionPersistence.findWithDynamicQuery(dynamicQuery);
160            }
161    
162            /**
163             * Performs a dynamic query on the database and returns a range of the matching rows.
164             *
165             * <p>
166             * 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.documentlibrary.model.impl.DLFileVersionModelImpl}. 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.
167             * </p>
168             *
169             * @param dynamicQuery the dynamic query
170             * @param start the lower bound of the range of model instances
171             * @param end the upper bound of the range of model instances (not inclusive)
172             * @return the range of matching rows
173             */
174            @Override
175            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
176                    int end) {
177                    return dlFileVersionPersistence.findWithDynamicQuery(dynamicQuery,
178                            start, end);
179            }
180    
181            /**
182             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
183             *
184             * <p>
185             * 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.documentlibrary.model.impl.DLFileVersionModelImpl}. 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.
186             * </p>
187             *
188             * @param dynamicQuery the dynamic query
189             * @param start the lower bound of the range of model instances
190             * @param end the upper bound of the range of model instances (not inclusive)
191             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
192             * @return the ordered range of matching rows
193             */
194            @Override
195            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
196                    int end, OrderByComparator<T> orderByComparator) {
197                    return dlFileVersionPersistence.findWithDynamicQuery(dynamicQuery,
198                            start, end, orderByComparator);
199            }
200    
201            /**
202             * Returns the number of rows matching the dynamic query.
203             *
204             * @param dynamicQuery the dynamic query
205             * @return the number of rows matching the dynamic query
206             */
207            @Override
208            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
209                    return dlFileVersionPersistence.countWithDynamicQuery(dynamicQuery);
210            }
211    
212            /**
213             * Returns the number of rows matching the dynamic query.
214             *
215             * @param dynamicQuery the dynamic query
216             * @param projection the projection to apply to the query
217             * @return the number of rows matching the dynamic query
218             */
219            @Override
220            public long dynamicQueryCount(DynamicQuery dynamicQuery,
221                    Projection projection) {
222                    return dlFileVersionPersistence.countWithDynamicQuery(dynamicQuery,
223                            projection);
224            }
225    
226            @Override
227            public DLFileVersion fetchDLFileVersion(long fileVersionId) {
228                    return dlFileVersionPersistence.fetchByPrimaryKey(fileVersionId);
229            }
230    
231            /**
232             * Returns the document library file version matching the UUID and group.
233             *
234             * @param uuid the document library file version's UUID
235             * @param groupId the primary key of the group
236             * @return the matching document library file version, or <code>null</code> if a matching document library file version could not be found
237             */
238            @Override
239            public DLFileVersion fetchDLFileVersionByUuidAndGroupId(String uuid,
240                    long groupId) {
241                    return dlFileVersionPersistence.fetchByUUID_G(uuid, groupId);
242            }
243    
244            /**
245             * Returns the document library file version with the primary key.
246             *
247             * @param fileVersionId the primary key of the document library file version
248             * @return the document library file version
249             * @throws PortalException if a document library file version with the primary key could not be found
250             */
251            @Override
252            public DLFileVersion getDLFileVersion(long fileVersionId)
253                    throws PortalException {
254                    return dlFileVersionPersistence.findByPrimaryKey(fileVersionId);
255            }
256    
257            @Override
258            public ActionableDynamicQuery getActionableDynamicQuery() {
259                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
260    
261                    actionableDynamicQuery.setBaseLocalService(com.liferay.document.library.kernel.service.DLFileVersionLocalServiceUtil.getService());
262                    actionableDynamicQuery.setClassLoader(getClassLoader());
263                    actionableDynamicQuery.setModelClass(DLFileVersion.class);
264    
265                    actionableDynamicQuery.setPrimaryKeyPropertyName("fileVersionId");
266    
267                    return actionableDynamicQuery;
268            }
269    
270            @Override
271            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
272                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
273    
274                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.document.library.kernel.service.DLFileVersionLocalServiceUtil.getService());
275                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
276                    indexableActionableDynamicQuery.setModelClass(DLFileVersion.class);
277    
278                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
279                            "fileVersionId");
280    
281                    return indexableActionableDynamicQuery;
282            }
283    
284            protected void initActionableDynamicQuery(
285                    ActionableDynamicQuery actionableDynamicQuery) {
286                    actionableDynamicQuery.setBaseLocalService(com.liferay.document.library.kernel.service.DLFileVersionLocalServiceUtil.getService());
287                    actionableDynamicQuery.setClassLoader(getClassLoader());
288                    actionableDynamicQuery.setModelClass(DLFileVersion.class);
289    
290                    actionableDynamicQuery.setPrimaryKeyPropertyName("fileVersionId");
291            }
292    
293            @Override
294            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
295                    final PortletDataContext portletDataContext) {
296                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
297                                    @Override
298                                    public long performCount() throws PortalException {
299                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
300    
301                                            StagedModelType stagedModelType = getStagedModelType();
302    
303                                            long modelAdditionCount = super.performCount();
304    
305                                            manifestSummary.addModelAdditionCount(stagedModelType,
306                                                    modelAdditionCount);
307    
308                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
309                                                            stagedModelType);
310    
311                                            manifestSummary.addModelDeletionCount(stagedModelType,
312                                                    modelDeletionCount);
313    
314                                            return modelAdditionCount;
315                                    }
316                            };
317    
318                    initActionableDynamicQuery(exportActionableDynamicQuery);
319    
320                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
321                                    @Override
322                                    public void addCriteria(DynamicQuery dynamicQuery) {
323                                            Criterion modifiedDateCriterion = portletDataContext.getDateRangeCriteria(
324                                                            "modifiedDate");
325                                            Criterion statusDateCriterion = portletDataContext.getDateRangeCriteria(
326                                                            "statusDate");
327    
328                                            if ((modifiedDateCriterion != null) &&
329                                                            (statusDateCriterion != null)) {
330                                                    Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
331    
332                                                    disjunction.add(modifiedDateCriterion);
333                                                    disjunction.add(statusDateCriterion);
334    
335                                                    dynamicQuery.add(disjunction);
336                                            }
337    
338                                            Property workflowStatusProperty = PropertyFactoryUtil.forName(
339                                                            "status");
340    
341                                            if (portletDataContext.isInitialPublication()) {
342                                                    dynamicQuery.add(workflowStatusProperty.ne(
343                                                                    WorkflowConstants.STATUS_IN_TRASH));
344                                            }
345                                            else {
346                                                    StagedModelDataHandler<?> stagedModelDataHandler = StagedModelDataHandlerRegistryUtil.getStagedModelDataHandler(DLFileVersion.class.getName());
347    
348                                                    dynamicQuery.add(workflowStatusProperty.in(
349                                                                    stagedModelDataHandler.getExportableStatuses()));
350                                            }
351                                    }
352                            });
353    
354                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
355    
356                    exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
357    
358                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<DLFileVersion>() {
359                                    @Override
360                                    public void performAction(DLFileVersion dlFileVersion)
361                                            throws PortalException {
362                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
363                                                    dlFileVersion);
364                                    }
365                            });
366                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
367                                    PortalUtil.getClassNameId(DLFileVersion.class.getName())));
368    
369                    return exportActionableDynamicQuery;
370            }
371    
372            /**
373             * @throws PortalException
374             */
375            @Override
376            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
377                    throws PortalException {
378                    return dlFileVersionLocalService.deleteDLFileVersion((DLFileVersion)persistedModel);
379            }
380    
381            @Override
382            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
383                    throws PortalException {
384                    return dlFileVersionPersistence.findByPrimaryKey(primaryKeyObj);
385            }
386    
387            /**
388             * Returns all the document library file versions matching the UUID and company.
389             *
390             * @param uuid the UUID of the document library file versions
391             * @param companyId the primary key of the company
392             * @return the matching document library file versions, or an empty list if no matches were found
393             */
394            @Override
395            public List<DLFileVersion> getDLFileVersionsByUuidAndCompanyId(
396                    String uuid, long companyId) {
397                    return dlFileVersionPersistence.findByUuid_C(uuid, companyId);
398            }
399    
400            /**
401             * Returns a range of document library file versions matching the UUID and company.
402             *
403             * @param uuid the UUID of the document library file versions
404             * @param companyId the primary key of the company
405             * @param start the lower bound of the range of document library file versions
406             * @param end the upper bound of the range of document library file versions (not inclusive)
407             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
408             * @return the range of matching document library file versions, or an empty list if no matches were found
409             */
410            @Override
411            public List<DLFileVersion> getDLFileVersionsByUuidAndCompanyId(
412                    String uuid, long companyId, int start, int end,
413                    OrderByComparator<DLFileVersion> orderByComparator) {
414                    return dlFileVersionPersistence.findByUuid_C(uuid, companyId, start,
415                            end, orderByComparator);
416            }
417    
418            /**
419             * Returns the document library file version matching the UUID and group.
420             *
421             * @param uuid the document library file version's UUID
422             * @param groupId the primary key of the group
423             * @return the matching document library file version
424             * @throws PortalException if a matching document library file version could not be found
425             */
426            @Override
427            public DLFileVersion getDLFileVersionByUuidAndGroupId(String uuid,
428                    long groupId) throws PortalException {
429                    return dlFileVersionPersistence.findByUUID_G(uuid, groupId);
430            }
431    
432            /**
433             * Returns a range of all the document library file versions.
434             *
435             * <p>
436             * 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.documentlibrary.model.impl.DLFileVersionModelImpl}. 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.
437             * </p>
438             *
439             * @param start the lower bound of the range of document library file versions
440             * @param end the upper bound of the range of document library file versions (not inclusive)
441             * @return the range of document library file versions
442             */
443            @Override
444            public List<DLFileVersion> getDLFileVersions(int start, int end) {
445                    return dlFileVersionPersistence.findAll(start, end);
446            }
447    
448            /**
449             * Returns the number of document library file versions.
450             *
451             * @return the number of document library file versions
452             */
453            @Override
454            public int getDLFileVersionsCount() {
455                    return dlFileVersionPersistence.countAll();
456            }
457    
458            /**
459             * Updates the document library file version in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
460             *
461             * @param dlFileVersion the document library file version
462             * @return the document library file version that was updated
463             */
464            @Indexable(type = IndexableType.REINDEX)
465            @Override
466            public DLFileVersion updateDLFileVersion(DLFileVersion dlFileVersion) {
467                    return dlFileVersionPersistence.update(dlFileVersion);
468            }
469    
470            /**
471             * Returns the document library file version local service.
472             *
473             * @return the document library file version local service
474             */
475            public DLFileVersionLocalService getDLFileVersionLocalService() {
476                    return dlFileVersionLocalService;
477            }
478    
479            /**
480             * Sets the document library file version local service.
481             *
482             * @param dlFileVersionLocalService the document library file version local service
483             */
484            public void setDLFileVersionLocalService(
485                    DLFileVersionLocalService dlFileVersionLocalService) {
486                    this.dlFileVersionLocalService = dlFileVersionLocalService;
487            }
488    
489            /**
490             * Returns the document library file version persistence.
491             *
492             * @return the document library file version persistence
493             */
494            public DLFileVersionPersistence getDLFileVersionPersistence() {
495                    return dlFileVersionPersistence;
496            }
497    
498            /**
499             * Sets the document library file version persistence.
500             *
501             * @param dlFileVersionPersistence the document library file version persistence
502             */
503            public void setDLFileVersionPersistence(
504                    DLFileVersionPersistence dlFileVersionPersistence) {
505                    this.dlFileVersionPersistence = dlFileVersionPersistence;
506            }
507    
508            /**
509             * Returns the counter local service.
510             *
511             * @return the counter local service
512             */
513            public com.liferay.counter.kernel.service.CounterLocalService getCounterLocalService() {
514                    return counterLocalService;
515            }
516    
517            /**
518             * Sets the counter local service.
519             *
520             * @param counterLocalService the counter local service
521             */
522            public void setCounterLocalService(
523                    com.liferay.counter.kernel.service.CounterLocalService counterLocalService) {
524                    this.counterLocalService = counterLocalService;
525            }
526    
527            /**
528             * Returns the document library file entry local service.
529             *
530             * @return the document library file entry local service
531             */
532            public com.liferay.document.library.kernel.service.DLFileEntryLocalService getDLFileEntryLocalService() {
533                    return dlFileEntryLocalService;
534            }
535    
536            /**
537             * Sets the document library file entry local service.
538             *
539             * @param dlFileEntryLocalService the document library file entry local service
540             */
541            public void setDLFileEntryLocalService(
542                    com.liferay.document.library.kernel.service.DLFileEntryLocalService dlFileEntryLocalService) {
543                    this.dlFileEntryLocalService = dlFileEntryLocalService;
544            }
545    
546            /**
547             * Returns the document library file entry persistence.
548             *
549             * @return the document library file entry persistence
550             */
551            public DLFileEntryPersistence getDLFileEntryPersistence() {
552                    return dlFileEntryPersistence;
553            }
554    
555            /**
556             * Sets the document library file entry persistence.
557             *
558             * @param dlFileEntryPersistence the document library file entry persistence
559             */
560            public void setDLFileEntryPersistence(
561                    DLFileEntryPersistence dlFileEntryPersistence) {
562                    this.dlFileEntryPersistence = dlFileEntryPersistence;
563            }
564    
565            /**
566             * Returns the document library file entry finder.
567             *
568             * @return the document library file entry finder
569             */
570            public DLFileEntryFinder getDLFileEntryFinder() {
571                    return dlFileEntryFinder;
572            }
573    
574            /**
575             * Sets the document library file entry finder.
576             *
577             * @param dlFileEntryFinder the document library file entry finder
578             */
579            public void setDLFileEntryFinder(DLFileEntryFinder dlFileEntryFinder) {
580                    this.dlFileEntryFinder = dlFileEntryFinder;
581            }
582    
583            /**
584             * Returns the document library folder local service.
585             *
586             * @return the document library folder local service
587             */
588            public com.liferay.document.library.kernel.service.DLFolderLocalService getDLFolderLocalService() {
589                    return dlFolderLocalService;
590            }
591    
592            /**
593             * Sets the document library folder local service.
594             *
595             * @param dlFolderLocalService the document library folder local service
596             */
597            public void setDLFolderLocalService(
598                    com.liferay.document.library.kernel.service.DLFolderLocalService dlFolderLocalService) {
599                    this.dlFolderLocalService = dlFolderLocalService;
600            }
601    
602            /**
603             * Returns the document library folder persistence.
604             *
605             * @return the document library folder persistence
606             */
607            public DLFolderPersistence getDLFolderPersistence() {
608                    return dlFolderPersistence;
609            }
610    
611            /**
612             * Sets the document library folder persistence.
613             *
614             * @param dlFolderPersistence the document library folder persistence
615             */
616            public void setDLFolderPersistence(DLFolderPersistence dlFolderPersistence) {
617                    this.dlFolderPersistence = dlFolderPersistence;
618            }
619    
620            /**
621             * Returns the document library folder finder.
622             *
623             * @return the document library folder finder
624             */
625            public DLFolderFinder getDLFolderFinder() {
626                    return dlFolderFinder;
627            }
628    
629            /**
630             * Sets the document library folder finder.
631             *
632             * @param dlFolderFinder the document library folder finder
633             */
634            public void setDLFolderFinder(DLFolderFinder dlFolderFinder) {
635                    this.dlFolderFinder = dlFolderFinder;
636            }
637    
638            public void afterPropertiesSet() {
639                    persistedModelLocalServiceRegistry.register("com.liferay.document.library.kernel.model.DLFileVersion",
640                            dlFileVersionLocalService);
641            }
642    
643            public void destroy() {
644                    persistedModelLocalServiceRegistry.unregister(
645                            "com.liferay.document.library.kernel.model.DLFileVersion");
646            }
647    
648            /**
649             * Returns the OSGi service identifier.
650             *
651             * @return the OSGi service identifier
652             */
653            @Override
654            public String getOSGiServiceIdentifier() {
655                    return DLFileVersionLocalService.class.getName();
656            }
657    
658            protected Class<?> getModelClass() {
659                    return DLFileVersion.class;
660            }
661    
662            protected String getModelClassName() {
663                    return DLFileVersion.class.getName();
664            }
665    
666            /**
667             * Performs a SQL query.
668             *
669             * @param sql the sql query
670             */
671            protected void runSQL(String sql) {
672                    try {
673                            DataSource dataSource = dlFileVersionPersistence.getDataSource();
674    
675                            DB db = DBManagerUtil.getDB();
676    
677                            sql = db.buildSQL(sql);
678                            sql = PortalUtil.transformSQL(sql);
679    
680                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
681                                            sql, new int[0]);
682    
683                            sqlUpdate.update();
684                    }
685                    catch (Exception e) {
686                            throw new SystemException(e);
687                    }
688            }
689    
690            @BeanReference(type = com.liferay.document.library.kernel.service.DLFileVersionLocalService.class)
691            protected DLFileVersionLocalService dlFileVersionLocalService;
692            @BeanReference(type = DLFileVersionPersistence.class)
693            protected DLFileVersionPersistence dlFileVersionPersistence;
694            @BeanReference(type = com.liferay.counter.kernel.service.CounterLocalService.class)
695            protected com.liferay.counter.kernel.service.CounterLocalService counterLocalService;
696            @BeanReference(type = com.liferay.document.library.kernel.service.DLFileEntryLocalService.class)
697            protected com.liferay.document.library.kernel.service.DLFileEntryLocalService dlFileEntryLocalService;
698            @BeanReference(type = DLFileEntryPersistence.class)
699            protected DLFileEntryPersistence dlFileEntryPersistence;
700            @BeanReference(type = DLFileEntryFinder.class)
701            protected DLFileEntryFinder dlFileEntryFinder;
702            @BeanReference(type = com.liferay.document.library.kernel.service.DLFolderLocalService.class)
703            protected com.liferay.document.library.kernel.service.DLFolderLocalService dlFolderLocalService;
704            @BeanReference(type = DLFolderPersistence.class)
705            protected DLFolderPersistence dlFolderPersistence;
706            @BeanReference(type = DLFolderFinder.class)
707            protected DLFolderFinder dlFolderFinder;
708            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
709            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
710    }