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