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.bean.IdentifiableBean;
021    import com.liferay.portal.kernel.dao.db.DB;
022    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.Criterion;
027    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
028    import com.liferay.portal.kernel.dao.orm.Disjunction;
029    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
030    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
031    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
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.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                    IdentifiableBean {
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.toString(),
290                                                    modelAdditionCount);
291    
292                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
293                                                            stagedModelType);
294    
295                                            manifestSummary.addModelDeletionCount(stagedModelType.toString(),
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() {
343                                    @Override
344                                    public void performAction(Object object)
345                                            throws PortalException {
346                                            DLFileVersion stagedModel = (DLFileVersion)object;
347    
348                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
349                                                    stagedModel);
350                                    }
351                            });
352                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
353                                    PortalUtil.getClassNameId(DLFileVersion.class.getName())));
354    
355                    return exportActionableDynamicQuery;
356            }
357    
358            /**
359             * @throws PortalException
360             */
361            @Override
362            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
363                    throws PortalException {
364                    return dlFileVersionLocalService.deleteDLFileVersion((DLFileVersion)persistedModel);
365            }
366    
367            @Override
368            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
369                    throws PortalException {
370                    return dlFileVersionPersistence.findByPrimaryKey(primaryKeyObj);
371            }
372    
373            /**
374             * Returns all the document library file versions matching the UUID and company.
375             *
376             * @param uuid the UUID of the document library file versions
377             * @param companyId the primary key of the company
378             * @return the matching document library file versions, or an empty list if no matches were found
379             */
380            @Override
381            public List<DLFileVersion> getDLFileVersionsByUuidAndCompanyId(
382                    String uuid, long companyId) {
383                    return dlFileVersionPersistence.findByUuid_C(uuid, companyId);
384            }
385    
386            /**
387             * Returns a range of 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             * @param start the lower bound of the range of document library file versions
392             * @param end the upper bound of the range of document library file versions (not inclusive)
393             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
394             * @return the range of matching document library file versions, or an empty list if no matches were found
395             */
396            @Override
397            public List<DLFileVersion> getDLFileVersionsByUuidAndCompanyId(
398                    String uuid, long companyId, int start, int end,
399                    OrderByComparator<DLFileVersion> orderByComparator) {
400                    return dlFileVersionPersistence.findByUuid_C(uuid, companyId, start,
401                            end, orderByComparator);
402            }
403    
404            /**
405             * Returns the document library file version matching the UUID and group.
406             *
407             * @param uuid the document library file version's UUID
408             * @param groupId the primary key of the group
409             * @return the matching document library file version
410             * @throws PortalException if a matching document library file version could not be found
411             */
412            @Override
413            public DLFileVersion getDLFileVersionByUuidAndGroupId(String uuid,
414                    long groupId) throws PortalException {
415                    return dlFileVersionPersistence.findByUUID_G(uuid, groupId);
416            }
417    
418            /**
419             * Returns a range of all the document library file versions.
420             *
421             * <p>
422             * 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.
423             * </p>
424             *
425             * @param start the lower bound of the range of document library file versions
426             * @param end the upper bound of the range of document library file versions (not inclusive)
427             * @return the range of document library file versions
428             */
429            @Override
430            public List<DLFileVersion> getDLFileVersions(int start, int end) {
431                    return dlFileVersionPersistence.findAll(start, end);
432            }
433    
434            /**
435             * Returns the number of document library file versions.
436             *
437             * @return the number of document library file versions
438             */
439            @Override
440            public int getDLFileVersionsCount() {
441                    return dlFileVersionPersistence.countAll();
442            }
443    
444            /**
445             * Updates the document library file version in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
446             *
447             * @param dlFileVersion the document library file version
448             * @return the document library file version that was updated
449             */
450            @Indexable(type = IndexableType.REINDEX)
451            @Override
452            public DLFileVersion updateDLFileVersion(DLFileVersion dlFileVersion) {
453                    return dlFileVersionPersistence.update(dlFileVersion);
454            }
455    
456            /**
457             * Returns the document library file version local service.
458             *
459             * @return the document library file version local service
460             */
461            public DLFileVersionLocalService getDLFileVersionLocalService() {
462                    return dlFileVersionLocalService;
463            }
464    
465            /**
466             * Sets the document library file version local service.
467             *
468             * @param dlFileVersionLocalService the document library file version local service
469             */
470            public void setDLFileVersionLocalService(
471                    DLFileVersionLocalService dlFileVersionLocalService) {
472                    this.dlFileVersionLocalService = dlFileVersionLocalService;
473            }
474    
475            /**
476             * Returns the document library file version remote service.
477             *
478             * @return the document library file version remote service
479             */
480            public com.liferay.portlet.documentlibrary.service.DLFileVersionService getDLFileVersionService() {
481                    return dlFileVersionService;
482            }
483    
484            /**
485             * Sets the document library file version remote service.
486             *
487             * @param dlFileVersionService the document library file version remote service
488             */
489            public void setDLFileVersionService(
490                    com.liferay.portlet.documentlibrary.service.DLFileVersionService dlFileVersionService) {
491                    this.dlFileVersionService = dlFileVersionService;
492            }
493    
494            /**
495             * Returns the document library file version persistence.
496             *
497             * @return the document library file version persistence
498             */
499            public DLFileVersionPersistence getDLFileVersionPersistence() {
500                    return dlFileVersionPersistence;
501            }
502    
503            /**
504             * Sets the document library file version persistence.
505             *
506             * @param dlFileVersionPersistence the document library file version persistence
507             */
508            public void setDLFileVersionPersistence(
509                    DLFileVersionPersistence dlFileVersionPersistence) {
510                    this.dlFileVersionPersistence = dlFileVersionPersistence;
511            }
512    
513            /**
514             * Returns the counter local service.
515             *
516             * @return the counter local service
517             */
518            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
519                    return counterLocalService;
520            }
521    
522            /**
523             * Sets the counter local service.
524             *
525             * @param counterLocalService the counter local service
526             */
527            public void setCounterLocalService(
528                    com.liferay.counter.service.CounterLocalService counterLocalService) {
529                    this.counterLocalService = counterLocalService;
530            }
531    
532            /**
533             * Returns the document library file entry local service.
534             *
535             * @return the document library file entry local service
536             */
537            public com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService getDLFileEntryLocalService() {
538                    return dlFileEntryLocalService;
539            }
540    
541            /**
542             * Sets the document library file entry local service.
543             *
544             * @param dlFileEntryLocalService the document library file entry local service
545             */
546            public void setDLFileEntryLocalService(
547                    com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService dlFileEntryLocalService) {
548                    this.dlFileEntryLocalService = dlFileEntryLocalService;
549            }
550    
551            /**
552             * Returns the document library file entry remote service.
553             *
554             * @return the document library file entry remote service
555             */
556            public com.liferay.portlet.documentlibrary.service.DLFileEntryService getDLFileEntryService() {
557                    return dlFileEntryService;
558            }
559    
560            /**
561             * Sets the document library file entry remote service.
562             *
563             * @param dlFileEntryService the document library file entry remote service
564             */
565            public void setDLFileEntryService(
566                    com.liferay.portlet.documentlibrary.service.DLFileEntryService dlFileEntryService) {
567                    this.dlFileEntryService = dlFileEntryService;
568            }
569    
570            /**
571             * Returns the document library file entry persistence.
572             *
573             * @return the document library file entry persistence
574             */
575            public DLFileEntryPersistence getDLFileEntryPersistence() {
576                    return dlFileEntryPersistence;
577            }
578    
579            /**
580             * Sets the document library file entry persistence.
581             *
582             * @param dlFileEntryPersistence the document library file entry persistence
583             */
584            public void setDLFileEntryPersistence(
585                    DLFileEntryPersistence dlFileEntryPersistence) {
586                    this.dlFileEntryPersistence = dlFileEntryPersistence;
587            }
588    
589            /**
590             * Returns the document library file entry finder.
591             *
592             * @return the document library file entry finder
593             */
594            public DLFileEntryFinder getDLFileEntryFinder() {
595                    return dlFileEntryFinder;
596            }
597    
598            /**
599             * Sets the document library file entry finder.
600             *
601             * @param dlFileEntryFinder the document library file entry finder
602             */
603            public void setDLFileEntryFinder(DLFileEntryFinder dlFileEntryFinder) {
604                    this.dlFileEntryFinder = dlFileEntryFinder;
605            }
606    
607            /**
608             * Returns the document library folder local service.
609             *
610             * @return the document library folder local service
611             */
612            public com.liferay.portlet.documentlibrary.service.DLFolderLocalService getDLFolderLocalService() {
613                    return dlFolderLocalService;
614            }
615    
616            /**
617             * Sets the document library folder local service.
618             *
619             * @param dlFolderLocalService the document library folder local service
620             */
621            public void setDLFolderLocalService(
622                    com.liferay.portlet.documentlibrary.service.DLFolderLocalService dlFolderLocalService) {
623                    this.dlFolderLocalService = dlFolderLocalService;
624            }
625    
626            /**
627             * Returns the document library folder remote service.
628             *
629             * @return the document library folder remote service
630             */
631            public com.liferay.portlet.documentlibrary.service.DLFolderService getDLFolderService() {
632                    return dlFolderService;
633            }
634    
635            /**
636             * Sets the document library folder remote service.
637             *
638             * @param dlFolderService the document library folder remote service
639             */
640            public void setDLFolderService(
641                    com.liferay.portlet.documentlibrary.service.DLFolderService dlFolderService) {
642                    this.dlFolderService = dlFolderService;
643            }
644    
645            /**
646             * Returns the document library folder persistence.
647             *
648             * @return the document library folder persistence
649             */
650            public DLFolderPersistence getDLFolderPersistence() {
651                    return dlFolderPersistence;
652            }
653    
654            /**
655             * Sets the document library folder persistence.
656             *
657             * @param dlFolderPersistence the document library folder persistence
658             */
659            public void setDLFolderPersistence(DLFolderPersistence dlFolderPersistence) {
660                    this.dlFolderPersistence = dlFolderPersistence;
661            }
662    
663            /**
664             * Returns the document library folder finder.
665             *
666             * @return the document library folder finder
667             */
668            public DLFolderFinder getDLFolderFinder() {
669                    return dlFolderFinder;
670            }
671    
672            /**
673             * Sets the document library folder finder.
674             *
675             * @param dlFolderFinder the document library folder finder
676             */
677            public void setDLFolderFinder(DLFolderFinder dlFolderFinder) {
678                    this.dlFolderFinder = dlFolderFinder;
679            }
680    
681            public void afterPropertiesSet() {
682                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.documentlibrary.model.DLFileVersion",
683                            dlFileVersionLocalService);
684            }
685    
686            public void destroy() {
687                    persistedModelLocalServiceRegistry.unregister(
688                            "com.liferay.portlet.documentlibrary.model.DLFileVersion");
689            }
690    
691            /**
692             * Returns the Spring bean ID for this bean.
693             *
694             * @return the Spring bean ID for this bean
695             */
696            @Override
697            public String getBeanIdentifier() {
698                    return _beanIdentifier;
699            }
700    
701            /**
702             * Sets the Spring bean ID for this bean.
703             *
704             * @param beanIdentifier the Spring bean ID for this bean
705             */
706            @Override
707            public void setBeanIdentifier(String beanIdentifier) {
708                    _beanIdentifier = beanIdentifier;
709            }
710    
711            protected Class<?> getModelClass() {
712                    return DLFileVersion.class;
713            }
714    
715            protected String getModelClassName() {
716                    return DLFileVersion.class.getName();
717            }
718    
719            /**
720             * Performs a SQL query.
721             *
722             * @param sql the sql query
723             */
724            protected void runSQL(String sql) {
725                    try {
726                            DataSource dataSource = dlFileVersionPersistence.getDataSource();
727    
728                            DB db = DBFactoryUtil.getDB();
729    
730                            sql = db.buildSQL(sql);
731                            sql = PortalUtil.transformSQL(sql);
732    
733                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
734                                            sql, new int[0]);
735    
736                            sqlUpdate.update();
737                    }
738                    catch (Exception e) {
739                            throw new SystemException(e);
740                    }
741            }
742    
743            @BeanReference(type = DLFileVersionLocalService.class)
744            protected DLFileVersionLocalService dlFileVersionLocalService;
745            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileVersionService.class)
746            protected com.liferay.portlet.documentlibrary.service.DLFileVersionService dlFileVersionService;
747            @BeanReference(type = DLFileVersionPersistence.class)
748            protected DLFileVersionPersistence dlFileVersionPersistence;
749            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
750            protected com.liferay.counter.service.CounterLocalService counterLocalService;
751            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService.class)
752            protected com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService dlFileEntryLocalService;
753            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileEntryService.class)
754            protected com.liferay.portlet.documentlibrary.service.DLFileEntryService dlFileEntryService;
755            @BeanReference(type = DLFileEntryPersistence.class)
756            protected DLFileEntryPersistence dlFileEntryPersistence;
757            @BeanReference(type = DLFileEntryFinder.class)
758            protected DLFileEntryFinder dlFileEntryFinder;
759            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFolderLocalService.class)
760            protected com.liferay.portlet.documentlibrary.service.DLFolderLocalService dlFolderLocalService;
761            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFolderService.class)
762            protected com.liferay.portlet.documentlibrary.service.DLFolderService dlFolderService;
763            @BeanReference(type = DLFolderPersistence.class)
764            protected DLFolderPersistence dlFolderPersistence;
765            @BeanReference(type = DLFolderFinder.class)
766            protected DLFolderFinder dlFolderFinder;
767            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
768            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
769            private String _beanIdentifier;
770    }