001    /**
002     * Copyright (c) 2000-2012 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.kernel.util.Validator;
038    import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039    import com.liferay.portal.model.CacheModel;
040    import com.liferay.portal.model.ModelListener;
041    import com.liferay.portal.model.Repository;
042    import com.liferay.portal.model.impl.RepositoryImpl;
043    import com.liferay.portal.model.impl.RepositoryModelImpl;
044    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
045    
046    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
047    import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistence;
048    import com.liferay.portlet.documentlibrary.service.persistence.DLFileVersionPersistence;
049    import com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence;
050    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
051    
052    import java.io.Serializable;
053    
054    import java.util.ArrayList;
055    import java.util.Collections;
056    import java.util.List;
057    
058    /**
059     * The persistence implementation for the repository service.
060     *
061     * <p>
062     * Caching information and settings can be found in <code>portal.properties</code>
063     * </p>
064     *
065     * @author Brian Wing Shun Chan
066     * @see RepositoryPersistence
067     * @see RepositoryUtil
068     * @generated
069     */
070    public class RepositoryPersistenceImpl extends BasePersistenceImpl<Repository>
071            implements RepositoryPersistence {
072            /*
073             * NOTE FOR DEVELOPERS:
074             *
075             * 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.
076             */
077            public static final String FINDER_CLASS_NAME_ENTITY = RepositoryImpl.class.getName();
078            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
079                    ".List1";
080            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
081                    ".List2";
082            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
083                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
084                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
085                            new String[] {
086                                    String.class.getName(),
087                                    
088                            "java.lang.Integer", "java.lang.Integer",
089                                    "com.liferay.portal.kernel.util.OrderByComparator"
090                            });
091            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
092                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
093                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
094                            new String[] { String.class.getName() },
095                            RepositoryModelImpl.UUID_COLUMN_BITMASK);
096            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
097                            RepositoryModelImpl.FINDER_CACHE_ENABLED, Long.class,
098                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
099                            new String[] { String.class.getName() });
100            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
101                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
102                            FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
103                            new String[] { String.class.getName(), Long.class.getName() },
104                            RepositoryModelImpl.UUID_COLUMN_BITMASK |
105                            RepositoryModelImpl.GROUPID_COLUMN_BITMASK);
106            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
107                            RepositoryModelImpl.FINDER_CACHE_ENABLED, Long.class,
108                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
109                            new String[] { String.class.getName(), Long.class.getName() });
110            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
111                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
112                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
113                            new String[] {
114                                    Long.class.getName(),
115                                    
116                            "java.lang.Integer", "java.lang.Integer",
117                                    "com.liferay.portal.kernel.util.OrderByComparator"
118                            });
119            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
120                    new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
121                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
122                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
123                            new String[] { Long.class.getName() },
124                            RepositoryModelImpl.GROUPID_COLUMN_BITMASK);
125            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
126                            RepositoryModelImpl.FINDER_CACHE_ENABLED, Long.class,
127                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
128                            new String[] { Long.class.getName() });
129            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
130                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
131                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
132            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
133                            RepositoryModelImpl.FINDER_CACHE_ENABLED, RepositoryImpl.class,
134                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
135            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
136                            RepositoryModelImpl.FINDER_CACHE_ENABLED, Long.class,
137                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
138    
139            /**
140             * Caches the repository in the entity cache if it is enabled.
141             *
142             * @param repository the repository
143             */
144            public void cacheResult(Repository repository) {
145                    EntityCacheUtil.putResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
146                            RepositoryImpl.class, repository.getPrimaryKey(), repository);
147    
148                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
149                            new Object[] {
150                                    repository.getUuid(), Long.valueOf(repository.getGroupId())
151                            }, repository);
152    
153                    repository.resetOriginalValues();
154            }
155    
156            /**
157             * Caches the repositories in the entity cache if it is enabled.
158             *
159             * @param repositories the repositories
160             */
161            public void cacheResult(List<Repository> repositories) {
162                    for (Repository repository : repositories) {
163                            if (EntityCacheUtil.getResult(
164                                                    RepositoryModelImpl.ENTITY_CACHE_ENABLED,
165                                                    RepositoryImpl.class, repository.getPrimaryKey()) == null) {
166                                    cacheResult(repository);
167                            }
168                            else {
169                                    repository.resetOriginalValues();
170                            }
171                    }
172            }
173    
174            /**
175             * Clears the cache for all repositories.
176             *
177             * <p>
178             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
179             * </p>
180             */
181            @Override
182            public void clearCache() {
183                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
184                            CacheRegistryUtil.clear(RepositoryImpl.class.getName());
185                    }
186    
187                    EntityCacheUtil.clearCache(RepositoryImpl.class.getName());
188    
189                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
190                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
191                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
192            }
193    
194            /**
195             * Clears the cache for the repository.
196             *
197             * <p>
198             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
199             * </p>
200             */
201            @Override
202            public void clearCache(Repository repository) {
203                    EntityCacheUtil.removeResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
204                            RepositoryImpl.class, repository.getPrimaryKey());
205    
206                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
207                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
208    
209                    clearUniqueFindersCache(repository);
210            }
211    
212            @Override
213            public void clearCache(List<Repository> repositories) {
214                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
215                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
216    
217                    for (Repository repository : repositories) {
218                            EntityCacheUtil.removeResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
219                                    RepositoryImpl.class, repository.getPrimaryKey());
220    
221                            clearUniqueFindersCache(repository);
222                    }
223            }
224    
225            protected void clearUniqueFindersCache(Repository repository) {
226                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
227                            new Object[] {
228                                    repository.getUuid(), Long.valueOf(repository.getGroupId())
229                            });
230            }
231    
232            /**
233             * Creates a new repository with the primary key. Does not add the repository to the database.
234             *
235             * @param repositoryId the primary key for the new repository
236             * @return the new repository
237             */
238            public Repository create(long repositoryId) {
239                    Repository repository = new RepositoryImpl();
240    
241                    repository.setNew(true);
242                    repository.setPrimaryKey(repositoryId);
243    
244                    String uuid = PortalUUIDUtil.generate();
245    
246                    repository.setUuid(uuid);
247    
248                    return repository;
249            }
250    
251            /**
252             * Removes the repository with the primary key from the database. Also notifies the appropriate model listeners.
253             *
254             * @param repositoryId the primary key of the repository
255             * @return the repository that was removed
256             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
257             * @throws SystemException if a system exception occurred
258             */
259            public Repository remove(long repositoryId)
260                    throws NoSuchRepositoryException, SystemException {
261                    return remove(Long.valueOf(repositoryId));
262            }
263    
264            /**
265             * Removes the repository with the primary key from the database. Also notifies the appropriate model listeners.
266             *
267             * @param primaryKey the primary key of the repository
268             * @return the repository that was removed
269             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
270             * @throws SystemException if a system exception occurred
271             */
272            @Override
273            public Repository remove(Serializable primaryKey)
274                    throws NoSuchRepositoryException, SystemException {
275                    Session session = null;
276    
277                    try {
278                            session = openSession();
279    
280                            Repository repository = (Repository)session.get(RepositoryImpl.class,
281                                            primaryKey);
282    
283                            if (repository == null) {
284                                    if (_log.isWarnEnabled()) {
285                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
286                                    }
287    
288                                    throw new NoSuchRepositoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
289                                            primaryKey);
290                            }
291    
292                            return remove(repository);
293                    }
294                    catch (NoSuchRepositoryException nsee) {
295                            throw nsee;
296                    }
297                    catch (Exception e) {
298                            throw processException(e);
299                    }
300                    finally {
301                            closeSession(session);
302                    }
303            }
304    
305            @Override
306            protected Repository removeImpl(Repository repository)
307                    throws SystemException {
308                    repository = toUnwrappedModel(repository);
309    
310                    Session session = null;
311    
312                    try {
313                            session = openSession();
314    
315                            BatchSessionUtil.delete(session, repository);
316                    }
317                    catch (Exception e) {
318                            throw processException(e);
319                    }
320                    finally {
321                            closeSession(session);
322                    }
323    
324                    clearCache(repository);
325    
326                    return repository;
327            }
328    
329            @Override
330            public Repository updateImpl(
331                    com.liferay.portal.model.Repository repository, boolean merge)
332                    throws SystemException {
333                    repository = toUnwrappedModel(repository);
334    
335                    boolean isNew = repository.isNew();
336    
337                    RepositoryModelImpl repositoryModelImpl = (RepositoryModelImpl)repository;
338    
339                    if (Validator.isNull(repository.getUuid())) {
340                            String uuid = PortalUUIDUtil.generate();
341    
342                            repository.setUuid(uuid);
343                    }
344    
345                    Session session = null;
346    
347                    try {
348                            session = openSession();
349    
350                            BatchSessionUtil.update(session, repository, merge);
351    
352                            repository.setNew(false);
353                    }
354                    catch (Exception e) {
355                            throw processException(e);
356                    }
357                    finally {
358                            closeSession(session);
359                    }
360    
361                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
362    
363                    if (isNew || !RepositoryModelImpl.COLUMN_BITMASK_ENABLED) {
364                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
365                    }
366    
367                    else {
368                            if ((repositoryModelImpl.getColumnBitmask() &
369                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
370                                    Object[] args = new Object[] {
371                                                    repositoryModelImpl.getOriginalUuid()
372                                            };
373    
374                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
375                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
376                                            args);
377    
378                                    args = new Object[] { repositoryModelImpl.getUuid() };
379    
380                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
381                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
382                                            args);
383                            }
384    
385                            if ((repositoryModelImpl.getColumnBitmask() &
386                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
387                                    Object[] args = new Object[] {
388                                                    Long.valueOf(repositoryModelImpl.getOriginalGroupId())
389                                            };
390    
391                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
392                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
393                                            args);
394    
395                                    args = new Object[] {
396                                                    Long.valueOf(repositoryModelImpl.getGroupId())
397                                            };
398    
399                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
400                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
401                                            args);
402                            }
403                    }
404    
405                    EntityCacheUtil.putResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
406                            RepositoryImpl.class, repository.getPrimaryKey(), repository);
407    
408                    if (isNew) {
409                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
410                                    new Object[] {
411                                            repository.getUuid(), Long.valueOf(repository.getGroupId())
412                                    }, repository);
413                    }
414                    else {
415                            if ((repositoryModelImpl.getColumnBitmask() &
416                                            FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
417                                    Object[] args = new Object[] {
418                                                    repositoryModelImpl.getOriginalUuid(),
419                                                    Long.valueOf(repositoryModelImpl.getOriginalGroupId())
420                                            };
421    
422                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
423    
424                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
425    
426                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
427                                            new Object[] {
428                                                    repository.getUuid(),
429                                                    Long.valueOf(repository.getGroupId())
430                                            }, repository);
431                            }
432                    }
433    
434                    return repository;
435            }
436    
437            protected Repository toUnwrappedModel(Repository repository) {
438                    if (repository instanceof RepositoryImpl) {
439                            return repository;
440                    }
441    
442                    RepositoryImpl repositoryImpl = new RepositoryImpl();
443    
444                    repositoryImpl.setNew(repository.isNew());
445                    repositoryImpl.setPrimaryKey(repository.getPrimaryKey());
446    
447                    repositoryImpl.setUuid(repository.getUuid());
448                    repositoryImpl.setRepositoryId(repository.getRepositoryId());
449                    repositoryImpl.setGroupId(repository.getGroupId());
450                    repositoryImpl.setCompanyId(repository.getCompanyId());
451                    repositoryImpl.setUserId(repository.getUserId());
452                    repositoryImpl.setUserName(repository.getUserName());
453                    repositoryImpl.setCreateDate(repository.getCreateDate());
454                    repositoryImpl.setModifiedDate(repository.getModifiedDate());
455                    repositoryImpl.setClassNameId(repository.getClassNameId());
456                    repositoryImpl.setName(repository.getName());
457                    repositoryImpl.setDescription(repository.getDescription());
458                    repositoryImpl.setPortletId(repository.getPortletId());
459                    repositoryImpl.setTypeSettings(repository.getTypeSettings());
460                    repositoryImpl.setDlFolderId(repository.getDlFolderId());
461    
462                    return repositoryImpl;
463            }
464    
465            /**
466             * Returns the repository with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
467             *
468             * @param primaryKey the primary key of the repository
469             * @return the repository
470             * @throws com.liferay.portal.NoSuchModelException if a repository with the primary key could not be found
471             * @throws SystemException if a system exception occurred
472             */
473            @Override
474            public Repository findByPrimaryKey(Serializable primaryKey)
475                    throws NoSuchModelException, SystemException {
476                    return findByPrimaryKey(((Long)primaryKey).longValue());
477            }
478    
479            /**
480             * Returns the repository with the primary key or throws a {@link com.liferay.portal.NoSuchRepositoryException} if it could not be found.
481             *
482             * @param repositoryId the primary key of the repository
483             * @return the repository
484             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
485             * @throws SystemException if a system exception occurred
486             */
487            public Repository findByPrimaryKey(long repositoryId)
488                    throws NoSuchRepositoryException, SystemException {
489                    Repository repository = fetchByPrimaryKey(repositoryId);
490    
491                    if (repository == null) {
492                            if (_log.isWarnEnabled()) {
493                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + repositoryId);
494                            }
495    
496                            throw new NoSuchRepositoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
497                                    repositoryId);
498                    }
499    
500                    return repository;
501            }
502    
503            /**
504             * Returns the repository with the primary key or returns <code>null</code> if it could not be found.
505             *
506             * @param primaryKey the primary key of the repository
507             * @return the repository, or <code>null</code> if a repository with the primary key could not be found
508             * @throws SystemException if a system exception occurred
509             */
510            @Override
511            public Repository fetchByPrimaryKey(Serializable primaryKey)
512                    throws SystemException {
513                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
514            }
515    
516            /**
517             * Returns the repository with the primary key or returns <code>null</code> if it could not be found.
518             *
519             * @param repositoryId the primary key of the repository
520             * @return the repository, or <code>null</code> if a repository with the primary key could not be found
521             * @throws SystemException if a system exception occurred
522             */
523            public Repository fetchByPrimaryKey(long repositoryId)
524                    throws SystemException {
525                    Repository repository = (Repository)EntityCacheUtil.getResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
526                                    RepositoryImpl.class, repositoryId);
527    
528                    if (repository == _nullRepository) {
529                            return null;
530                    }
531    
532                    if (repository == null) {
533                            Session session = null;
534    
535                            boolean hasException = false;
536    
537                            try {
538                                    session = openSession();
539    
540                                    repository = (Repository)session.get(RepositoryImpl.class,
541                                                    Long.valueOf(repositoryId));
542                            }
543                            catch (Exception e) {
544                                    hasException = true;
545    
546                                    throw processException(e);
547                            }
548                            finally {
549                                    if (repository != null) {
550                                            cacheResult(repository);
551                                    }
552                                    else if (!hasException) {
553                                            EntityCacheUtil.putResult(RepositoryModelImpl.ENTITY_CACHE_ENABLED,
554                                                    RepositoryImpl.class, repositoryId, _nullRepository);
555                                    }
556    
557                                    closeSession(session);
558                            }
559                    }
560    
561                    return repository;
562            }
563    
564            /**
565             * Returns all the repositories where uuid = &#63;.
566             *
567             * @param uuid the uuid
568             * @return the matching repositories
569             * @throws SystemException if a system exception occurred
570             */
571            public List<Repository> findByUuid(String uuid) throws SystemException {
572                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
573            }
574    
575            /**
576             * Returns a range of all the repositories where uuid = &#63;.
577             *
578             * <p>
579             * 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.
580             * </p>
581             *
582             * @param uuid the uuid
583             * @param start the lower bound of the range of repositories
584             * @param end the upper bound of the range of repositories (not inclusive)
585             * @return the range of matching repositories
586             * @throws SystemException if a system exception occurred
587             */
588            public List<Repository> findByUuid(String uuid, int start, int end)
589                    throws SystemException {
590                    return findByUuid(uuid, start, end, null);
591            }
592    
593            /**
594             * Returns an ordered range of all the repositories where uuid = &#63;.
595             *
596             * <p>
597             * 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.
598             * </p>
599             *
600             * @param uuid the uuid
601             * @param start the lower bound of the range of repositories
602             * @param end the upper bound of the range of repositories (not inclusive)
603             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
604             * @return the ordered range of matching repositories
605             * @throws SystemException if a system exception occurred
606             */
607            public List<Repository> findByUuid(String uuid, int start, int end,
608                    OrderByComparator orderByComparator) throws SystemException {
609                    FinderPath finderPath = null;
610                    Object[] finderArgs = null;
611    
612                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
613                                    (orderByComparator == null)) {
614                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
615                            finderArgs = new Object[] { uuid };
616                    }
617                    else {
618                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
619                            finderArgs = new Object[] { uuid, start, end, orderByComparator };
620                    }
621    
622                    List<Repository> list = (List<Repository>)FinderCacheUtil.getResult(finderPath,
623                                    finderArgs, this);
624    
625                    if ((list != null) && !list.isEmpty()) {
626                            for (Repository repository : list) {
627                                    if (!Validator.equals(uuid, repository.getUuid())) {
628                                            list = null;
629    
630                                            break;
631                                    }
632                            }
633                    }
634    
635                    if (list == null) {
636                            StringBundler query = null;
637    
638                            if (orderByComparator != null) {
639                                    query = new StringBundler(3 +
640                                                    (orderByComparator.getOrderByFields().length * 3));
641                            }
642                            else {
643                                    query = new StringBundler(2);
644                            }
645    
646                            query.append(_SQL_SELECT_REPOSITORY_WHERE);
647    
648                            if (uuid == null) {
649                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
650                            }
651                            else {
652                                    if (uuid.equals(StringPool.BLANK)) {
653                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
654                                    }
655                                    else {
656                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
657                                    }
658                            }
659    
660                            if (orderByComparator != null) {
661                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
662                                            orderByComparator);
663                            }
664    
665                            String sql = query.toString();
666    
667                            Session session = null;
668    
669                            try {
670                                    session = openSession();
671    
672                                    Query q = session.createQuery(sql);
673    
674                                    QueryPos qPos = QueryPos.getInstance(q);
675    
676                                    if (uuid != null) {
677                                            qPos.add(uuid);
678                                    }
679    
680                                    list = (List<Repository>)QueryUtil.list(q, getDialect(), start,
681                                                    end);
682                            }
683                            catch (Exception e) {
684                                    throw processException(e);
685                            }
686                            finally {
687                                    if (list == null) {
688                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
689                                    }
690                                    else {
691                                            cacheResult(list);
692    
693                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
694                                    }
695    
696                                    closeSession(session);
697                            }
698                    }
699    
700                    return list;
701            }
702    
703            /**
704             * Returns the first repository in the ordered set where uuid = &#63;.
705             *
706             * @param uuid the uuid
707             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
708             * @return the first matching repository
709             * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
710             * @throws SystemException if a system exception occurred
711             */
712            public Repository findByUuid_First(String uuid,
713                    OrderByComparator orderByComparator)
714                    throws NoSuchRepositoryException, SystemException {
715                    Repository repository = fetchByUuid_First(uuid, orderByComparator);
716    
717                    if (repository != null) {
718                            return repository;
719                    }
720    
721                    StringBundler msg = new StringBundler(4);
722    
723                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
724    
725                    msg.append("uuid=");
726                    msg.append(uuid);
727    
728                    msg.append(StringPool.CLOSE_CURLY_BRACE);
729    
730                    throw new NoSuchRepositoryException(msg.toString());
731            }
732    
733            /**
734             * Returns the first repository in the ordered set where uuid = &#63;.
735             *
736             * @param uuid the uuid
737             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
738             * @return the first matching repository, or <code>null</code> if a matching repository could not be found
739             * @throws SystemException if a system exception occurred
740             */
741            public Repository fetchByUuid_First(String uuid,
742                    OrderByComparator orderByComparator) throws SystemException {
743                    List<Repository> list = findByUuid(uuid, 0, 1, orderByComparator);
744    
745                    if (!list.isEmpty()) {
746                            return list.get(0);
747                    }
748    
749                    return null;
750            }
751    
752            /**
753             * Returns the last repository in the ordered set where uuid = &#63;.
754             *
755             * @param uuid the uuid
756             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
757             * @return the last matching repository
758             * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
759             * @throws SystemException if a system exception occurred
760             */
761            public Repository findByUuid_Last(String uuid,
762                    OrderByComparator orderByComparator)
763                    throws NoSuchRepositoryException, SystemException {
764                    Repository repository = fetchByUuid_Last(uuid, orderByComparator);
765    
766                    if (repository != null) {
767                            return repository;
768                    }
769    
770                    StringBundler msg = new StringBundler(4);
771    
772                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
773    
774                    msg.append("uuid=");
775                    msg.append(uuid);
776    
777                    msg.append(StringPool.CLOSE_CURLY_BRACE);
778    
779                    throw new NoSuchRepositoryException(msg.toString());
780            }
781    
782            /**
783             * Returns the last repository in the ordered set where uuid = &#63;.
784             *
785             * @param uuid the uuid
786             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
787             * @return the last matching repository, or <code>null</code> if a matching repository could not be found
788             * @throws SystemException if a system exception occurred
789             */
790            public Repository fetchByUuid_Last(String uuid,
791                    OrderByComparator orderByComparator) throws SystemException {
792                    int count = countByUuid(uuid);
793    
794                    List<Repository> list = findByUuid(uuid, count - 1, count,
795                                    orderByComparator);
796    
797                    if (!list.isEmpty()) {
798                            return list.get(0);
799                    }
800    
801                    return null;
802            }
803    
804            /**
805             * Returns the repositories before and after the current repository in the ordered set where uuid = &#63;.
806             *
807             * @param repositoryId the primary key of the current repository
808             * @param uuid the uuid
809             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
810             * @return the previous, current, and next repository
811             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
812             * @throws SystemException if a system exception occurred
813             */
814            public Repository[] findByUuid_PrevAndNext(long repositoryId, String uuid,
815                    OrderByComparator orderByComparator)
816                    throws NoSuchRepositoryException, SystemException {
817                    Repository repository = findByPrimaryKey(repositoryId);
818    
819                    Session session = null;
820    
821                    try {
822                            session = openSession();
823    
824                            Repository[] array = new RepositoryImpl[3];
825    
826                            array[0] = getByUuid_PrevAndNext(session, repository, uuid,
827                                            orderByComparator, true);
828    
829                            array[1] = repository;
830    
831                            array[2] = getByUuid_PrevAndNext(session, repository, uuid,
832                                            orderByComparator, false);
833    
834                            return array;
835                    }
836                    catch (Exception e) {
837                            throw processException(e);
838                    }
839                    finally {
840                            closeSession(session);
841                    }
842            }
843    
844            protected Repository getByUuid_PrevAndNext(Session session,
845                    Repository repository, String uuid,
846                    OrderByComparator orderByComparator, boolean previous) {
847                    StringBundler query = null;
848    
849                    if (orderByComparator != null) {
850                            query = new StringBundler(6 +
851                                            (orderByComparator.getOrderByFields().length * 6));
852                    }
853                    else {
854                            query = new StringBundler(3);
855                    }
856    
857                    query.append(_SQL_SELECT_REPOSITORY_WHERE);
858    
859                    if (uuid == null) {
860                            query.append(_FINDER_COLUMN_UUID_UUID_1);
861                    }
862                    else {
863                            if (uuid.equals(StringPool.BLANK)) {
864                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
865                            }
866                            else {
867                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
868                            }
869                    }
870    
871                    if (orderByComparator != null) {
872                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
873    
874                            if (orderByConditionFields.length > 0) {
875                                    query.append(WHERE_AND);
876                            }
877    
878                            for (int i = 0; i < orderByConditionFields.length; i++) {
879                                    query.append(_ORDER_BY_ENTITY_ALIAS);
880                                    query.append(orderByConditionFields[i]);
881    
882                                    if ((i + 1) < orderByConditionFields.length) {
883                                            if (orderByComparator.isAscending() ^ previous) {
884                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
885                                            }
886                                            else {
887                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
888                                            }
889                                    }
890                                    else {
891                                            if (orderByComparator.isAscending() ^ previous) {
892                                                    query.append(WHERE_GREATER_THAN);
893                                            }
894                                            else {
895                                                    query.append(WHERE_LESSER_THAN);
896                                            }
897                                    }
898                            }
899    
900                            query.append(ORDER_BY_CLAUSE);
901    
902                            String[] orderByFields = orderByComparator.getOrderByFields();
903    
904                            for (int i = 0; i < orderByFields.length; i++) {
905                                    query.append(_ORDER_BY_ENTITY_ALIAS);
906                                    query.append(orderByFields[i]);
907    
908                                    if ((i + 1) < orderByFields.length) {
909                                            if (orderByComparator.isAscending() ^ previous) {
910                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
911                                            }
912                                            else {
913                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
914                                            }
915                                    }
916                                    else {
917                                            if (orderByComparator.isAscending() ^ previous) {
918                                                    query.append(ORDER_BY_ASC);
919                                            }
920                                            else {
921                                                    query.append(ORDER_BY_DESC);
922                                            }
923                                    }
924                            }
925                    }
926    
927                    String sql = query.toString();
928    
929                    Query q = session.createQuery(sql);
930    
931                    q.setFirstResult(0);
932                    q.setMaxResults(2);
933    
934                    QueryPos qPos = QueryPos.getInstance(q);
935    
936                    if (uuid != null) {
937                            qPos.add(uuid);
938                    }
939    
940                    if (orderByComparator != null) {
941                            Object[] values = orderByComparator.getOrderByConditionValues(repository);
942    
943                            for (Object value : values) {
944                                    qPos.add(value);
945                            }
946                    }
947    
948                    List<Repository> list = q.list();
949    
950                    if (list.size() == 2) {
951                            return list.get(1);
952                    }
953                    else {
954                            return null;
955                    }
956            }
957    
958            /**
959             * Returns the repository where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portal.NoSuchRepositoryException} if it could not be found.
960             *
961             * @param uuid the uuid
962             * @param groupId the group ID
963             * @return the matching repository
964             * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
965             * @throws SystemException if a system exception occurred
966             */
967            public Repository findByUUID_G(String uuid, long groupId)
968                    throws NoSuchRepositoryException, SystemException {
969                    Repository repository = fetchByUUID_G(uuid, groupId);
970    
971                    if (repository == null) {
972                            StringBundler msg = new StringBundler(6);
973    
974                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
975    
976                            msg.append("uuid=");
977                            msg.append(uuid);
978    
979                            msg.append(", groupId=");
980                            msg.append(groupId);
981    
982                            msg.append(StringPool.CLOSE_CURLY_BRACE);
983    
984                            if (_log.isWarnEnabled()) {
985                                    _log.warn(msg.toString());
986                            }
987    
988                            throw new NoSuchRepositoryException(msg.toString());
989                    }
990    
991                    return repository;
992            }
993    
994            /**
995             * Returns the repository where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
996             *
997             * @param uuid the uuid
998             * @param groupId the group ID
999             * @return the matching repository, or <code>null</code> if a matching repository could not be found
1000             * @throws SystemException if a system exception occurred
1001             */
1002            public Repository fetchByUUID_G(String uuid, long groupId)
1003                    throws SystemException {
1004                    return fetchByUUID_G(uuid, groupId, true);
1005            }
1006    
1007            /**
1008             * Returns the repository where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1009             *
1010             * @param uuid the uuid
1011             * @param groupId the group ID
1012             * @param retrieveFromCache whether to use the finder cache
1013             * @return the matching repository, or <code>null</code> if a matching repository could not be found
1014             * @throws SystemException if a system exception occurred
1015             */
1016            public Repository fetchByUUID_G(String uuid, long groupId,
1017                    boolean retrieveFromCache) throws SystemException {
1018                    Object[] finderArgs = new Object[] { uuid, groupId };
1019    
1020                    Object result = null;
1021    
1022                    if (retrieveFromCache) {
1023                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1024                                            finderArgs, this);
1025                    }
1026    
1027                    if (result instanceof Repository) {
1028                            Repository repository = (Repository)result;
1029    
1030                            if (!Validator.equals(uuid, repository.getUuid()) ||
1031                                            (groupId != repository.getGroupId())) {
1032                                    result = null;
1033                            }
1034                    }
1035    
1036                    if (result == null) {
1037                            StringBundler query = new StringBundler(3);
1038    
1039                            query.append(_SQL_SELECT_REPOSITORY_WHERE);
1040    
1041                            if (uuid == null) {
1042                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1043                            }
1044                            else {
1045                                    if (uuid.equals(StringPool.BLANK)) {
1046                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1047                                    }
1048                                    else {
1049                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1050                                    }
1051                            }
1052    
1053                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1054    
1055                            String sql = query.toString();
1056    
1057                            Session session = null;
1058    
1059                            try {
1060                                    session = openSession();
1061    
1062                                    Query q = session.createQuery(sql);
1063    
1064                                    QueryPos qPos = QueryPos.getInstance(q);
1065    
1066                                    if (uuid != null) {
1067                                            qPos.add(uuid);
1068                                    }
1069    
1070                                    qPos.add(groupId);
1071    
1072                                    List<Repository> list = q.list();
1073    
1074                                    result = list;
1075    
1076                                    Repository repository = null;
1077    
1078                                    if (list.isEmpty()) {
1079                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1080                                                    finderArgs, list);
1081                                    }
1082                                    else {
1083                                            repository = list.get(0);
1084    
1085                                            cacheResult(repository);
1086    
1087                                            if ((repository.getUuid() == null) ||
1088                                                            !repository.getUuid().equals(uuid) ||
1089                                                            (repository.getGroupId() != groupId)) {
1090                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1091                                                            finderArgs, repository);
1092                                            }
1093                                    }
1094    
1095                                    return repository;
1096                            }
1097                            catch (Exception e) {
1098                                    throw processException(e);
1099                            }
1100                            finally {
1101                                    if (result == null) {
1102                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1103                                                    finderArgs);
1104                                    }
1105    
1106                                    closeSession(session);
1107                            }
1108                    }
1109                    else {
1110                            if (result instanceof List<?>) {
1111                                    return null;
1112                            }
1113                            else {
1114                                    return (Repository)result;
1115                            }
1116                    }
1117            }
1118    
1119            /**
1120             * Returns all the repositories where groupId = &#63;.
1121             *
1122             * @param groupId the group ID
1123             * @return the matching repositories
1124             * @throws SystemException if a system exception occurred
1125             */
1126            public List<Repository> findByGroupId(long groupId)
1127                    throws SystemException {
1128                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1129            }
1130    
1131            /**
1132             * Returns a range of all the repositories where groupId = &#63;.
1133             *
1134             * <p>
1135             * 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.
1136             * </p>
1137             *
1138             * @param groupId the group ID
1139             * @param start the lower bound of the range of repositories
1140             * @param end the upper bound of the range of repositories (not inclusive)
1141             * @return the range of matching repositories
1142             * @throws SystemException if a system exception occurred
1143             */
1144            public List<Repository> findByGroupId(long groupId, int start, int end)
1145                    throws SystemException {
1146                    return findByGroupId(groupId, start, end, null);
1147            }
1148    
1149            /**
1150             * Returns an ordered range of all the repositories where groupId = &#63;.
1151             *
1152             * <p>
1153             * 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.
1154             * </p>
1155             *
1156             * @param groupId the group ID
1157             * @param start the lower bound of the range of repositories
1158             * @param end the upper bound of the range of repositories (not inclusive)
1159             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1160             * @return the ordered range of matching repositories
1161             * @throws SystemException if a system exception occurred
1162             */
1163            public List<Repository> findByGroupId(long groupId, int start, int end,
1164                    OrderByComparator orderByComparator) throws SystemException {
1165                    FinderPath finderPath = null;
1166                    Object[] finderArgs = null;
1167    
1168                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1169                                    (orderByComparator == null)) {
1170                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1171                            finderArgs = new Object[] { groupId };
1172                    }
1173                    else {
1174                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1175                            finderArgs = new Object[] { groupId, start, end, orderByComparator };
1176                    }
1177    
1178                    List<Repository> list = (List<Repository>)FinderCacheUtil.getResult(finderPath,
1179                                    finderArgs, this);
1180    
1181                    if ((list != null) && !list.isEmpty()) {
1182                            for (Repository repository : list) {
1183                                    if ((groupId != repository.getGroupId())) {
1184                                            list = null;
1185    
1186                                            break;
1187                                    }
1188                            }
1189                    }
1190    
1191                    if (list == null) {
1192                            StringBundler query = null;
1193    
1194                            if (orderByComparator != null) {
1195                                    query = new StringBundler(3 +
1196                                                    (orderByComparator.getOrderByFields().length * 3));
1197                            }
1198                            else {
1199                                    query = new StringBundler(2);
1200                            }
1201    
1202                            query.append(_SQL_SELECT_REPOSITORY_WHERE);
1203    
1204                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1205    
1206                            if (orderByComparator != null) {
1207                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1208                                            orderByComparator);
1209                            }
1210    
1211                            String sql = query.toString();
1212    
1213                            Session session = null;
1214    
1215                            try {
1216                                    session = openSession();
1217    
1218                                    Query q = session.createQuery(sql);
1219    
1220                                    QueryPos qPos = QueryPos.getInstance(q);
1221    
1222                                    qPos.add(groupId);
1223    
1224                                    list = (List<Repository>)QueryUtil.list(q, getDialect(), start,
1225                                                    end);
1226                            }
1227                            catch (Exception e) {
1228                                    throw processException(e);
1229                            }
1230                            finally {
1231                                    if (list == null) {
1232                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1233                                    }
1234                                    else {
1235                                            cacheResult(list);
1236    
1237                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1238                                    }
1239    
1240                                    closeSession(session);
1241                            }
1242                    }
1243    
1244                    return list;
1245            }
1246    
1247            /**
1248             * Returns the first repository in the ordered set where groupId = &#63;.
1249             *
1250             * @param groupId the group ID
1251             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1252             * @return the first matching repository
1253             * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
1254             * @throws SystemException if a system exception occurred
1255             */
1256            public Repository findByGroupId_First(long groupId,
1257                    OrderByComparator orderByComparator)
1258                    throws NoSuchRepositoryException, SystemException {
1259                    Repository repository = fetchByGroupId_First(groupId, orderByComparator);
1260    
1261                    if (repository != null) {
1262                            return repository;
1263                    }
1264    
1265                    StringBundler msg = new StringBundler(4);
1266    
1267                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1268    
1269                    msg.append("groupId=");
1270                    msg.append(groupId);
1271    
1272                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1273    
1274                    throw new NoSuchRepositoryException(msg.toString());
1275            }
1276    
1277            /**
1278             * Returns the first repository in the ordered set where groupId = &#63;.
1279             *
1280             * @param groupId the group ID
1281             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1282             * @return the first matching repository, or <code>null</code> if a matching repository could not be found
1283             * @throws SystemException if a system exception occurred
1284             */
1285            public Repository fetchByGroupId_First(long groupId,
1286                    OrderByComparator orderByComparator) throws SystemException {
1287                    List<Repository> list = findByGroupId(groupId, 0, 1, orderByComparator);
1288    
1289                    if (!list.isEmpty()) {
1290                            return list.get(0);
1291                    }
1292    
1293                    return null;
1294            }
1295    
1296            /**
1297             * Returns the last repository in the ordered set where groupId = &#63;.
1298             *
1299             * @param groupId the group ID
1300             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1301             * @return the last matching repository
1302             * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
1303             * @throws SystemException if a system exception occurred
1304             */
1305            public Repository findByGroupId_Last(long groupId,
1306                    OrderByComparator orderByComparator)
1307                    throws NoSuchRepositoryException, SystemException {
1308                    Repository repository = fetchByGroupId_Last(groupId, orderByComparator);
1309    
1310                    if (repository != null) {
1311                            return repository;
1312                    }
1313    
1314                    StringBundler msg = new StringBundler(4);
1315    
1316                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1317    
1318                    msg.append("groupId=");
1319                    msg.append(groupId);
1320    
1321                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1322    
1323                    throw new NoSuchRepositoryException(msg.toString());
1324            }
1325    
1326            /**
1327             * Returns the last repository in the ordered set where groupId = &#63;.
1328             *
1329             * @param groupId the group ID
1330             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1331             * @return the last matching repository, or <code>null</code> if a matching repository could not be found
1332             * @throws SystemException if a system exception occurred
1333             */
1334            public Repository fetchByGroupId_Last(long groupId,
1335                    OrderByComparator orderByComparator) throws SystemException {
1336                    int count = countByGroupId(groupId);
1337    
1338                    List<Repository> list = findByGroupId(groupId, count - 1, count,
1339                                    orderByComparator);
1340    
1341                    if (!list.isEmpty()) {
1342                            return list.get(0);
1343                    }
1344    
1345                    return null;
1346            }
1347    
1348            /**
1349             * Returns the repositories before and after the current repository in the ordered set where groupId = &#63;.
1350             *
1351             * @param repositoryId the primary key of the current repository
1352             * @param groupId the group ID
1353             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1354             * @return the previous, current, and next repository
1355             * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
1356             * @throws SystemException if a system exception occurred
1357             */
1358            public Repository[] findByGroupId_PrevAndNext(long repositoryId,
1359                    long groupId, OrderByComparator orderByComparator)
1360                    throws NoSuchRepositoryException, SystemException {
1361                    Repository repository = findByPrimaryKey(repositoryId);
1362    
1363                    Session session = null;
1364    
1365                    try {
1366                            session = openSession();
1367    
1368                            Repository[] array = new RepositoryImpl[3];
1369    
1370                            array[0] = getByGroupId_PrevAndNext(session, repository, groupId,
1371                                            orderByComparator, true);
1372    
1373                            array[1] = repository;
1374    
1375                            array[2] = getByGroupId_PrevAndNext(session, repository, groupId,
1376                                            orderByComparator, false);
1377    
1378                            return array;
1379                    }
1380                    catch (Exception e) {
1381                            throw processException(e);
1382                    }
1383                    finally {
1384                            closeSession(session);
1385                    }
1386            }
1387    
1388            protected Repository getByGroupId_PrevAndNext(Session session,
1389                    Repository repository, long groupId,
1390                    OrderByComparator orderByComparator, boolean previous) {
1391                    StringBundler query = null;
1392    
1393                    if (orderByComparator != null) {
1394                            query = new StringBundler(6 +
1395                                            (orderByComparator.getOrderByFields().length * 6));
1396                    }
1397                    else {
1398                            query = new StringBundler(3);
1399                    }
1400    
1401                    query.append(_SQL_SELECT_REPOSITORY_WHERE);
1402    
1403                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1404    
1405                    if (orderByComparator != null) {
1406                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1407    
1408                            if (orderByConditionFields.length > 0) {
1409                                    query.append(WHERE_AND);
1410                            }
1411    
1412                            for (int i = 0; i < orderByConditionFields.length; i++) {
1413                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1414                                    query.append(orderByConditionFields[i]);
1415    
1416                                    if ((i + 1) < orderByConditionFields.length) {
1417                                            if (orderByComparator.isAscending() ^ previous) {
1418                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1419                                            }
1420                                            else {
1421                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1422                                            }
1423                                    }
1424                                    else {
1425                                            if (orderByComparator.isAscending() ^ previous) {
1426                                                    query.append(WHERE_GREATER_THAN);
1427                                            }
1428                                            else {
1429                                                    query.append(WHERE_LESSER_THAN);
1430                                            }
1431                                    }
1432                            }
1433    
1434                            query.append(ORDER_BY_CLAUSE);
1435    
1436                            String[] orderByFields = orderByComparator.getOrderByFields();
1437    
1438                            for (int i = 0; i < orderByFields.length; i++) {
1439                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1440                                    query.append(orderByFields[i]);
1441    
1442                                    if ((i + 1) < orderByFields.length) {
1443                                            if (orderByComparator.isAscending() ^ previous) {
1444                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1445                                            }
1446                                            else {
1447                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1448                                            }
1449                                    }
1450                                    else {
1451                                            if (orderByComparator.isAscending() ^ previous) {
1452                                                    query.append(ORDER_BY_ASC);
1453                                            }
1454                                            else {
1455                                                    query.append(ORDER_BY_DESC);
1456                                            }
1457                                    }
1458                            }
1459                    }
1460    
1461                    String sql = query.toString();
1462    
1463                    Query q = session.createQuery(sql);
1464    
1465                    q.setFirstResult(0);
1466                    q.setMaxResults(2);
1467    
1468                    QueryPos qPos = QueryPos.getInstance(q);
1469    
1470                    qPos.add(groupId);
1471    
1472                    if (orderByComparator != null) {
1473                            Object[] values = orderByComparator.getOrderByConditionValues(repository);
1474    
1475                            for (Object value : values) {
1476                                    qPos.add(value);
1477                            }
1478                    }
1479    
1480                    List<Repository> list = q.list();
1481    
1482                    if (list.size() == 2) {
1483                            return list.get(1);
1484                    }
1485                    else {
1486                            return null;
1487                    }
1488            }
1489    
1490            /**
1491             * Returns all the repositories.
1492             *
1493             * @return the repositories
1494             * @throws SystemException if a system exception occurred
1495             */
1496            public List<Repository> findAll() throws SystemException {
1497                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1498            }
1499    
1500            /**
1501             * Returns a range of all the repositories.
1502             *
1503             * <p>
1504             * 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.
1505             * </p>
1506             *
1507             * @param start the lower bound of the range of repositories
1508             * @param end the upper bound of the range of repositories (not inclusive)
1509             * @return the range of repositories
1510             * @throws SystemException if a system exception occurred
1511             */
1512            public List<Repository> findAll(int start, int end)
1513                    throws SystemException {
1514                    return findAll(start, end, null);
1515            }
1516    
1517            /**
1518             * Returns an ordered range of all the repositories.
1519             *
1520             * <p>
1521             * 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.
1522             * </p>
1523             *
1524             * @param start the lower bound of the range of repositories
1525             * @param end the upper bound of the range of repositories (not inclusive)
1526             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1527             * @return the ordered range of repositories
1528             * @throws SystemException if a system exception occurred
1529             */
1530            public List<Repository> findAll(int start, int end,
1531                    OrderByComparator orderByComparator) throws SystemException {
1532                    FinderPath finderPath = null;
1533                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
1534    
1535                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1536                                    (orderByComparator == null)) {
1537                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1538                            finderArgs = FINDER_ARGS_EMPTY;
1539                    }
1540                    else {
1541                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1542                            finderArgs = new Object[] { start, end, orderByComparator };
1543                    }
1544    
1545                    List<Repository> list = (List<Repository>)FinderCacheUtil.getResult(finderPath,
1546                                    finderArgs, this);
1547    
1548                    if (list == null) {
1549                            StringBundler query = null;
1550                            String sql = null;
1551    
1552                            if (orderByComparator != null) {
1553                                    query = new StringBundler(2 +
1554                                                    (orderByComparator.getOrderByFields().length * 3));
1555    
1556                                    query.append(_SQL_SELECT_REPOSITORY);
1557    
1558                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1559                                            orderByComparator);
1560    
1561                                    sql = query.toString();
1562                            }
1563                            else {
1564                                    sql = _SQL_SELECT_REPOSITORY;
1565                            }
1566    
1567                            Session session = null;
1568    
1569                            try {
1570                                    session = openSession();
1571    
1572                                    Query q = session.createQuery(sql);
1573    
1574                                    if (orderByComparator == null) {
1575                                            list = (List<Repository>)QueryUtil.list(q, getDialect(),
1576                                                            start, end, false);
1577    
1578                                            Collections.sort(list);
1579                                    }
1580                                    else {
1581                                            list = (List<Repository>)QueryUtil.list(q, getDialect(),
1582                                                            start, end);
1583                                    }
1584                            }
1585                            catch (Exception e) {
1586                                    throw processException(e);
1587                            }
1588                            finally {
1589                                    if (list == null) {
1590                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1591                                    }
1592                                    else {
1593                                            cacheResult(list);
1594    
1595                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1596                                    }
1597    
1598                                    closeSession(session);
1599                            }
1600                    }
1601    
1602                    return list;
1603            }
1604    
1605            /**
1606             * Removes all the repositories where uuid = &#63; from the database.
1607             *
1608             * @param uuid the uuid
1609             * @throws SystemException if a system exception occurred
1610             */
1611            public void removeByUuid(String uuid) throws SystemException {
1612                    for (Repository repository : findByUuid(uuid)) {
1613                            remove(repository);
1614                    }
1615            }
1616    
1617            /**
1618             * Removes the repository where uuid = &#63; and groupId = &#63; from the database.
1619             *
1620             * @param uuid the uuid
1621             * @param groupId the group ID
1622             * @return the repository that was removed
1623             * @throws SystemException if a system exception occurred
1624             */
1625            public Repository removeByUUID_G(String uuid, long groupId)
1626                    throws NoSuchRepositoryException, SystemException {
1627                    Repository repository = findByUUID_G(uuid, groupId);
1628    
1629                    return remove(repository);
1630            }
1631    
1632            /**
1633             * Removes all the repositories where groupId = &#63; from the database.
1634             *
1635             * @param groupId the group ID
1636             * @throws SystemException if a system exception occurred
1637             */
1638            public void removeByGroupId(long groupId) throws SystemException {
1639                    for (Repository repository : findByGroupId(groupId)) {
1640                            remove(repository);
1641                    }
1642            }
1643    
1644            /**
1645             * Removes all the repositories from the database.
1646             *
1647             * @throws SystemException if a system exception occurred
1648             */
1649            public void removeAll() throws SystemException {
1650                    for (Repository repository : findAll()) {
1651                            remove(repository);
1652                    }
1653            }
1654    
1655            /**
1656             * Returns the number of repositories where uuid = &#63;.
1657             *
1658             * @param uuid the uuid
1659             * @return the number of matching repositories
1660             * @throws SystemException if a system exception occurred
1661             */
1662            public int countByUuid(String uuid) throws SystemException {
1663                    Object[] finderArgs = new Object[] { uuid };
1664    
1665                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
1666                                    finderArgs, this);
1667    
1668                    if (count == null) {
1669                            StringBundler query = new StringBundler(2);
1670    
1671                            query.append(_SQL_COUNT_REPOSITORY_WHERE);
1672    
1673                            if (uuid == null) {
1674                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
1675                            }
1676                            else {
1677                                    if (uuid.equals(StringPool.BLANK)) {
1678                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
1679                                    }
1680                                    else {
1681                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
1682                                    }
1683                            }
1684    
1685                            String sql = query.toString();
1686    
1687                            Session session = null;
1688    
1689                            try {
1690                                    session = openSession();
1691    
1692                                    Query q = session.createQuery(sql);
1693    
1694                                    QueryPos qPos = QueryPos.getInstance(q);
1695    
1696                                    if (uuid != null) {
1697                                            qPos.add(uuid);
1698                                    }
1699    
1700                                    count = (Long)q.uniqueResult();
1701                            }
1702                            catch (Exception e) {
1703                                    throw processException(e);
1704                            }
1705                            finally {
1706                                    if (count == null) {
1707                                            count = Long.valueOf(0);
1708                                    }
1709    
1710                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
1711                                            finderArgs, count);
1712    
1713                                    closeSession(session);
1714                            }
1715                    }
1716    
1717                    return count.intValue();
1718            }
1719    
1720            /**
1721             * Returns the number of repositories where uuid = &#63; and groupId = &#63;.
1722             *
1723             * @param uuid the uuid
1724             * @param groupId the group ID
1725             * @return the number of matching repositories
1726             * @throws SystemException if a system exception occurred
1727             */
1728            public int countByUUID_G(String uuid, long groupId)
1729                    throws SystemException {
1730                    Object[] finderArgs = new Object[] { uuid, groupId };
1731    
1732                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
1733                                    finderArgs, this);
1734    
1735                    if (count == null) {
1736                            StringBundler query = new StringBundler(3);
1737    
1738                            query.append(_SQL_COUNT_REPOSITORY_WHERE);
1739    
1740                            if (uuid == null) {
1741                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1742                            }
1743                            else {
1744                                    if (uuid.equals(StringPool.BLANK)) {
1745                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1746                                    }
1747                                    else {
1748                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1749                                    }
1750                            }
1751    
1752                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1753    
1754                            String sql = query.toString();
1755    
1756                            Session session = null;
1757    
1758                            try {
1759                                    session = openSession();
1760    
1761                                    Query q = session.createQuery(sql);
1762    
1763                                    QueryPos qPos = QueryPos.getInstance(q);
1764    
1765                                    if (uuid != null) {
1766                                            qPos.add(uuid);
1767                                    }
1768    
1769                                    qPos.add(groupId);
1770    
1771                                    count = (Long)q.uniqueResult();
1772                            }
1773                            catch (Exception e) {
1774                                    throw processException(e);
1775                            }
1776                            finally {
1777                                    if (count == null) {
1778                                            count = Long.valueOf(0);
1779                                    }
1780    
1781                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
1782                                            finderArgs, count);
1783    
1784                                    closeSession(session);
1785                            }
1786                    }
1787    
1788                    return count.intValue();
1789            }
1790    
1791            /**
1792             * Returns the number of repositories where groupId = &#63;.
1793             *
1794             * @param groupId the group ID
1795             * @return the number of matching repositories
1796             * @throws SystemException if a system exception occurred
1797             */
1798            public int countByGroupId(long groupId) throws SystemException {
1799                    Object[] finderArgs = new Object[] { groupId };
1800    
1801                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1802                                    finderArgs, this);
1803    
1804                    if (count == null) {
1805                            StringBundler query = new StringBundler(2);
1806    
1807                            query.append(_SQL_COUNT_REPOSITORY_WHERE);
1808    
1809                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1810    
1811                            String sql = query.toString();
1812    
1813                            Session session = null;
1814    
1815                            try {
1816                                    session = openSession();
1817    
1818                                    Query q = session.createQuery(sql);
1819    
1820                                    QueryPos qPos = QueryPos.getInstance(q);
1821    
1822                                    qPos.add(groupId);
1823    
1824                                    count = (Long)q.uniqueResult();
1825                            }
1826                            catch (Exception e) {
1827                                    throw processException(e);
1828                            }
1829                            finally {
1830                                    if (count == null) {
1831                                            count = Long.valueOf(0);
1832                                    }
1833    
1834                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1835                                            finderArgs, count);
1836    
1837                                    closeSession(session);
1838                            }
1839                    }
1840    
1841                    return count.intValue();
1842            }
1843    
1844            /**
1845             * Returns the number of repositories.
1846             *
1847             * @return the number of repositories
1848             * @throws SystemException if a system exception occurred
1849             */
1850            public int countAll() throws SystemException {
1851                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1852                                    FINDER_ARGS_EMPTY, this);
1853    
1854                    if (count == null) {
1855                            Session session = null;
1856    
1857                            try {
1858                                    session = openSession();
1859    
1860                                    Query q = session.createQuery(_SQL_COUNT_REPOSITORY);
1861    
1862                                    count = (Long)q.uniqueResult();
1863                            }
1864                            catch (Exception e) {
1865                                    throw processException(e);
1866                            }
1867                            finally {
1868                                    if (count == null) {
1869                                            count = Long.valueOf(0);
1870                                    }
1871    
1872                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1873                                            FINDER_ARGS_EMPTY, count);
1874    
1875                                    closeSession(session);
1876                            }
1877                    }
1878    
1879                    return count.intValue();
1880            }
1881    
1882            /**
1883             * Initializes the repository persistence.
1884             */
1885            public void afterPropertiesSet() {
1886                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1887                                            com.liferay.portal.util.PropsUtil.get(
1888                                                    "value.object.listener.com.liferay.portal.model.Repository")));
1889    
1890                    if (listenerClassNames.length > 0) {
1891                            try {
1892                                    List<ModelListener<Repository>> listenersList = new ArrayList<ModelListener<Repository>>();
1893    
1894                                    for (String listenerClassName : listenerClassNames) {
1895                                            listenersList.add((ModelListener<Repository>)InstanceFactory.newInstance(
1896                                                            listenerClassName));
1897                                    }
1898    
1899                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1900                            }
1901                            catch (Exception e) {
1902                                    _log.error(e);
1903                            }
1904                    }
1905            }
1906    
1907            public void destroy() {
1908                    EntityCacheUtil.removeCache(RepositoryImpl.class.getName());
1909                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1910                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1911            }
1912    
1913            @BeanReference(type = AccountPersistence.class)
1914            protected AccountPersistence accountPersistence;
1915            @BeanReference(type = AddressPersistence.class)
1916            protected AddressPersistence addressPersistence;
1917            @BeanReference(type = BrowserTrackerPersistence.class)
1918            protected BrowserTrackerPersistence browserTrackerPersistence;
1919            @BeanReference(type = ClassNamePersistence.class)
1920            protected ClassNamePersistence classNamePersistence;
1921            @BeanReference(type = ClusterGroupPersistence.class)
1922            protected ClusterGroupPersistence clusterGroupPersistence;
1923            @BeanReference(type = CompanyPersistence.class)
1924            protected CompanyPersistence companyPersistence;
1925            @BeanReference(type = ContactPersistence.class)
1926            protected ContactPersistence contactPersistence;
1927            @BeanReference(type = CountryPersistence.class)
1928            protected CountryPersistence countryPersistence;
1929            @BeanReference(type = EmailAddressPersistence.class)
1930            protected EmailAddressPersistence emailAddressPersistence;
1931            @BeanReference(type = GroupPersistence.class)
1932            protected GroupPersistence groupPersistence;
1933            @BeanReference(type = ImagePersistence.class)
1934            protected ImagePersistence imagePersistence;
1935            @BeanReference(type = LayoutPersistence.class)
1936            protected LayoutPersistence layoutPersistence;
1937            @BeanReference(type = LayoutBranchPersistence.class)
1938            protected LayoutBranchPersistence layoutBranchPersistence;
1939            @BeanReference(type = LayoutPrototypePersistence.class)
1940            protected LayoutPrototypePersistence layoutPrototypePersistence;
1941            @BeanReference(type = LayoutRevisionPersistence.class)
1942            protected LayoutRevisionPersistence layoutRevisionPersistence;
1943            @BeanReference(type = LayoutSetPersistence.class)
1944            protected LayoutSetPersistence layoutSetPersistence;
1945            @BeanReference(type = LayoutSetBranchPersistence.class)
1946            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1947            @BeanReference(type = LayoutSetPrototypePersistence.class)
1948            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1949            @BeanReference(type = ListTypePersistence.class)
1950            protected ListTypePersistence listTypePersistence;
1951            @BeanReference(type = LockPersistence.class)
1952            protected LockPersistence lockPersistence;
1953            @BeanReference(type = MembershipRequestPersistence.class)
1954            protected MembershipRequestPersistence membershipRequestPersistence;
1955            @BeanReference(type = OrganizationPersistence.class)
1956            protected OrganizationPersistence organizationPersistence;
1957            @BeanReference(type = OrgGroupPermissionPersistence.class)
1958            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1959            @BeanReference(type = OrgGroupRolePersistence.class)
1960            protected OrgGroupRolePersistence orgGroupRolePersistence;
1961            @BeanReference(type = OrgLaborPersistence.class)
1962            protected OrgLaborPersistence orgLaborPersistence;
1963            @BeanReference(type = PasswordPolicyPersistence.class)
1964            protected PasswordPolicyPersistence passwordPolicyPersistence;
1965            @BeanReference(type = PasswordPolicyRelPersistence.class)
1966            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1967            @BeanReference(type = PasswordTrackerPersistence.class)
1968            protected PasswordTrackerPersistence passwordTrackerPersistence;
1969            @BeanReference(type = PermissionPersistence.class)
1970            protected PermissionPersistence permissionPersistence;
1971            @BeanReference(type = PhonePersistence.class)
1972            protected PhonePersistence phonePersistence;
1973            @BeanReference(type = PluginSettingPersistence.class)
1974            protected PluginSettingPersistence pluginSettingPersistence;
1975            @BeanReference(type = PortalPreferencesPersistence.class)
1976            protected PortalPreferencesPersistence portalPreferencesPersistence;
1977            @BeanReference(type = PortletPersistence.class)
1978            protected PortletPersistence portletPersistence;
1979            @BeanReference(type = PortletItemPersistence.class)
1980            protected PortletItemPersistence portletItemPersistence;
1981            @BeanReference(type = PortletPreferencesPersistence.class)
1982            protected PortletPreferencesPersistence portletPreferencesPersistence;
1983            @BeanReference(type = RegionPersistence.class)
1984            protected RegionPersistence regionPersistence;
1985            @BeanReference(type = ReleasePersistence.class)
1986            protected ReleasePersistence releasePersistence;
1987            @BeanReference(type = RepositoryPersistence.class)
1988            protected RepositoryPersistence repositoryPersistence;
1989            @BeanReference(type = RepositoryEntryPersistence.class)
1990            protected RepositoryEntryPersistence repositoryEntryPersistence;
1991            @BeanReference(type = ResourcePersistence.class)
1992            protected ResourcePersistence resourcePersistence;
1993            @BeanReference(type = ResourceActionPersistence.class)
1994            protected ResourceActionPersistence resourceActionPersistence;
1995            @BeanReference(type = ResourceBlockPersistence.class)
1996            protected ResourceBlockPersistence resourceBlockPersistence;
1997            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1998            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1999            @BeanReference(type = ResourceCodePersistence.class)
2000            protected ResourceCodePersistence resourceCodePersistence;
2001            @BeanReference(type = ResourcePermissionPersistence.class)
2002            protected ResourcePermissionPersistence resourcePermissionPersistence;
2003            @BeanReference(type = ResourceTypePermissionPersistence.class)
2004            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2005            @BeanReference(type = RolePersistence.class)
2006            protected RolePersistence rolePersistence;
2007            @BeanReference(type = ServiceComponentPersistence.class)
2008            protected ServiceComponentPersistence serviceComponentPersistence;
2009            @BeanReference(type = ShardPersistence.class)
2010            protected ShardPersistence shardPersistence;
2011            @BeanReference(type = SubscriptionPersistence.class)
2012            protected SubscriptionPersistence subscriptionPersistence;
2013            @BeanReference(type = TeamPersistence.class)
2014            protected TeamPersistence teamPersistence;
2015            @BeanReference(type = TicketPersistence.class)
2016            protected TicketPersistence ticketPersistence;
2017            @BeanReference(type = UserPersistence.class)
2018            protected UserPersistence userPersistence;
2019            @BeanReference(type = UserGroupPersistence.class)
2020            protected UserGroupPersistence userGroupPersistence;
2021            @BeanReference(type = UserGroupGroupRolePersistence.class)
2022            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2023            @BeanReference(type = UserGroupRolePersistence.class)
2024            protected UserGroupRolePersistence userGroupRolePersistence;
2025            @BeanReference(type = UserIdMapperPersistence.class)
2026            protected UserIdMapperPersistence userIdMapperPersistence;
2027            @BeanReference(type = UserNotificationEventPersistence.class)
2028            protected UserNotificationEventPersistence userNotificationEventPersistence;
2029            @BeanReference(type = UserTrackerPersistence.class)
2030            protected UserTrackerPersistence userTrackerPersistence;
2031            @BeanReference(type = UserTrackerPathPersistence.class)
2032            protected UserTrackerPathPersistence userTrackerPathPersistence;
2033            @BeanReference(type = VirtualHostPersistence.class)
2034            protected VirtualHostPersistence virtualHostPersistence;
2035            @BeanReference(type = WebDAVPropsPersistence.class)
2036            protected WebDAVPropsPersistence webDAVPropsPersistence;
2037            @BeanReference(type = WebsitePersistence.class)
2038            protected WebsitePersistence websitePersistence;
2039            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2040            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2041            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2042            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2043            @BeanReference(type = AssetEntryPersistence.class)
2044            protected AssetEntryPersistence assetEntryPersistence;
2045            @BeanReference(type = DLFileEntryPersistence.class)
2046            protected DLFileEntryPersistence dlFileEntryPersistence;
2047            @BeanReference(type = DLFileVersionPersistence.class)
2048            protected DLFileVersionPersistence dlFileVersionPersistence;
2049            @BeanReference(type = DLFolderPersistence.class)
2050            protected DLFolderPersistence dlFolderPersistence;
2051            @BeanReference(type = ExpandoValuePersistence.class)
2052            protected ExpandoValuePersistence expandoValuePersistence;
2053            private static final String _SQL_SELECT_REPOSITORY = "SELECT repository FROM Repository repository";
2054            private static final String _SQL_SELECT_REPOSITORY_WHERE = "SELECT repository FROM Repository repository WHERE ";
2055            private static final String _SQL_COUNT_REPOSITORY = "SELECT COUNT(repository) FROM Repository repository";
2056            private static final String _SQL_COUNT_REPOSITORY_WHERE = "SELECT COUNT(repository) FROM Repository repository WHERE ";
2057            private static final String _FINDER_COLUMN_UUID_UUID_1 = "repository.uuid IS NULL";
2058            private static final String _FINDER_COLUMN_UUID_UUID_2 = "repository.uuid = ?";
2059            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(repository.uuid IS NULL OR repository.uuid = ?)";
2060            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "repository.uuid IS NULL AND ";
2061            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "repository.uuid = ? AND ";
2062            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(repository.uuid IS NULL OR repository.uuid = ?) AND ";
2063            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "repository.groupId = ?";
2064            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "repository.groupId = ?";
2065            private static final String _ORDER_BY_ENTITY_ALIAS = "repository.";
2066            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Repository exists with the primary key ";
2067            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Repository exists with the key {";
2068            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2069            private static Log _log = LogFactoryUtil.getLog(RepositoryPersistenceImpl.class);
2070            private static Repository _nullRepository = new RepositoryImpl() {
2071                            @Override
2072                            public Object clone() {
2073                                    return this;
2074                            }
2075    
2076                            @Override
2077                            public CacheModel<Repository> toCacheModel() {
2078                                    return _nullRepositoryCacheModel;
2079                            }
2080                    };
2081    
2082            private static CacheModel<Repository> _nullRepositoryCacheModel = new CacheModel<Repository>() {
2083                            public Repository toEntityModel() {
2084                                    return _nullRepository;
2085                            }
2086                    };
2087    }