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