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.portal.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
029    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
030    import com.liferay.portal.kernel.dao.orm.Projection;
031    import com.liferay.portal.kernel.dao.orm.Property;
032    import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
033    import com.liferay.portal.kernel.exception.PortalException;
034    import com.liferay.portal.kernel.exception.SystemException;
035    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
036    import com.liferay.portal.kernel.search.Indexable;
037    import com.liferay.portal.kernel.search.IndexableType;
038    import com.liferay.portal.kernel.util.OrderByComparator;
039    import com.liferay.portal.model.PersistedModel;
040    import com.liferay.portal.model.Repository;
041    import com.liferay.portal.service.BaseLocalServiceImpl;
042    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
043    import com.liferay.portal.service.RepositoryLocalService;
044    import com.liferay.portal.service.persistence.ClassNamePersistence;
045    import com.liferay.portal.service.persistence.CompanyPersistence;
046    import com.liferay.portal.service.persistence.GroupFinder;
047    import com.liferay.portal.service.persistence.GroupPersistence;
048    import com.liferay.portal.service.persistence.RepositoryEntryPersistence;
049    import com.liferay.portal.service.persistence.RepositoryPersistence;
050    import com.liferay.portal.service.persistence.SystemEventPersistence;
051    import com.liferay.portal.service.persistence.UserFinder;
052    import com.liferay.portal.service.persistence.UserPersistence;
053    import com.liferay.portal.util.PortalUtil;
054    
055    import com.liferay.portlet.asset.service.persistence.AssetEntryFinder;
056    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
057    import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryFinder;
058    import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistence;
059    import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryTypeFinder;
060    import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryTypePersistence;
061    import com.liferay.portlet.documentlibrary.service.persistence.DLFileShortcutPersistence;
062    import com.liferay.portlet.documentlibrary.service.persistence.DLFileVersionPersistence;
063    import com.liferay.portlet.documentlibrary.service.persistence.DLFolderFinder;
064    import com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence;
065    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
066    import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
067    import com.liferay.portlet.exportimport.lar.ManifestSummary;
068    import com.liferay.portlet.exportimport.lar.PortletDataContext;
069    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
070    import com.liferay.portlet.exportimport.lar.StagedModelType;
071    
072    import java.io.Serializable;
073    
074    import java.util.List;
075    
076    import javax.sql.DataSource;
077    
078    /**
079     * Provides the base implementation for the repository local service.
080     *
081     * <p>
082     * 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.portal.service.impl.RepositoryLocalServiceImpl}.
083     * </p>
084     *
085     * @author Brian Wing Shun Chan
086     * @see com.liferay.portal.service.impl.RepositoryLocalServiceImpl
087     * @see com.liferay.portal.service.RepositoryLocalServiceUtil
088     * @generated
089     */
090    @ProviderType
091    public abstract class RepositoryLocalServiceBaseImpl
092            extends BaseLocalServiceImpl implements RepositoryLocalService,
093                    IdentifiableOSGiService {
094            /*
095             * NOTE FOR DEVELOPERS:
096             *
097             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.RepositoryLocalServiceUtil} to access the repository local service.
098             */
099    
100            /**
101             * Adds the repository to the database. Also notifies the appropriate model listeners.
102             *
103             * @param repository the repository
104             * @return the repository that was added
105             */
106            @Indexable(type = IndexableType.REINDEX)
107            @Override
108            public Repository addRepository(Repository repository) {
109                    repository.setNew(true);
110    
111                    return repositoryPersistence.update(repository);
112            }
113    
114            /**
115             * Creates a new repository with the primary key. Does not add the repository to the database.
116             *
117             * @param repositoryId the primary key for the new repository
118             * @return the new repository
119             */
120            @Override
121            public Repository createRepository(long repositoryId) {
122                    return repositoryPersistence.create(repositoryId);
123            }
124    
125            /**
126             * Deletes the repository with the primary key from the database. Also notifies the appropriate model listeners.
127             *
128             * @param repositoryId the primary key of the repository
129             * @return the repository that was removed
130             * @throws PortalException if a repository with the primary key could not be found
131             */
132            @Indexable(type = IndexableType.DELETE)
133            @Override
134            public Repository deleteRepository(long repositoryId)
135                    throws PortalException {
136                    return repositoryPersistence.remove(repositoryId);
137            }
138    
139            /**
140             * Deletes the repository from the database. Also notifies the appropriate model listeners.
141             *
142             * @param repository the repository
143             * @return the repository that was removed
144             */
145            @Indexable(type = IndexableType.DELETE)
146            @Override
147            public Repository deleteRepository(Repository repository) {
148                    return repositoryPersistence.remove(repository);
149            }
150    
151            @Override
152            public DynamicQuery dynamicQuery() {
153                    Class<?> clazz = getClass();
154    
155                    return DynamicQueryFactoryUtil.forClass(Repository.class,
156                            clazz.getClassLoader());
157            }
158    
159            /**
160             * Performs a dynamic query on the database and returns the matching rows.
161             *
162             * @param dynamicQuery the dynamic query
163             * @return the matching rows
164             */
165            @Override
166            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
167                    return repositoryPersistence.findWithDynamicQuery(dynamicQuery);
168            }
169    
170            /**
171             * Performs a dynamic query on the database and returns a range of the matching rows.
172             *
173             * <p>
174             * 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.portal.model.impl.RepositoryModelImpl}. 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.
175             * </p>
176             *
177             * @param dynamicQuery the dynamic query
178             * @param start the lower bound of the range of model instances
179             * @param end the upper bound of the range of model instances (not inclusive)
180             * @return the range of matching rows
181             */
182            @Override
183            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
184                    int end) {
185                    return repositoryPersistence.findWithDynamicQuery(dynamicQuery, start,
186                            end);
187            }
188    
189            /**
190             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
191             *
192             * <p>
193             * 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.portal.model.impl.RepositoryModelImpl}. 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.
194             * </p>
195             *
196             * @param dynamicQuery the dynamic query
197             * @param start the lower bound of the range of model instances
198             * @param end the upper bound of the range of model instances (not inclusive)
199             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
200             * @return the ordered range of matching rows
201             */
202            @Override
203            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
204                    int end, OrderByComparator<T> orderByComparator) {
205                    return repositoryPersistence.findWithDynamicQuery(dynamicQuery, start,
206                            end, orderByComparator);
207            }
208    
209            /**
210             * Returns the number of rows matching the dynamic query.
211             *
212             * @param dynamicQuery the dynamic query
213             * @return the number of rows matching the dynamic query
214             */
215            @Override
216            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
217                    return repositoryPersistence.countWithDynamicQuery(dynamicQuery);
218            }
219    
220            /**
221             * Returns the number of rows matching the dynamic query.
222             *
223             * @param dynamicQuery the dynamic query
224             * @param projection the projection to apply to the query
225             * @return the number of rows matching the dynamic query
226             */
227            @Override
228            public long dynamicQueryCount(DynamicQuery dynamicQuery,
229                    Projection projection) {
230                    return repositoryPersistence.countWithDynamicQuery(dynamicQuery,
231                            projection);
232            }
233    
234            @Override
235            public Repository fetchRepository(long repositoryId) {
236                    return repositoryPersistence.fetchByPrimaryKey(repositoryId);
237            }
238    
239            /**
240             * Returns the repository matching the UUID and group.
241             *
242             * @param uuid the repository's UUID
243             * @param groupId the primary key of the group
244             * @return the matching repository, or <code>null</code> if a matching repository could not be found
245             */
246            @Override
247            public Repository fetchRepositoryByUuidAndGroupId(String uuid, long groupId) {
248                    return repositoryPersistence.fetchByUUID_G(uuid, groupId);
249            }
250    
251            /**
252             * Returns the repository with the primary key.
253             *
254             * @param repositoryId the primary key of the repository
255             * @return the repository
256             * @throws PortalException if a repository with the primary key could not be found
257             */
258            @Override
259            public Repository getRepository(long repositoryId)
260                    throws PortalException {
261                    return repositoryPersistence.findByPrimaryKey(repositoryId);
262            }
263    
264            @Override
265            public ActionableDynamicQuery getActionableDynamicQuery() {
266                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
267    
268                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.RepositoryLocalServiceUtil.getService());
269                    actionableDynamicQuery.setClassLoader(getClassLoader());
270                    actionableDynamicQuery.setModelClass(Repository.class);
271    
272                    actionableDynamicQuery.setPrimaryKeyPropertyName("repositoryId");
273    
274                    return actionableDynamicQuery;
275            }
276    
277            @Override
278            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
279                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
280    
281                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.RepositoryLocalServiceUtil.getService());
282                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
283                    indexableActionableDynamicQuery.setModelClass(Repository.class);
284    
285                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
286                            "repositoryId");
287    
288                    return indexableActionableDynamicQuery;
289            }
290    
291            protected void initActionableDynamicQuery(
292                    ActionableDynamicQuery actionableDynamicQuery) {
293                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.RepositoryLocalServiceUtil.getService());
294                    actionableDynamicQuery.setClassLoader(getClassLoader());
295                    actionableDynamicQuery.setModelClass(Repository.class);
296    
297                    actionableDynamicQuery.setPrimaryKeyPropertyName("repositoryId");
298            }
299    
300            @Override
301            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
302                    final PortletDataContext portletDataContext) {
303                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
304                                    @Override
305                                    public long performCount() throws PortalException {
306                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
307    
308                                            StagedModelType stagedModelType = getStagedModelType();
309    
310                                            long modelAdditionCount = super.performCount();
311    
312                                            manifestSummary.addModelAdditionCount(stagedModelType,
313                                                    modelAdditionCount);
314    
315                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
316                                                            stagedModelType);
317    
318                                            manifestSummary.addModelDeletionCount(stagedModelType,
319                                                    modelDeletionCount);
320    
321                                            return modelAdditionCount;
322                                    }
323                            };
324    
325                    initActionableDynamicQuery(exportActionableDynamicQuery);
326    
327                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
328                                    @Override
329                                    public void addCriteria(DynamicQuery dynamicQuery) {
330                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
331                                                    "modifiedDate");
332    
333                                            StagedModelType stagedModelType = exportActionableDynamicQuery.getStagedModelType();
334    
335                                            long referrerClassNameId = stagedModelType.getReferrerClassNameId();
336    
337                                            Property classNameIdProperty = PropertyFactoryUtil.forName(
338                                                            "classNameId");
339    
340                                            if ((referrerClassNameId != StagedModelType.REFERRER_CLASS_NAME_ID_ALL) &&
341                                                            (referrerClassNameId != StagedModelType.REFERRER_CLASS_NAME_ID_ANY)) {
342                                                    dynamicQuery.add(classNameIdProperty.eq(
343                                                                    stagedModelType.getReferrerClassNameId()));
344                                            }
345                                            else if (referrerClassNameId == StagedModelType.REFERRER_CLASS_NAME_ID_ANY) {
346                                                    dynamicQuery.add(classNameIdProperty.isNotNull());
347                                            }
348                                    }
349                            });
350    
351                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
352    
353                    exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
354    
355                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Repository>() {
356                                    @Override
357                                    public void performAction(Repository repository)
358                                            throws PortalException {
359                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
360                                                    repository);
361                                    }
362                            });
363                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
364                                    PortalUtil.getClassNameId(Repository.class.getName()),
365                                    StagedModelType.REFERRER_CLASS_NAME_ID_ALL));
366    
367                    return exportActionableDynamicQuery;
368            }
369    
370            /**
371             * @throws PortalException
372             */
373            @Override
374            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
375                    throws PortalException {
376                    return repositoryLocalService.deleteRepository((Repository)persistedModel);
377            }
378    
379            @Override
380            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
381                    throws PortalException {
382                    return repositoryPersistence.findByPrimaryKey(primaryKeyObj);
383            }
384    
385            /**
386             * Returns all the repositories matching the UUID and company.
387             *
388             * @param uuid the UUID of the repositories
389             * @param companyId the primary key of the company
390             * @return the matching repositories, or an empty list if no matches were found
391             */
392            @Override
393            public List<Repository> getRepositoriesByUuidAndCompanyId(String uuid,
394                    long companyId) {
395                    return repositoryPersistence.findByUuid_C(uuid, companyId);
396            }
397    
398            /**
399             * Returns a range of repositories matching the UUID and company.
400             *
401             * @param uuid the UUID of the repositories
402             * @param companyId the primary key of the company
403             * @param start the lower bound of the range of repositories
404             * @param end the upper bound of the range of repositories (not inclusive)
405             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
406             * @return the range of matching repositories, or an empty list if no matches were found
407             */
408            @Override
409            public List<Repository> getRepositoriesByUuidAndCompanyId(String uuid,
410                    long companyId, int start, int end,
411                    OrderByComparator<Repository> orderByComparator) {
412                    return repositoryPersistence.findByUuid_C(uuid, companyId, start, end,
413                            orderByComparator);
414            }
415    
416            /**
417             * Returns the repository matching the UUID and group.
418             *
419             * @param uuid the repository's UUID
420             * @param groupId the primary key of the group
421             * @return the matching repository
422             * @throws PortalException if a matching repository could not be found
423             */
424            @Override
425            public Repository getRepositoryByUuidAndGroupId(String uuid, long groupId)
426                    throws PortalException {
427                    return repositoryPersistence.findByUUID_G(uuid, groupId);
428            }
429    
430            /**
431             * Returns a range of all the repositories.
432             *
433             * <p>
434             * 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.portal.model.impl.RepositoryModelImpl}. 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.
435             * </p>
436             *
437             * @param start the lower bound of the range of repositories
438             * @param end the upper bound of the range of repositories (not inclusive)
439             * @return the range of repositories
440             */
441            @Override
442            public List<Repository> getRepositories(int start, int end) {
443                    return repositoryPersistence.findAll(start, end);
444            }
445    
446            /**
447             * Returns the number of repositories.
448             *
449             * @return the number of repositories
450             */
451            @Override
452            public int getRepositoriesCount() {
453                    return repositoryPersistence.countAll();
454            }
455    
456            /**
457             * Updates the repository in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
458             *
459             * @param repository the repository
460             * @return the repository that was updated
461             */
462            @Indexable(type = IndexableType.REINDEX)
463            @Override
464            public Repository updateRepository(Repository repository) {
465                    return repositoryPersistence.update(repository);
466            }
467    
468            /**
469             * Returns the repository local service.
470             *
471             * @return the repository local service
472             */
473            public RepositoryLocalService getRepositoryLocalService() {
474                    return repositoryLocalService;
475            }
476    
477            /**
478             * Sets the repository local service.
479             *
480             * @param repositoryLocalService the repository local service
481             */
482            public void setRepositoryLocalService(
483                    RepositoryLocalService repositoryLocalService) {
484                    this.repositoryLocalService = repositoryLocalService;
485            }
486    
487            /**
488             * Returns the repository persistence.
489             *
490             * @return the repository persistence
491             */
492            public RepositoryPersistence getRepositoryPersistence() {
493                    return repositoryPersistence;
494            }
495    
496            /**
497             * Sets the repository persistence.
498             *
499             * @param repositoryPersistence the repository persistence
500             */
501            public void setRepositoryPersistence(
502                    RepositoryPersistence repositoryPersistence) {
503                    this.repositoryPersistence = repositoryPersistence;
504            }
505    
506            /**
507             * Returns the counter local service.
508             *
509             * @return the counter local service
510             */
511            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
512                    return counterLocalService;
513            }
514    
515            /**
516             * Sets the counter local service.
517             *
518             * @param counterLocalService the counter local service
519             */
520            public void setCounterLocalService(
521                    com.liferay.counter.service.CounterLocalService counterLocalService) {
522                    this.counterLocalService = counterLocalService;
523            }
524    
525            /**
526             * Returns the class name local service.
527             *
528             * @return the class name local service
529             */
530            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
531                    return classNameLocalService;
532            }
533    
534            /**
535             * Sets the class name local service.
536             *
537             * @param classNameLocalService the class name local service
538             */
539            public void setClassNameLocalService(
540                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
541                    this.classNameLocalService = classNameLocalService;
542            }
543    
544            /**
545             * Returns the class name persistence.
546             *
547             * @return the class name persistence
548             */
549            public ClassNamePersistence getClassNamePersistence() {
550                    return classNamePersistence;
551            }
552    
553            /**
554             * Sets the class name persistence.
555             *
556             * @param classNamePersistence the class name persistence
557             */
558            public void setClassNamePersistence(
559                    ClassNamePersistence classNamePersistence) {
560                    this.classNamePersistence = classNamePersistence;
561            }
562    
563            /**
564             * Returns the company local service.
565             *
566             * @return the company local service
567             */
568            public com.liferay.portal.service.CompanyLocalService getCompanyLocalService() {
569                    return companyLocalService;
570            }
571    
572            /**
573             * Sets the company local service.
574             *
575             * @param companyLocalService the company local service
576             */
577            public void setCompanyLocalService(
578                    com.liferay.portal.service.CompanyLocalService companyLocalService) {
579                    this.companyLocalService = companyLocalService;
580            }
581    
582            /**
583             * Returns the company persistence.
584             *
585             * @return the company persistence
586             */
587            public CompanyPersistence getCompanyPersistence() {
588                    return companyPersistence;
589            }
590    
591            /**
592             * Sets the company persistence.
593             *
594             * @param companyPersistence the company persistence
595             */
596            public void setCompanyPersistence(CompanyPersistence companyPersistence) {
597                    this.companyPersistence = companyPersistence;
598            }
599    
600            /**
601             * Returns the group local service.
602             *
603             * @return the group local service
604             */
605            public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
606                    return groupLocalService;
607            }
608    
609            /**
610             * Sets the group local service.
611             *
612             * @param groupLocalService the group local service
613             */
614            public void setGroupLocalService(
615                    com.liferay.portal.service.GroupLocalService groupLocalService) {
616                    this.groupLocalService = groupLocalService;
617            }
618    
619            /**
620             * Returns the group persistence.
621             *
622             * @return the group persistence
623             */
624            public GroupPersistence getGroupPersistence() {
625                    return groupPersistence;
626            }
627    
628            /**
629             * Sets the group persistence.
630             *
631             * @param groupPersistence the group persistence
632             */
633            public void setGroupPersistence(GroupPersistence groupPersistence) {
634                    this.groupPersistence = groupPersistence;
635            }
636    
637            /**
638             * Returns the group finder.
639             *
640             * @return the group finder
641             */
642            public GroupFinder getGroupFinder() {
643                    return groupFinder;
644            }
645    
646            /**
647             * Sets the group finder.
648             *
649             * @param groupFinder the group finder
650             */
651            public void setGroupFinder(GroupFinder groupFinder) {
652                    this.groupFinder = groupFinder;
653            }
654    
655            /**
656             * Returns the asset entry local service.
657             *
658             * @return the asset entry local service
659             */
660            public com.liferay.portlet.asset.service.AssetEntryLocalService getAssetEntryLocalService() {
661                    return assetEntryLocalService;
662            }
663    
664            /**
665             * Sets the asset entry local service.
666             *
667             * @param assetEntryLocalService the asset entry local service
668             */
669            public void setAssetEntryLocalService(
670                    com.liferay.portlet.asset.service.AssetEntryLocalService assetEntryLocalService) {
671                    this.assetEntryLocalService = assetEntryLocalService;
672            }
673    
674            /**
675             * Returns the asset entry persistence.
676             *
677             * @return the asset entry persistence
678             */
679            public AssetEntryPersistence getAssetEntryPersistence() {
680                    return assetEntryPersistence;
681            }
682    
683            /**
684             * Sets the asset entry persistence.
685             *
686             * @param assetEntryPersistence the asset entry persistence
687             */
688            public void setAssetEntryPersistence(
689                    AssetEntryPersistence assetEntryPersistence) {
690                    this.assetEntryPersistence = assetEntryPersistence;
691            }
692    
693            /**
694             * Returns the asset entry finder.
695             *
696             * @return the asset entry finder
697             */
698            public AssetEntryFinder getAssetEntryFinder() {
699                    return assetEntryFinder;
700            }
701    
702            /**
703             * Sets the asset entry finder.
704             *
705             * @param assetEntryFinder the asset entry finder
706             */
707            public void setAssetEntryFinder(AssetEntryFinder assetEntryFinder) {
708                    this.assetEntryFinder = assetEntryFinder;
709            }
710    
711            /**
712             * Returns the d l app helper local service.
713             *
714             * @return the d l app helper local service
715             */
716            public com.liferay.portlet.documentlibrary.service.DLAppHelperLocalService getDLAppHelperLocalService() {
717                    return dlAppHelperLocalService;
718            }
719    
720            /**
721             * Sets the d l app helper local service.
722             *
723             * @param dlAppHelperLocalService the d l app helper local service
724             */
725            public void setDLAppHelperLocalService(
726                    com.liferay.portlet.documentlibrary.service.DLAppHelperLocalService dlAppHelperLocalService) {
727                    this.dlAppHelperLocalService = dlAppHelperLocalService;
728            }
729    
730            /**
731             * Returns the document library file entry local service.
732             *
733             * @return the document library file entry local service
734             */
735            public com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService getDLFileEntryLocalService() {
736                    return dlFileEntryLocalService;
737            }
738    
739            /**
740             * Sets the document library file entry local service.
741             *
742             * @param dlFileEntryLocalService the document library file entry local service
743             */
744            public void setDLFileEntryLocalService(
745                    com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService dlFileEntryLocalService) {
746                    this.dlFileEntryLocalService = dlFileEntryLocalService;
747            }
748    
749            /**
750             * Returns the document library file entry persistence.
751             *
752             * @return the document library file entry persistence
753             */
754            public DLFileEntryPersistence getDLFileEntryPersistence() {
755                    return dlFileEntryPersistence;
756            }
757    
758            /**
759             * Sets the document library file entry persistence.
760             *
761             * @param dlFileEntryPersistence the document library file entry persistence
762             */
763            public void setDLFileEntryPersistence(
764                    DLFileEntryPersistence dlFileEntryPersistence) {
765                    this.dlFileEntryPersistence = dlFileEntryPersistence;
766            }
767    
768            /**
769             * Returns the document library file entry finder.
770             *
771             * @return the document library file entry finder
772             */
773            public DLFileEntryFinder getDLFileEntryFinder() {
774                    return dlFileEntryFinder;
775            }
776    
777            /**
778             * Sets the document library file entry finder.
779             *
780             * @param dlFileEntryFinder the document library file entry finder
781             */
782            public void setDLFileEntryFinder(DLFileEntryFinder dlFileEntryFinder) {
783                    this.dlFileEntryFinder = dlFileEntryFinder;
784            }
785    
786            /**
787             * Returns the document library file entry type local service.
788             *
789             * @return the document library file entry type local service
790             */
791            public com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalService getDLFileEntryTypeLocalService() {
792                    return dlFileEntryTypeLocalService;
793            }
794    
795            /**
796             * Sets the document library file entry type local service.
797             *
798             * @param dlFileEntryTypeLocalService the document library file entry type local service
799             */
800            public void setDLFileEntryTypeLocalService(
801                    com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalService dlFileEntryTypeLocalService) {
802                    this.dlFileEntryTypeLocalService = dlFileEntryTypeLocalService;
803            }
804    
805            /**
806             * Returns the document library file entry type persistence.
807             *
808             * @return the document library file entry type persistence
809             */
810            public DLFileEntryTypePersistence getDLFileEntryTypePersistence() {
811                    return dlFileEntryTypePersistence;
812            }
813    
814            /**
815             * Sets the document library file entry type persistence.
816             *
817             * @param dlFileEntryTypePersistence the document library file entry type persistence
818             */
819            public void setDLFileEntryTypePersistence(
820                    DLFileEntryTypePersistence dlFileEntryTypePersistence) {
821                    this.dlFileEntryTypePersistence = dlFileEntryTypePersistence;
822            }
823    
824            /**
825             * Returns the document library file entry type finder.
826             *
827             * @return the document library file entry type finder
828             */
829            public DLFileEntryTypeFinder getDLFileEntryTypeFinder() {
830                    return dlFileEntryTypeFinder;
831            }
832    
833            /**
834             * Sets the document library file entry type finder.
835             *
836             * @param dlFileEntryTypeFinder the document library file entry type finder
837             */
838            public void setDLFileEntryTypeFinder(
839                    DLFileEntryTypeFinder dlFileEntryTypeFinder) {
840                    this.dlFileEntryTypeFinder = dlFileEntryTypeFinder;
841            }
842    
843            /**
844             * Returns the document library file shortcut local service.
845             *
846             * @return the document library file shortcut local service
847             */
848            public com.liferay.portlet.documentlibrary.service.DLFileShortcutLocalService getDLFileShortcutLocalService() {
849                    return dlFileShortcutLocalService;
850            }
851    
852            /**
853             * Sets the document library file shortcut local service.
854             *
855             * @param dlFileShortcutLocalService the document library file shortcut local service
856             */
857            public void setDLFileShortcutLocalService(
858                    com.liferay.portlet.documentlibrary.service.DLFileShortcutLocalService dlFileShortcutLocalService) {
859                    this.dlFileShortcutLocalService = dlFileShortcutLocalService;
860            }
861    
862            /**
863             * Returns the document library file shortcut persistence.
864             *
865             * @return the document library file shortcut persistence
866             */
867            public DLFileShortcutPersistence getDLFileShortcutPersistence() {
868                    return dlFileShortcutPersistence;
869            }
870    
871            /**
872             * Sets the document library file shortcut persistence.
873             *
874             * @param dlFileShortcutPersistence the document library file shortcut persistence
875             */
876            public void setDLFileShortcutPersistence(
877                    DLFileShortcutPersistence dlFileShortcutPersistence) {
878                    this.dlFileShortcutPersistence = dlFileShortcutPersistence;
879            }
880    
881            /**
882             * Returns the document library file version local service.
883             *
884             * @return the document library file version local service
885             */
886            public com.liferay.portlet.documentlibrary.service.DLFileVersionLocalService getDLFileVersionLocalService() {
887                    return dlFileVersionLocalService;
888            }
889    
890            /**
891             * Sets the document library file version local service.
892             *
893             * @param dlFileVersionLocalService the document library file version local service
894             */
895            public void setDLFileVersionLocalService(
896                    com.liferay.portlet.documentlibrary.service.DLFileVersionLocalService dlFileVersionLocalService) {
897                    this.dlFileVersionLocalService = dlFileVersionLocalService;
898            }
899    
900            /**
901             * Returns the document library file version persistence.
902             *
903             * @return the document library file version persistence
904             */
905            public DLFileVersionPersistence getDLFileVersionPersistence() {
906                    return dlFileVersionPersistence;
907            }
908    
909            /**
910             * Sets the document library file version persistence.
911             *
912             * @param dlFileVersionPersistence the document library file version persistence
913             */
914            public void setDLFileVersionPersistence(
915                    DLFileVersionPersistence dlFileVersionPersistence) {
916                    this.dlFileVersionPersistence = dlFileVersionPersistence;
917            }
918    
919            /**
920             * Returns the document library folder local service.
921             *
922             * @return the document library folder local service
923             */
924            public com.liferay.portlet.documentlibrary.service.DLFolderLocalService getDLFolderLocalService() {
925                    return dlFolderLocalService;
926            }
927    
928            /**
929             * Sets the document library folder local service.
930             *
931             * @param dlFolderLocalService the document library folder local service
932             */
933            public void setDLFolderLocalService(
934                    com.liferay.portlet.documentlibrary.service.DLFolderLocalService dlFolderLocalService) {
935                    this.dlFolderLocalService = dlFolderLocalService;
936            }
937    
938            /**
939             * Returns the document library folder persistence.
940             *
941             * @return the document library folder persistence
942             */
943            public DLFolderPersistence getDLFolderPersistence() {
944                    return dlFolderPersistence;
945            }
946    
947            /**
948             * Sets the document library folder persistence.
949             *
950             * @param dlFolderPersistence the document library folder persistence
951             */
952            public void setDLFolderPersistence(DLFolderPersistence dlFolderPersistence) {
953                    this.dlFolderPersistence = dlFolderPersistence;
954            }
955    
956            /**
957             * Returns the document library folder finder.
958             *
959             * @return the document library folder finder
960             */
961            public DLFolderFinder getDLFolderFinder() {
962                    return dlFolderFinder;
963            }
964    
965            /**
966             * Sets the document library folder finder.
967             *
968             * @param dlFolderFinder the document library folder finder
969             */
970            public void setDLFolderFinder(DLFolderFinder dlFolderFinder) {
971                    this.dlFolderFinder = dlFolderFinder;
972            }
973    
974            /**
975             * Returns the expando value local service.
976             *
977             * @return the expando value local service
978             */
979            public com.liferay.portlet.expando.service.ExpandoValueLocalService getExpandoValueLocalService() {
980                    return expandoValueLocalService;
981            }
982    
983            /**
984             * Sets the expando value local service.
985             *
986             * @param expandoValueLocalService the expando value local service
987             */
988            public void setExpandoValueLocalService(
989                    com.liferay.portlet.expando.service.ExpandoValueLocalService expandoValueLocalService) {
990                    this.expandoValueLocalService = expandoValueLocalService;
991            }
992    
993            /**
994             * Returns the expando value persistence.
995             *
996             * @return the expando value persistence
997             */
998            public ExpandoValuePersistence getExpandoValuePersistence() {
999                    return expandoValuePersistence;
1000            }
1001    
1002            /**
1003             * Sets the expando value persistence.
1004             *
1005             * @param expandoValuePersistence the expando value persistence
1006             */
1007            public void setExpandoValuePersistence(
1008                    ExpandoValuePersistence expandoValuePersistence) {
1009                    this.expandoValuePersistence = expandoValuePersistence;
1010            }
1011    
1012            /**
1013             * Returns the repository entry local service.
1014             *
1015             * @return the repository entry local service
1016             */
1017            public com.liferay.portal.service.RepositoryEntryLocalService getRepositoryEntryLocalService() {
1018                    return repositoryEntryLocalService;
1019            }
1020    
1021            /**
1022             * Sets the repository entry local service.
1023             *
1024             * @param repositoryEntryLocalService the repository entry local service
1025             */
1026            public void setRepositoryEntryLocalService(
1027                    com.liferay.portal.service.RepositoryEntryLocalService repositoryEntryLocalService) {
1028                    this.repositoryEntryLocalService = repositoryEntryLocalService;
1029            }
1030    
1031            /**
1032             * Returns the repository entry persistence.
1033             *
1034             * @return the repository entry persistence
1035             */
1036            public RepositoryEntryPersistence getRepositoryEntryPersistence() {
1037                    return repositoryEntryPersistence;
1038            }
1039    
1040            /**
1041             * Sets the repository entry persistence.
1042             *
1043             * @param repositoryEntryPersistence the repository entry persistence
1044             */
1045            public void setRepositoryEntryPersistence(
1046                    RepositoryEntryPersistence repositoryEntryPersistence) {
1047                    this.repositoryEntryPersistence = repositoryEntryPersistence;
1048            }
1049    
1050            /**
1051             * Returns the resource local service.
1052             *
1053             * @return the resource local service
1054             */
1055            public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
1056                    return resourceLocalService;
1057            }
1058    
1059            /**
1060             * Sets the resource local service.
1061             *
1062             * @param resourceLocalService the resource local service
1063             */
1064            public void setResourceLocalService(
1065                    com.liferay.portal.service.ResourceLocalService resourceLocalService) {
1066                    this.resourceLocalService = resourceLocalService;
1067            }
1068    
1069            /**
1070             * Returns the system event local service.
1071             *
1072             * @return the system event local service
1073             */
1074            public com.liferay.portal.service.SystemEventLocalService getSystemEventLocalService() {
1075                    return systemEventLocalService;
1076            }
1077    
1078            /**
1079             * Sets the system event local service.
1080             *
1081             * @param systemEventLocalService the system event local service
1082             */
1083            public void setSystemEventLocalService(
1084                    com.liferay.portal.service.SystemEventLocalService systemEventLocalService) {
1085                    this.systemEventLocalService = systemEventLocalService;
1086            }
1087    
1088            /**
1089             * Returns the system event persistence.
1090             *
1091             * @return the system event persistence
1092             */
1093            public SystemEventPersistence getSystemEventPersistence() {
1094                    return systemEventPersistence;
1095            }
1096    
1097            /**
1098             * Sets the system event persistence.
1099             *
1100             * @param systemEventPersistence the system event persistence
1101             */
1102            public void setSystemEventPersistence(
1103                    SystemEventPersistence systemEventPersistence) {
1104                    this.systemEventPersistence = systemEventPersistence;
1105            }
1106    
1107            /**
1108             * Returns the user local service.
1109             *
1110             * @return the user local service
1111             */
1112            public com.liferay.portal.service.UserLocalService getUserLocalService() {
1113                    return userLocalService;
1114            }
1115    
1116            /**
1117             * Sets the user local service.
1118             *
1119             * @param userLocalService the user local service
1120             */
1121            public void setUserLocalService(
1122                    com.liferay.portal.service.UserLocalService userLocalService) {
1123                    this.userLocalService = userLocalService;
1124            }
1125    
1126            /**
1127             * Returns the user persistence.
1128             *
1129             * @return the user persistence
1130             */
1131            public UserPersistence getUserPersistence() {
1132                    return userPersistence;
1133            }
1134    
1135            /**
1136             * Sets the user persistence.
1137             *
1138             * @param userPersistence the user persistence
1139             */
1140            public void setUserPersistence(UserPersistence userPersistence) {
1141                    this.userPersistence = userPersistence;
1142            }
1143    
1144            /**
1145             * Returns the user finder.
1146             *
1147             * @return the user finder
1148             */
1149            public UserFinder getUserFinder() {
1150                    return userFinder;
1151            }
1152    
1153            /**
1154             * Sets the user finder.
1155             *
1156             * @param userFinder the user finder
1157             */
1158            public void setUserFinder(UserFinder userFinder) {
1159                    this.userFinder = userFinder;
1160            }
1161    
1162            public void afterPropertiesSet() {
1163                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.Repository",
1164                            repositoryLocalService);
1165            }
1166    
1167            public void destroy() {
1168                    persistedModelLocalServiceRegistry.unregister(
1169                            "com.liferay.portal.model.Repository");
1170            }
1171    
1172            /**
1173             * Returns the OSGi service identifier.
1174             *
1175             * @return the OSGi service identifier
1176             */
1177            @Override
1178            public String getOSGiServiceIdentifier() {
1179                    return RepositoryLocalService.class.getName();
1180            }
1181    
1182            protected Class<?> getModelClass() {
1183                    return Repository.class;
1184            }
1185    
1186            protected String getModelClassName() {
1187                    return Repository.class.getName();
1188            }
1189    
1190            /**
1191             * Performs a SQL query.
1192             *
1193             * @param sql the sql query
1194             */
1195            protected void runSQL(String sql) {
1196                    try {
1197                            DataSource dataSource = repositoryPersistence.getDataSource();
1198    
1199                            DB db = DBManagerUtil.getDB();
1200    
1201                            sql = db.buildSQL(sql);
1202                            sql = PortalUtil.transformSQL(sql);
1203    
1204                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
1205                                            sql, new int[0]);
1206    
1207                            sqlUpdate.update();
1208                    }
1209                    catch (Exception e) {
1210                            throw new SystemException(e);
1211                    }
1212            }
1213    
1214            @BeanReference(type = com.liferay.portal.service.RepositoryLocalService.class)
1215            protected RepositoryLocalService repositoryLocalService;
1216            @BeanReference(type = RepositoryPersistence.class)
1217            protected RepositoryPersistence repositoryPersistence;
1218            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
1219            protected com.liferay.counter.service.CounterLocalService counterLocalService;
1220            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
1221            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
1222            @BeanReference(type = ClassNamePersistence.class)
1223            protected ClassNamePersistence classNamePersistence;
1224            @BeanReference(type = com.liferay.portal.service.CompanyLocalService.class)
1225            protected com.liferay.portal.service.CompanyLocalService companyLocalService;
1226            @BeanReference(type = CompanyPersistence.class)
1227            protected CompanyPersistence companyPersistence;
1228            @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
1229            protected com.liferay.portal.service.GroupLocalService groupLocalService;
1230            @BeanReference(type = GroupPersistence.class)
1231            protected GroupPersistence groupPersistence;
1232            @BeanReference(type = GroupFinder.class)
1233            protected GroupFinder groupFinder;
1234            @BeanReference(type = com.liferay.portlet.asset.service.AssetEntryLocalService.class)
1235            protected com.liferay.portlet.asset.service.AssetEntryLocalService assetEntryLocalService;
1236            @BeanReference(type = AssetEntryPersistence.class)
1237            protected AssetEntryPersistence assetEntryPersistence;
1238            @BeanReference(type = AssetEntryFinder.class)
1239            protected AssetEntryFinder assetEntryFinder;
1240            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLAppHelperLocalService.class)
1241            protected com.liferay.portlet.documentlibrary.service.DLAppHelperLocalService dlAppHelperLocalService;
1242            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService.class)
1243            protected com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService dlFileEntryLocalService;
1244            @BeanReference(type = DLFileEntryPersistence.class)
1245            protected DLFileEntryPersistence dlFileEntryPersistence;
1246            @BeanReference(type = DLFileEntryFinder.class)
1247            protected DLFileEntryFinder dlFileEntryFinder;
1248            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalService.class)
1249            protected com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalService dlFileEntryTypeLocalService;
1250            @BeanReference(type = DLFileEntryTypePersistence.class)
1251            protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
1252            @BeanReference(type = DLFileEntryTypeFinder.class)
1253            protected DLFileEntryTypeFinder dlFileEntryTypeFinder;
1254            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileShortcutLocalService.class)
1255            protected com.liferay.portlet.documentlibrary.service.DLFileShortcutLocalService dlFileShortcutLocalService;
1256            @BeanReference(type = DLFileShortcutPersistence.class)
1257            protected DLFileShortcutPersistence dlFileShortcutPersistence;
1258            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileVersionLocalService.class)
1259            protected com.liferay.portlet.documentlibrary.service.DLFileVersionLocalService dlFileVersionLocalService;
1260            @BeanReference(type = DLFileVersionPersistence.class)
1261            protected DLFileVersionPersistence dlFileVersionPersistence;
1262            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFolderLocalService.class)
1263            protected com.liferay.portlet.documentlibrary.service.DLFolderLocalService dlFolderLocalService;
1264            @BeanReference(type = DLFolderPersistence.class)
1265            protected DLFolderPersistence dlFolderPersistence;
1266            @BeanReference(type = DLFolderFinder.class)
1267            protected DLFolderFinder dlFolderFinder;
1268            @BeanReference(type = com.liferay.portlet.expando.service.ExpandoValueLocalService.class)
1269            protected com.liferay.portlet.expando.service.ExpandoValueLocalService expandoValueLocalService;
1270            @BeanReference(type = ExpandoValuePersistence.class)
1271            protected ExpandoValuePersistence expandoValuePersistence;
1272            @BeanReference(type = com.liferay.portal.service.RepositoryEntryLocalService.class)
1273            protected com.liferay.portal.service.RepositoryEntryLocalService repositoryEntryLocalService;
1274            @BeanReference(type = RepositoryEntryPersistence.class)
1275            protected RepositoryEntryPersistence repositoryEntryPersistence;
1276            @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
1277            protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
1278            @BeanReference(type = com.liferay.portal.service.SystemEventLocalService.class)
1279            protected com.liferay.portal.service.SystemEventLocalService systemEventLocalService;
1280            @BeanReference(type = SystemEventPersistence.class)
1281            protected SystemEventPersistence systemEventPersistence;
1282            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
1283            protected com.liferay.portal.service.UserLocalService userLocalService;
1284            @BeanReference(type = UserPersistence.class)
1285            protected UserPersistence userPersistence;
1286            @BeanReference(type = UserFinder.class)
1287            protected UserFinder userFinder;
1288            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
1289            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
1290    }