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