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