001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.NoSuchRepositoryException;
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.model.CacheModel;
038    import com.liferay.portal.model.ModelListener;
039    import com.liferay.portal.model.Repository;
040    import com.liferay.portal.model.impl.RepositoryImpl;
041    import com.liferay.portal.model.impl.RepositoryModelImpl;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
045    import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistence;
046    import com.liferay.portlet.documentlibrary.service.persistence.DLFileVersionPersistence;
047    import com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence;
048    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
049    
050    import java.io.Serializable;
051    
052    import java.util.ArrayList;
053    import java.util.Collections;
054    import java.util.List;
055    
056    /**
057     * The persistence implementation for the repository service.
058     *
059     * <p>
060     * Caching information and settings can be found in <code>portal.properties</code>
061     * </p>
062     *
063     * @author Brian Wing Shun Chan
064     * @see RepositoryPersistence
065     * @see RepositoryUtil
066     * @generated
067     */
068    public class RepositoryPersistenceImpl extends BasePersistenceImpl<Repository>
069            implements RepositoryPersistence {
070            /*
071             * NOTE FOR DEVELOPERS:
072             *
073             * Never modify or reference this class directly. Always use {@link RepositoryUtil} to access the repository persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
074             */
075            public static final String FINDER_CLASS_NAME_ENTITY = RepositoryImpl.class.getName();
076            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077                    ".List1";
078            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
079                    ".List2";
080            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
081                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
082                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
083                            new String[] {
084                                    Long.class.getName(),
085                                    
086                            "java.lang.Integer", "java.lang.Integer",
087                                    "com.liferay.portal.kernel.util.OrderByComparator"
088                            });
089            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
090                    new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
091                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
092                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
093                            new String[] { Long.class.getName() },
094                            RepositoryModelImpl.GROUPID_COLUMN_BITMASK);
095            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
096                            RepositoryModelImpl.FINDER_CACHE_ENABLED, Long.class,
097                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
098                            new String[] { Long.class.getName() });
099            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
100                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
101                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
102            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
103                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
104                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
105            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
106                            RepositoryModelImpl.FINDER_CACHE_ENABLED, Long.class,
107                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
108    
109            /**
110             * Caches the repository in the entity cache if it is enabled.
111             *
112             * @param repository the repository
113             */
114            public void cacheResult(Repository repository) {
115                    EntityCacheUtil.putResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
116                            RepositoryImpl.class, repository.getPrimaryKey(), repository);
117    
118                    repository.resetOriginalValues();
119            }
120    
121            /**
122             * Caches the repositories in the entity cache if it is enabled.
123             *
124             * @param repositories the repositories
125             */
126            public void cacheResult(List<Repository> repositories) {
127                    for (Repository repository : repositories) {
128                            if (EntityCacheUtil.getResult(
129                                                    RepositoryModelImpl.ENTITY_CACHE_ENABLED,
130                                                    RepositoryImpl.class, repository.getPrimaryKey()) == null) {
131                                    cacheResult(repository);
132                            }
133                            else {
134                                    repository.resetOriginalValues();
135                            }
136                    }
137            }
138    
139            /**
140             * Clears the cache for all repositories.
141             *
142             * <p>
143             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
144             * </p>
145             */
146            @Override
147            public void clearCache() {
148                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
149                            CacheRegistryUtil.clear(RepositoryImpl.class.getName());
150                    }
151    
152                    EntityCacheUtil.clearCache(RepositoryImpl.class.getName());
153    
154                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
155                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
156                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
157            }
158    
159            /**
160             * Clears the cache for the repository.
161             *
162             * <p>
163             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
164             * </p>
165             */
166            @Override
167            public void clearCache(Repository repository) {
168                    EntityCacheUtil.removeResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
169                            RepositoryImpl.class, repository.getPrimaryKey());
170    
171                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
172                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
173            }
174    
175            /**
176             * Creates a new repository with the primary key. Does not add the repository to the database.
177             *
178             * @param repositoryId the primary key for the new repository
179             * @return the new repository
180             */
181            public Repository create(long repositoryId) {
182                    Repository repository = new RepositoryImpl();
183    
184                    repository.setNew(true);
185                    repository.setPrimaryKey(repositoryId);
186    
187                    return repository;
188            }
189    
190            /**
191             * Removes the repository with the primary key from the database. Also notifies the appropriate model listeners.
192             *
193             * @param primaryKey the primary key of the repository
194             * @return the repository that was removed
195             * @throws com.liferay.portal.NoSuchModelException if a repository with the primary key could not be found
196             * @throws SystemException if a system exception occurred
197             */
198            @Override
199            public Repository remove(Serializable primaryKey)
200                    throws NoSuchModelException, SystemException {
201                    return remove(((Long)primaryKey).longValue());
202            }
203    
204            /**
205             * Removes the repository with the primary key from the database. Also notifies the appropriate model listeners.
206             *
207             * @param repositoryId the primary key of the repository
208             * @return the repository that was removed
209             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
210             * @throws SystemException if a system exception occurred
211             */
212            public Repository remove(long repositoryId)
213                    throws NoSuchRepositoryException, SystemException {
214                    Session session = null;
215    
216                    try {
217                            session = openSession();
218    
219                            Repository repository = (Repository)session.get(RepositoryImpl.class,
220                                            Long.valueOf(repositoryId));
221    
222                            if (repository == null) {
223                                    if (_log.isWarnEnabled()) {
224                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + repositoryId);
225                                    }
226    
227                                    throw new NoSuchRepositoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
228                                            repositoryId);
229                            }
230    
231                            return repositoryPersistence.remove(repository);
232                    }
233                    catch (NoSuchRepositoryException nsee) {
234                            throw nsee;
235                    }
236                    catch (Exception e) {
237                            throw processException(e);
238                    }
239                    finally {
240                            closeSession(session);
241                    }
242            }
243    
244            /**
245             * Removes the repository from the database. Also notifies the appropriate model listeners.
246             *
247             * @param repository the repository
248             * @return the repository that was removed
249             * @throws SystemException if a system exception occurred
250             */
251            @Override
252            public Repository remove(Repository repository) throws SystemException {
253                    return super.remove(repository);
254            }
255    
256            @Override
257            protected Repository removeImpl(Repository repository)
258                    throws SystemException {
259                    repository = toUnwrappedModel(repository);
260    
261                    Session session = null;
262    
263                    try {
264                            session = openSession();
265    
266                            BatchSessionUtil.delete(session, repository);
267                    }
268                    catch (Exception e) {
269                            throw processException(e);
270                    }
271                    finally {
272                            closeSession(session);
273                    }
274    
275                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
276                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
277    
278                    EntityCacheUtil.removeResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
279                            RepositoryImpl.class, repository.getPrimaryKey());
280    
281                    return repository;
282            }
283    
284            @Override
285            public Repository updateImpl(
286                    com.liferay.portal.model.Repository repository, boolean merge)
287                    throws SystemException {
288                    repository = toUnwrappedModel(repository);
289    
290                    boolean isNew = repository.isNew();
291    
292                    RepositoryModelImpl repositoryModelImpl = (RepositoryModelImpl)repository;
293    
294                    Session session = null;
295    
296                    try {
297                            session = openSession();
298    
299                            BatchSessionUtil.update(session, repository, merge);
300    
301                            repository.setNew(false);
302                    }
303                    catch (Exception e) {
304                            throw processException(e);
305                    }
306                    finally {
307                            closeSession(session);
308                    }
309    
310                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
311    
312                    if (isNew || !RepositoryModelImpl.COLUMN_BITMASK_ENABLED) {
313                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
314                    }
315    
316                    else {
317                            if ((repositoryModelImpl.getColumnBitmask() &
318                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
319                                    Object[] args = new Object[] {
320                                                    Long.valueOf(repositoryModelImpl.getOriginalGroupId())
321                                            };
322    
323                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
324                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
325                                            args);
326    
327                                    args = new Object[] {
328                                                    Long.valueOf(repositoryModelImpl.getGroupId())
329                                            };
330    
331                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
332                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
333                                            args);
334                            }
335                    }
336    
337                    EntityCacheUtil.putResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
338                            RepositoryImpl.class, repository.getPrimaryKey(), repository);
339    
340                    return repository;
341            }
342    
343            protected Repository toUnwrappedModel(Repository repository) {
344                    if (repository instanceof RepositoryImpl) {
345                            return repository;
346                    }
347    
348                    RepositoryImpl repositoryImpl = new RepositoryImpl();
349    
350                    repositoryImpl.setNew(repository.isNew());
351                    repositoryImpl.setPrimaryKey(repository.getPrimaryKey());
352    
353                    repositoryImpl.setRepositoryId(repository.getRepositoryId());
354                    repositoryImpl.setGroupId(repository.getGroupId());
355                    repositoryImpl.setCompanyId(repository.getCompanyId());
356                    repositoryImpl.setCreateDate(repository.getCreateDate());
357                    repositoryImpl.setModifiedDate(repository.getModifiedDate());
358                    repositoryImpl.setClassNameId(repository.getClassNameId());
359                    repositoryImpl.setName(repository.getName());
360                    repositoryImpl.setDescription(repository.getDescription());
361                    repositoryImpl.setPortletId(repository.getPortletId());
362                    repositoryImpl.setTypeSettings(repository.getTypeSettings());
363                    repositoryImpl.setDlFolderId(repository.getDlFolderId());
364    
365                    return repositoryImpl;
366            }
367    
368            /**
369             * Returns the repository with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
370             *
371             * @param primaryKey the primary key of the repository
372             * @return the repository
373             * @throws com.liferay.portal.NoSuchModelException if a repository with the primary key could not be found
374             * @throws SystemException if a system exception occurred
375             */
376            @Override
377            public Repository findByPrimaryKey(Serializable primaryKey)
378                    throws NoSuchModelException, SystemException {
379                    return findByPrimaryKey(((Long)primaryKey).longValue());
380            }
381    
382            /**
383             * Returns the repository with the primary key or throws a {@link com.liferay.portal.NoSuchRepositoryException} if it could not be found.
384             *
385             * @param repositoryId the primary key of the repository
386             * @return the repository
387             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
388             * @throws SystemException if a system exception occurred
389             */
390            public Repository findByPrimaryKey(long repositoryId)
391                    throws NoSuchRepositoryException, SystemException {
392                    Repository repository = fetchByPrimaryKey(repositoryId);
393    
394                    if (repository == null) {
395                            if (_log.isWarnEnabled()) {
396                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + repositoryId);
397                            }
398    
399                            throw new NoSuchRepositoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
400                                    repositoryId);
401                    }
402    
403                    return repository;
404            }
405    
406            /**
407             * Returns the repository with the primary key or returns <code>null</code> if it could not be found.
408             *
409             * @param primaryKey the primary key of the repository
410             * @return the repository, or <code>null</code> if a repository with the primary key could not be found
411             * @throws SystemException if a system exception occurred
412             */
413            @Override
414            public Repository fetchByPrimaryKey(Serializable primaryKey)
415                    throws SystemException {
416                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
417            }
418    
419            /**
420             * Returns the repository with the primary key or returns <code>null</code> if it could not be found.
421             *
422             * @param repositoryId the primary key of the repository
423             * @return the repository, or <code>null</code> if a repository with the primary key could not be found
424             * @throws SystemException if a system exception occurred
425             */
426            public Repository fetchByPrimaryKey(long repositoryId)
427                    throws SystemException {
428                    Repository repository = (Repository)EntityCacheUtil.getResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
429                                    RepositoryImpl.class, repositoryId);
430    
431                    if (repository == _nullRepository) {
432                            return null;
433                    }
434    
435                    if (repository == null) {
436                            Session session = null;
437    
438                            boolean hasException = false;
439    
440                            try {
441                                    session = openSession();
442    
443                                    repository = (Repository)session.get(RepositoryImpl.class,
444                                                    Long.valueOf(repositoryId));
445                            }
446                            catch (Exception e) {
447                                    hasException = true;
448    
449                                    throw processException(e);
450                            }
451                            finally {
452                                    if (repository != null) {
453                                            cacheResult(repository);
454                                    }
455                                    else if (!hasException) {
456                                            EntityCacheUtil.putResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
457                                                    RepositoryImpl.class, repositoryId, _nullRepository);
458                                    }
459    
460                                    closeSession(session);
461                            }
462                    }
463    
464                    return repository;
465            }
466    
467            /**
468             * Returns all the repositories where groupId = &#63;.
469             *
470             * @param groupId the group ID
471             * @return the matching repositories
472             * @throws SystemException if a system exception occurred
473             */
474            public List<Repository> findByGroupId(long groupId)
475                    throws SystemException {
476                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
477            }
478    
479            /**
480             * Returns a range of all the repositories where groupId = &#63;.
481             *
482             * <p>
483             * 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.
484             * </p>
485             *
486             * @param groupId the group ID
487             * @param start the lower bound of the range of repositories
488             * @param end the upper bound of the range of repositories (not inclusive)
489             * @return the range of matching repositories
490             * @throws SystemException if a system exception occurred
491             */
492            public List<Repository> findByGroupId(long groupId, int start, int end)
493                    throws SystemException {
494                    return findByGroupId(groupId, start, end, null);
495            }
496    
497            /**
498             * Returns an ordered range of all the repositories where groupId = &#63;.
499             *
500             * <p>
501             * 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.
502             * </p>
503             *
504             * @param groupId the group ID
505             * @param start the lower bound of the range of repositories
506             * @param end the upper bound of the range of repositories (not inclusive)
507             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
508             * @return the ordered range of matching repositories
509             * @throws SystemException if a system exception occurred
510             */
511            public List<Repository> findByGroupId(long groupId, int start, int end,
512                    OrderByComparator orderByComparator) throws SystemException {
513                    FinderPath finderPath = null;
514                    Object[] finderArgs = null;
515    
516                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
517                                    (orderByComparator == null)) {
518                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
519                            finderArgs = new Object[] { groupId };
520                    }
521                    else {
522                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
523                            finderArgs = new Object[] { groupId, start, end, orderByComparator };
524                    }
525    
526                    List<Repository> list = (List<Repository>)FinderCacheUtil.getResult(finderPath,
527                                    finderArgs, this);
528    
529                    if (list == null) {
530                            StringBundler query = null;
531    
532                            if (orderByComparator != null) {
533                                    query = new StringBundler(3 +
534                                                    (orderByComparator.getOrderByFields().length * 3));
535                            }
536                            else {
537                                    query = new StringBundler(2);
538                            }
539    
540                            query.append(_SQL_SELECT_REPOSITORY_WHERE);
541    
542                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
543    
544                            if (orderByComparator != null) {
545                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
546                                            orderByComparator);
547                            }
548    
549                            String sql = query.toString();
550    
551                            Session session = null;
552    
553                            try {
554                                    session = openSession();
555    
556                                    Query q = session.createQuery(sql);
557    
558                                    QueryPos qPos = QueryPos.getInstance(q);
559    
560                                    qPos.add(groupId);
561    
562                                    list = (List<Repository>)QueryUtil.list(q, getDialect(), start,
563                                                    end);
564                            }
565                            catch (Exception e) {
566                                    throw processException(e);
567                            }
568                            finally {
569                                    if (list == null) {
570                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
571                                    }
572                                    else {
573                                            cacheResult(list);
574    
575                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
576                                    }
577    
578                                    closeSession(session);
579                            }
580                    }
581    
582                    return list;
583            }
584    
585            /**
586             * Returns the first repository in the ordered set where groupId = &#63;.
587             *
588             * <p>
589             * 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.
590             * </p>
591             *
592             * @param groupId the group ID
593             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
594             * @return the first matching repository
595             * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
596             * @throws SystemException if a system exception occurred
597             */
598            public Repository findByGroupId_First(long groupId,
599                    OrderByComparator orderByComparator)
600                    throws NoSuchRepositoryException, SystemException {
601                    List<Repository> list = findByGroupId(groupId, 0, 1, orderByComparator);
602    
603                    if (list.isEmpty()) {
604                            StringBundler msg = new StringBundler(4);
605    
606                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
607    
608                            msg.append("groupId=");
609                            msg.append(groupId);
610    
611                            msg.append(StringPool.CLOSE_CURLY_BRACE);
612    
613                            throw new NoSuchRepositoryException(msg.toString());
614                    }
615                    else {
616                            return list.get(0);
617                    }
618            }
619    
620            /**
621             * Returns the last repository in the ordered set where groupId = &#63;.
622             *
623             * <p>
624             * 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.
625             * </p>
626             *
627             * @param groupId the group ID
628             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
629             * @return the last matching repository
630             * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
631             * @throws SystemException if a system exception occurred
632             */
633            public Repository findByGroupId_Last(long groupId,
634                    OrderByComparator orderByComparator)
635                    throws NoSuchRepositoryException, SystemException {
636                    int count = countByGroupId(groupId);
637    
638                    List<Repository> list = findByGroupId(groupId, count - 1, count,
639                                    orderByComparator);
640    
641                    if (list.isEmpty()) {
642                            StringBundler msg = new StringBundler(4);
643    
644                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
645    
646                            msg.append("groupId=");
647                            msg.append(groupId);
648    
649                            msg.append(StringPool.CLOSE_CURLY_BRACE);
650    
651                            throw new NoSuchRepositoryException(msg.toString());
652                    }
653                    else {
654                            return list.get(0);
655                    }
656            }
657    
658            /**
659             * Returns the repositories before and after the current repository in the ordered set where groupId = &#63;.
660             *
661             * <p>
662             * 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.
663             * </p>
664             *
665             * @param repositoryId the primary key of the current repository
666             * @param groupId the group ID
667             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
668             * @return the previous, current, and next repository
669             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
670             * @throws SystemException if a system exception occurred
671             */
672            public Repository[] findByGroupId_PrevAndNext(long repositoryId,
673                    long groupId, OrderByComparator orderByComparator)
674                    throws NoSuchRepositoryException, SystemException {
675                    Repository repository = findByPrimaryKey(repositoryId);
676    
677                    Session session = null;
678    
679                    try {
680                            session = openSession();
681    
682                            Repository[] array = new RepositoryImpl[3];
683    
684                            array[0] = getByGroupId_PrevAndNext(session, repository, groupId,
685                                            orderByComparator, true);
686    
687                            array[1] = repository;
688    
689                            array[2] = getByGroupId_PrevAndNext(session, repository, groupId,
690                                            orderByComparator, false);
691    
692                            return array;
693                    }
694                    catch (Exception e) {
695                            throw processException(e);
696                    }
697                    finally {
698                            closeSession(session);
699                    }
700            }
701    
702            protected Repository getByGroupId_PrevAndNext(Session session,
703                    Repository repository, long groupId,
704                    OrderByComparator orderByComparator, boolean previous) {
705                    StringBundler query = null;
706    
707                    if (orderByComparator != null) {
708                            query = new StringBundler(6 +
709                                            (orderByComparator.getOrderByFields().length * 6));
710                    }
711                    else {
712                            query = new StringBundler(3);
713                    }
714    
715                    query.append(_SQL_SELECT_REPOSITORY_WHERE);
716    
717                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
718    
719                    if (orderByComparator != null) {
720                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
721    
722                            if (orderByConditionFields.length > 0) {
723                                    query.append(WHERE_AND);
724                            }
725    
726                            for (int i = 0; i < orderByConditionFields.length; i++) {
727                                    query.append(_ORDER_BY_ENTITY_ALIAS);
728                                    query.append(orderByConditionFields[i]);
729    
730                                    if ((i + 1) < orderByConditionFields.length) {
731                                            if (orderByComparator.isAscending() ^ previous) {
732                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
733                                            }
734                                            else {
735                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
736                                            }
737                                    }
738                                    else {
739                                            if (orderByComparator.isAscending() ^ previous) {
740                                                    query.append(WHERE_GREATER_THAN);
741                                            }
742                                            else {
743                                                    query.append(WHERE_LESSER_THAN);
744                                            }
745                                    }
746                            }
747    
748                            query.append(ORDER_BY_CLAUSE);
749    
750                            String[] orderByFields = orderByComparator.getOrderByFields();
751    
752                            for (int i = 0; i < orderByFields.length; i++) {
753                                    query.append(_ORDER_BY_ENTITY_ALIAS);
754                                    query.append(orderByFields[i]);
755    
756                                    if ((i + 1) < orderByFields.length) {
757                                            if (orderByComparator.isAscending() ^ previous) {
758                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
759                                            }
760                                            else {
761                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
762                                            }
763                                    }
764                                    else {
765                                            if (orderByComparator.isAscending() ^ previous) {
766                                                    query.append(ORDER_BY_ASC);
767                                            }
768                                            else {
769                                                    query.append(ORDER_BY_DESC);
770                                            }
771                                    }
772                            }
773                    }
774    
775                    String sql = query.toString();
776    
777                    Query q = session.createQuery(sql);
778    
779                    q.setFirstResult(0);
780                    q.setMaxResults(2);
781    
782                    QueryPos qPos = QueryPos.getInstance(q);
783    
784                    qPos.add(groupId);
785    
786                    if (orderByComparator != null) {
787                            Object[] values = orderByComparator.getOrderByConditionValues(repository);
788    
789                            for (Object value : values) {
790                                    qPos.add(value);
791                            }
792                    }
793    
794                    List<Repository> list = q.list();
795    
796                    if (list.size() == 2) {
797                            return list.get(1);
798                    }
799                    else {
800                            return null;
801                    }
802            }
803    
804            /**
805             * Returns all the repositories.
806             *
807             * @return the repositories
808             * @throws SystemException if a system exception occurred
809             */
810            public List<Repository> findAll() throws SystemException {
811                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
812            }
813    
814            /**
815             * Returns a range of all the repositories.
816             *
817             * <p>
818             * 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.
819             * </p>
820             *
821             * @param start the lower bound of the range of repositories
822             * @param end the upper bound of the range of repositories (not inclusive)
823             * @return the range of repositories
824             * @throws SystemException if a system exception occurred
825             */
826            public List<Repository> findAll(int start, int end)
827                    throws SystemException {
828                    return findAll(start, end, null);
829            }
830    
831            /**
832             * Returns an ordered range of all the repositories.
833             *
834             * <p>
835             * 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.
836             * </p>
837             *
838             * @param start the lower bound of the range of repositories
839             * @param end the upper bound of the range of repositories (not inclusive)
840             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
841             * @return the ordered range of repositories
842             * @throws SystemException if a system exception occurred
843             */
844            public List<Repository> findAll(int start, int end,
845                    OrderByComparator orderByComparator) throws SystemException {
846                    FinderPath finderPath = null;
847                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
848    
849                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
850                                    (orderByComparator == null)) {
851                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
852                            finderArgs = FINDER_ARGS_EMPTY;
853                    }
854                    else {
855                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
856                            finderArgs = new Object[] { start, end, orderByComparator };
857                    }
858    
859                    List<Repository> list = (List<Repository>)FinderCacheUtil.getResult(finderPath,
860                                    finderArgs, this);
861    
862                    if (list == null) {
863                            StringBundler query = null;
864                            String sql = null;
865    
866                            if (orderByComparator != null) {
867                                    query = new StringBundler(2 +
868                                                    (orderByComparator.getOrderByFields().length * 3));
869    
870                                    query.append(_SQL_SELECT_REPOSITORY);
871    
872                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
873                                            orderByComparator);
874    
875                                    sql = query.toString();
876                            }
877                            else {
878                                    sql = _SQL_SELECT_REPOSITORY;
879                            }
880    
881                            Session session = null;
882    
883                            try {
884                                    session = openSession();
885    
886                                    Query q = session.createQuery(sql);
887    
888                                    if (orderByComparator == null) {
889                                            list = (List<Repository>)QueryUtil.list(q, getDialect(),
890                                                            start, end, false);
891    
892                                            Collections.sort(list);
893                                    }
894                                    else {
895                                            list = (List<Repository>)QueryUtil.list(q, getDialect(),
896                                                            start, end);
897                                    }
898                            }
899                            catch (Exception e) {
900                                    throw processException(e);
901                            }
902                            finally {
903                                    if (list == null) {
904                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
905                                    }
906                                    else {
907                                            cacheResult(list);
908    
909                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
910                                    }
911    
912                                    closeSession(session);
913                            }
914                    }
915    
916                    return list;
917            }
918    
919            /**
920             * Removes all the repositories where groupId = &#63; from the database.
921             *
922             * @param groupId the group ID
923             * @throws SystemException if a system exception occurred
924             */
925            public void removeByGroupId(long groupId) throws SystemException {
926                    for (Repository repository : findByGroupId(groupId)) {
927                            repositoryPersistence.remove(repository);
928                    }
929            }
930    
931            /**
932             * Removes all the repositories from the database.
933             *
934             * @throws SystemException if a system exception occurred
935             */
936            public void removeAll() throws SystemException {
937                    for (Repository repository : findAll()) {
938                            repositoryPersistence.remove(repository);
939                    }
940            }
941    
942            /**
943             * Returns the number of repositories where groupId = &#63;.
944             *
945             * @param groupId the group ID
946             * @return the number of matching repositories
947             * @throws SystemException if a system exception occurred
948             */
949            public int countByGroupId(long groupId) throws SystemException {
950                    Object[] finderArgs = new Object[] { groupId };
951    
952                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
953                                    finderArgs, this);
954    
955                    if (count == null) {
956                            StringBundler query = new StringBundler(2);
957    
958                            query.append(_SQL_COUNT_REPOSITORY_WHERE);
959    
960                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
961    
962                            String sql = query.toString();
963    
964                            Session session = null;
965    
966                            try {
967                                    session = openSession();
968    
969                                    Query q = session.createQuery(sql);
970    
971                                    QueryPos qPos = QueryPos.getInstance(q);
972    
973                                    qPos.add(groupId);
974    
975                                    count = (Long)q.uniqueResult();
976                            }
977                            catch (Exception e) {
978                                    throw processException(e);
979                            }
980                            finally {
981                                    if (count == null) {
982                                            count = Long.valueOf(0);
983                                    }
984    
985                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
986                                            finderArgs, count);
987    
988                                    closeSession(session);
989                            }
990                    }
991    
992                    return count.intValue();
993            }
994    
995            /**
996             * Returns the number of repositories.
997             *
998             * @return the number of repositories
999             * @throws SystemException if a system exception occurred
1000             */
1001            public int countAll() throws SystemException {
1002                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1003                                    FINDER_ARGS_EMPTY, this);
1004    
1005                    if (count == null) {
1006                            Session session = null;
1007    
1008                            try {
1009                                    session = openSession();
1010    
1011                                    Query q = session.createQuery(_SQL_COUNT_REPOSITORY);
1012    
1013                                    count = (Long)q.uniqueResult();
1014                            }
1015                            catch (Exception e) {
1016                                    throw processException(e);
1017                            }
1018                            finally {
1019                                    if (count == null) {
1020                                            count = Long.valueOf(0);
1021                                    }
1022    
1023                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1024                                            FINDER_ARGS_EMPTY, count);
1025    
1026                                    closeSession(session);
1027                            }
1028                    }
1029    
1030                    return count.intValue();
1031            }
1032    
1033            /**
1034             * Initializes the repository persistence.
1035             */
1036            public void afterPropertiesSet() {
1037                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1038                                            com.liferay.portal.util.PropsUtil.get(
1039                                                    "value.object.listener.com.liferay.portal.model.Repository")));
1040    
1041                    if (listenerClassNames.length > 0) {
1042                            try {
1043                                    List<ModelListener<Repository>> listenersList = new ArrayList<ModelListener<Repository>>();
1044    
1045                                    for (String listenerClassName : listenerClassNames) {
1046                                            listenersList.add((ModelListener<Repository>)InstanceFactory.newInstance(
1047                                                            listenerClassName));
1048                                    }
1049    
1050                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1051                            }
1052                            catch (Exception e) {
1053                                    _log.error(e);
1054                            }
1055                    }
1056            }
1057    
1058            public void destroy() {
1059                    EntityCacheUtil.removeCache(RepositoryImpl.class.getName());
1060                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1061                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1062            }
1063    
1064            @BeanReference(type = AccountPersistence.class)
1065            protected AccountPersistence accountPersistence;
1066            @BeanReference(type = AddressPersistence.class)
1067            protected AddressPersistence addressPersistence;
1068            @BeanReference(type = BrowserTrackerPersistence.class)
1069            protected BrowserTrackerPersistence browserTrackerPersistence;
1070            @BeanReference(type = ClassNamePersistence.class)
1071            protected ClassNamePersistence classNamePersistence;
1072            @BeanReference(type = ClusterGroupPersistence.class)
1073            protected ClusterGroupPersistence clusterGroupPersistence;
1074            @BeanReference(type = CompanyPersistence.class)
1075            protected CompanyPersistence companyPersistence;
1076            @BeanReference(type = ContactPersistence.class)
1077            protected ContactPersistence contactPersistence;
1078            @BeanReference(type = CountryPersistence.class)
1079            protected CountryPersistence countryPersistence;
1080            @BeanReference(type = EmailAddressPersistence.class)
1081            protected EmailAddressPersistence emailAddressPersistence;
1082            @BeanReference(type = GroupPersistence.class)
1083            protected GroupPersistence groupPersistence;
1084            @BeanReference(type = ImagePersistence.class)
1085            protected ImagePersistence imagePersistence;
1086            @BeanReference(type = LayoutPersistence.class)
1087            protected LayoutPersistence layoutPersistence;
1088            @BeanReference(type = LayoutBranchPersistence.class)
1089            protected LayoutBranchPersistence layoutBranchPersistence;
1090            @BeanReference(type = LayoutPrototypePersistence.class)
1091            protected LayoutPrototypePersistence layoutPrototypePersistence;
1092            @BeanReference(type = LayoutRevisionPersistence.class)
1093            protected LayoutRevisionPersistence layoutRevisionPersistence;
1094            @BeanReference(type = LayoutSetPersistence.class)
1095            protected LayoutSetPersistence layoutSetPersistence;
1096            @BeanReference(type = LayoutSetBranchPersistence.class)
1097            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1098            @BeanReference(type = LayoutSetPrototypePersistence.class)
1099            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1100            @BeanReference(type = ListTypePersistence.class)
1101            protected ListTypePersistence listTypePersistence;
1102            @BeanReference(type = LockPersistence.class)
1103            protected LockPersistence lockPersistence;
1104            @BeanReference(type = MembershipRequestPersistence.class)
1105            protected MembershipRequestPersistence membershipRequestPersistence;
1106            @BeanReference(type = OrganizationPersistence.class)
1107            protected OrganizationPersistence organizationPersistence;
1108            @BeanReference(type = OrgGroupPermissionPersistence.class)
1109            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1110            @BeanReference(type = OrgGroupRolePersistence.class)
1111            protected OrgGroupRolePersistence orgGroupRolePersistence;
1112            @BeanReference(type = OrgLaborPersistence.class)
1113            protected OrgLaborPersistence orgLaborPersistence;
1114            @BeanReference(type = PasswordPolicyPersistence.class)
1115            protected PasswordPolicyPersistence passwordPolicyPersistence;
1116            @BeanReference(type = PasswordPolicyRelPersistence.class)
1117            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1118            @BeanReference(type = PasswordTrackerPersistence.class)
1119            protected PasswordTrackerPersistence passwordTrackerPersistence;
1120            @BeanReference(type = PermissionPersistence.class)
1121            protected PermissionPersistence permissionPersistence;
1122            @BeanReference(type = PhonePersistence.class)
1123            protected PhonePersistence phonePersistence;
1124            @BeanReference(type = PluginSettingPersistence.class)
1125            protected PluginSettingPersistence pluginSettingPersistence;
1126            @BeanReference(type = PortalPreferencesPersistence.class)
1127            protected PortalPreferencesPersistence portalPreferencesPersistence;
1128            @BeanReference(type = PortletPersistence.class)
1129            protected PortletPersistence portletPersistence;
1130            @BeanReference(type = PortletItemPersistence.class)
1131            protected PortletItemPersistence portletItemPersistence;
1132            @BeanReference(type = PortletPreferencesPersistence.class)
1133            protected PortletPreferencesPersistence portletPreferencesPersistence;
1134            @BeanReference(type = RegionPersistence.class)
1135            protected RegionPersistence regionPersistence;
1136            @BeanReference(type = ReleasePersistence.class)
1137            protected ReleasePersistence releasePersistence;
1138            @BeanReference(type = RepositoryPersistence.class)
1139            protected RepositoryPersistence repositoryPersistence;
1140            @BeanReference(type = RepositoryEntryPersistence.class)
1141            protected RepositoryEntryPersistence repositoryEntryPersistence;
1142            @BeanReference(type = ResourcePersistence.class)
1143            protected ResourcePersistence resourcePersistence;
1144            @BeanReference(type = ResourceActionPersistence.class)
1145            protected ResourceActionPersistence resourceActionPersistence;
1146            @BeanReference(type = ResourceBlockPersistence.class)
1147            protected ResourceBlockPersistence resourceBlockPersistence;
1148            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1149            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1150            @BeanReference(type = ResourceCodePersistence.class)
1151            protected ResourceCodePersistence resourceCodePersistence;
1152            @BeanReference(type = ResourcePermissionPersistence.class)
1153            protected ResourcePermissionPersistence resourcePermissionPersistence;
1154            @BeanReference(type = ResourceTypePermissionPersistence.class)
1155            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1156            @BeanReference(type = RolePersistence.class)
1157            protected RolePersistence rolePersistence;
1158            @BeanReference(type = ServiceComponentPersistence.class)
1159            protected ServiceComponentPersistence serviceComponentPersistence;
1160            @BeanReference(type = ShardPersistence.class)
1161            protected ShardPersistence shardPersistence;
1162            @BeanReference(type = SubscriptionPersistence.class)
1163            protected SubscriptionPersistence subscriptionPersistence;
1164            @BeanReference(type = TeamPersistence.class)
1165            protected TeamPersistence teamPersistence;
1166            @BeanReference(type = TicketPersistence.class)
1167            protected TicketPersistence ticketPersistence;
1168            @BeanReference(type = UserPersistence.class)
1169            protected UserPersistence userPersistence;
1170            @BeanReference(type = UserGroupPersistence.class)
1171            protected UserGroupPersistence userGroupPersistence;
1172            @BeanReference(type = UserGroupGroupRolePersistence.class)
1173            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1174            @BeanReference(type = UserGroupRolePersistence.class)
1175            protected UserGroupRolePersistence userGroupRolePersistence;
1176            @BeanReference(type = UserIdMapperPersistence.class)
1177            protected UserIdMapperPersistence userIdMapperPersistence;
1178            @BeanReference(type = UserNotificationEventPersistence.class)
1179            protected UserNotificationEventPersistence userNotificationEventPersistence;
1180            @BeanReference(type = UserTrackerPersistence.class)
1181            protected UserTrackerPersistence userTrackerPersistence;
1182            @BeanReference(type = UserTrackerPathPersistence.class)
1183            protected UserTrackerPathPersistence userTrackerPathPersistence;
1184            @BeanReference(type = VirtualHostPersistence.class)
1185            protected VirtualHostPersistence virtualHostPersistence;
1186            @BeanReference(type = WebDAVPropsPersistence.class)
1187            protected WebDAVPropsPersistence webDAVPropsPersistence;
1188            @BeanReference(type = WebsitePersistence.class)
1189            protected WebsitePersistence websitePersistence;
1190            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1191            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1192            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1193            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1194            @BeanReference(type = AssetEntryPersistence.class)
1195            protected AssetEntryPersistence assetEntryPersistence;
1196            @BeanReference(type = DLFileEntryPersistence.class)
1197            protected DLFileEntryPersistence dlFileEntryPersistence;
1198            @BeanReference(type = DLFileVersionPersistence.class)
1199            protected DLFileVersionPersistence dlFileVersionPersistence;
1200            @BeanReference(type = DLFolderPersistence.class)
1201            protected DLFolderPersistence dlFolderPersistence;
1202            @BeanReference(type = ExpandoValuePersistence.class)
1203            protected ExpandoValuePersistence expandoValuePersistence;
1204            private static final String _SQL_SELECT_REPOSITORY = "SELECT repository FROM Repository repository";
1205            private static final String _SQL_SELECT_REPOSITORY_WHERE = "SELECT repository FROM Repository repository WHERE ";
1206            private static final String _SQL_COUNT_REPOSITORY = "SELECT COUNT(repository) FROM Repository repository";
1207            private static final String _SQL_COUNT_REPOSITORY_WHERE = "SELECT COUNT(repository) FROM Repository repository WHERE ";
1208            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "repository.groupId = ?";
1209            private static final String _ORDER_BY_ENTITY_ALIAS = "repository.";
1210            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Repository exists with the primary key ";
1211            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Repository exists with the key {";
1212            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1213            private static Log _log = LogFactoryUtil.getLog(RepositoryPersistenceImpl.class);
1214            private static Repository _nullRepository = new RepositoryImpl() {
1215                            @Override
1216                            public Object clone() {
1217                                    return this;
1218                            }
1219    
1220                            @Override
1221                            public CacheModel<Repository> toCacheModel() {
1222                                    return _nullRepositoryCacheModel;
1223                            }
1224                    };
1225    
1226            private static CacheModel<Repository> _nullRepositoryCacheModel = new CacheModel<Repository>() {
1227                            public Repository toEntityModel() {
1228                                    return _nullRepository;
1229                            }
1230                    };
1231    }