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