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