001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.asset.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.bean.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryPos;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.SQLQuery;
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.security.permission.InlineSQLHelperUtil;
042    import com.liferay.portal.service.persistence.BatchSessionUtil;
043    import com.liferay.portal.service.persistence.GroupPersistence;
044    import com.liferay.portal.service.persistence.ResourcePersistence;
045    import com.liferay.portal.service.persistence.UserPersistence;
046    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
047    
048    import com.liferay.portlet.asset.NoSuchVocabularyException;
049    import com.liferay.portlet.asset.model.AssetVocabulary;
050    import com.liferay.portlet.asset.model.impl.AssetVocabularyImpl;
051    import com.liferay.portlet.asset.model.impl.AssetVocabularyModelImpl;
052    
053    import java.io.Serializable;
054    
055    import java.util.ArrayList;
056    import java.util.Collections;
057    import java.util.List;
058    
059    /**
060     * The persistence implementation for the asset vocabulary service.
061     *
062     * <p>
063     * Caching information and settings can be found in <code>portal.properties</code>
064     * </p>
065     *
066     * @author Brian Wing Shun Chan
067     * @see AssetVocabularyPersistence
068     * @see AssetVocabularyUtil
069     * @generated
070     */
071    public class AssetVocabularyPersistenceImpl extends BasePersistenceImpl<AssetVocabulary>
072            implements AssetVocabularyPersistence {
073            /*
074             * NOTE FOR DEVELOPERS:
075             *
076             * Never modify or reference this class directly. Always use {@link AssetVocabularyUtil} to access the asset vocabulary persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
077             */
078            public static final String FINDER_CLASS_NAME_ENTITY = AssetVocabularyImpl.class.getName();
079            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
080                    ".List1";
081            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
082                    ".List2";
083            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
084                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
085                            AssetVocabularyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
086                            "findByUuid",
087                            new String[] {
088                                    String.class.getName(),
089                                    
090                            "java.lang.Integer", "java.lang.Integer",
091                                    "com.liferay.portal.kernel.util.OrderByComparator"
092                            });
093            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
094                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
095                            AssetVocabularyImpl.class,
096                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
097                            new String[] { String.class.getName() },
098                            AssetVocabularyModelImpl.UUID_COLUMN_BITMASK);
099            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
100                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED, Long.class,
101                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
102                            new String[] { String.class.getName() });
103            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
104                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
105                            AssetVocabularyImpl.class, FINDER_CLASS_NAME_ENTITY,
106                            "fetchByUUID_G",
107                            new String[] { String.class.getName(), Long.class.getName() },
108                            AssetVocabularyModelImpl.UUID_COLUMN_BITMASK |
109                            AssetVocabularyModelImpl.GROUPID_COLUMN_BITMASK);
110            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
111                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED, Long.class,
112                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
113                            new String[] { String.class.getName(), Long.class.getName() });
114            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
115                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
116                            AssetVocabularyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
117                            "findByGroupId",
118                            new String[] {
119                                    Long.class.getName(),
120                                    
121                            "java.lang.Integer", "java.lang.Integer",
122                                    "com.liferay.portal.kernel.util.OrderByComparator"
123                            });
124            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
125                    new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
126                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
127                            AssetVocabularyImpl.class,
128                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
129                            new String[] { Long.class.getName() },
130                            AssetVocabularyModelImpl.GROUPID_COLUMN_BITMASK);
131            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
132                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED, Long.class,
133                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
134                            new String[] { Long.class.getName() });
135            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
136                    new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
137                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
138                            AssetVocabularyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
139                            "findByCompanyId",
140                            new String[] {
141                                    Long.class.getName(),
142                                    
143                            "java.lang.Integer", "java.lang.Integer",
144                                    "com.liferay.portal.kernel.util.OrderByComparator"
145                            });
146            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
147                    new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
148                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
149                            AssetVocabularyImpl.class,
150                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
151                            new String[] { Long.class.getName() },
152                            AssetVocabularyModelImpl.COMPANYID_COLUMN_BITMASK);
153            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
154                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED, Long.class,
155                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
156                            new String[] { Long.class.getName() });
157            public static final FinderPath FINDER_PATH_FETCH_BY_G_N = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
158                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
159                            AssetVocabularyImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByG_N",
160                            new String[] { Long.class.getName(), String.class.getName() },
161                            AssetVocabularyModelImpl.GROUPID_COLUMN_BITMASK |
162                            AssetVocabularyModelImpl.NAME_COLUMN_BITMASK);
163            public static final FinderPath FINDER_PATH_COUNT_BY_G_N = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
164                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED, Long.class,
165                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_N",
166                            new String[] { Long.class.getName(), String.class.getName() });
167            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
168                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
169                            AssetVocabularyImpl.class,
170                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
171            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
172                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
173                            AssetVocabularyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
174                            "findAll", new String[0]);
175            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
176                            AssetVocabularyModelImpl.FINDER_CACHE_ENABLED, Long.class,
177                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
178    
179            /**
180             * Caches the asset vocabulary in the entity cache if it is enabled.
181             *
182             * @param assetVocabulary the asset vocabulary
183             */
184            public void cacheResult(AssetVocabulary assetVocabulary) {
185                    EntityCacheUtil.putResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
186                            AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey(),
187                            assetVocabulary);
188    
189                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
190                            new Object[] {
191                                    assetVocabulary.getUuid(),
192                                    Long.valueOf(assetVocabulary.getGroupId())
193                            }, assetVocabulary);
194    
195                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
196                            new Object[] {
197                                    Long.valueOf(assetVocabulary.getGroupId()),
198                                    
199                            assetVocabulary.getName()
200                            }, assetVocabulary);
201    
202                    assetVocabulary.resetOriginalValues();
203            }
204    
205            /**
206             * Caches the asset vocabularies in the entity cache if it is enabled.
207             *
208             * @param assetVocabularies the asset vocabularies
209             */
210            public void cacheResult(List<AssetVocabulary> assetVocabularies) {
211                    for (AssetVocabulary assetVocabulary : assetVocabularies) {
212                            if (EntityCacheUtil.getResult(
213                                                    AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
214                                                    AssetVocabularyImpl.class,
215                                                    assetVocabulary.getPrimaryKey()) == null) {
216                                    cacheResult(assetVocabulary);
217                            }
218                            else {
219                                    assetVocabulary.resetOriginalValues();
220                            }
221                    }
222            }
223    
224            /**
225             * Clears the cache for all asset vocabularies.
226             *
227             * <p>
228             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
229             * </p>
230             */
231            @Override
232            public void clearCache() {
233                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
234                            CacheRegistryUtil.clear(AssetVocabularyImpl.class.getName());
235                    }
236    
237                    EntityCacheUtil.clearCache(AssetVocabularyImpl.class.getName());
238    
239                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
240                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
241                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
242            }
243    
244            /**
245             * Clears the cache for the asset vocabulary.
246             *
247             * <p>
248             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
249             * </p>
250             */
251            @Override
252            public void clearCache(AssetVocabulary assetVocabulary) {
253                    EntityCacheUtil.removeResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
254                            AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey());
255    
256                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
257                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
258    
259                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
260                            new Object[] {
261                                    assetVocabulary.getUuid(),
262                                    Long.valueOf(assetVocabulary.getGroupId())
263                            });
264    
265                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
266                            new Object[] {
267                                    Long.valueOf(assetVocabulary.getGroupId()),
268                                    
269                            assetVocabulary.getName()
270                            });
271            }
272    
273            /**
274             * Creates a new asset vocabulary with the primary key. Does not add the asset vocabulary to the database.
275             *
276             * @param vocabularyId the primary key for the new asset vocabulary
277             * @return the new asset vocabulary
278             */
279            public AssetVocabulary create(long vocabularyId) {
280                    AssetVocabulary assetVocabulary = new AssetVocabularyImpl();
281    
282                    assetVocabulary.setNew(true);
283                    assetVocabulary.setPrimaryKey(vocabularyId);
284    
285                    String uuid = PortalUUIDUtil.generate();
286    
287                    assetVocabulary.setUuid(uuid);
288    
289                    return assetVocabulary;
290            }
291    
292            /**
293             * Removes the asset vocabulary with the primary key from the database. Also notifies the appropriate model listeners.
294             *
295             * @param primaryKey the primary key of the asset vocabulary
296             * @return the asset vocabulary that was removed
297             * @throws com.liferay.portal.NoSuchModelException if a asset vocabulary with the primary key could not be found
298             * @throws SystemException if a system exception occurred
299             */
300            @Override
301            public AssetVocabulary remove(Serializable primaryKey)
302                    throws NoSuchModelException, SystemException {
303                    return remove(((Long)primaryKey).longValue());
304            }
305    
306            /**
307             * Removes the asset vocabulary with the primary key from the database. Also notifies the appropriate model listeners.
308             *
309             * @param vocabularyId the primary key of the asset vocabulary
310             * @return the asset vocabulary that was removed
311             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a asset vocabulary with the primary key could not be found
312             * @throws SystemException if a system exception occurred
313             */
314            public AssetVocabulary remove(long vocabularyId)
315                    throws NoSuchVocabularyException, SystemException {
316                    Session session = null;
317    
318                    try {
319                            session = openSession();
320    
321                            AssetVocabulary assetVocabulary = (AssetVocabulary)session.get(AssetVocabularyImpl.class,
322                                            Long.valueOf(vocabularyId));
323    
324                            if (assetVocabulary == null) {
325                                    if (_log.isWarnEnabled()) {
326                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + vocabularyId);
327                                    }
328    
329                                    throw new NoSuchVocabularyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
330                                            vocabularyId);
331                            }
332    
333                            return assetVocabularyPersistence.remove(assetVocabulary);
334                    }
335                    catch (NoSuchVocabularyException nsee) {
336                            throw nsee;
337                    }
338                    catch (Exception e) {
339                            throw processException(e);
340                    }
341                    finally {
342                            closeSession(session);
343                    }
344            }
345    
346            /**
347             * Removes the asset vocabulary from the database. Also notifies the appropriate model listeners.
348             *
349             * @param assetVocabulary the asset vocabulary
350             * @return the asset vocabulary that was removed
351             * @throws SystemException if a system exception occurred
352             */
353            @Override
354            public AssetVocabulary remove(AssetVocabulary assetVocabulary)
355                    throws SystemException {
356                    return super.remove(assetVocabulary);
357            }
358    
359            @Override
360            protected AssetVocabulary removeImpl(AssetVocabulary assetVocabulary)
361                    throws SystemException {
362                    assetVocabulary = toUnwrappedModel(assetVocabulary);
363    
364                    Session session = null;
365    
366                    try {
367                            session = openSession();
368    
369                            BatchSessionUtil.delete(session, assetVocabulary);
370                    }
371                    catch (Exception e) {
372                            throw processException(e);
373                    }
374                    finally {
375                            closeSession(session);
376                    }
377    
378                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
379                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
380    
381                    AssetVocabularyModelImpl assetVocabularyModelImpl = (AssetVocabularyModelImpl)assetVocabulary;
382    
383                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
384                            new Object[] {
385                                    assetVocabularyModelImpl.getUuid(),
386                                    Long.valueOf(assetVocabularyModelImpl.getGroupId())
387                            });
388    
389                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
390                            new Object[] {
391                                    Long.valueOf(assetVocabularyModelImpl.getGroupId()),
392                                    
393                            assetVocabularyModelImpl.getName()
394                            });
395    
396                    EntityCacheUtil.removeResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
397                            AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey());
398    
399                    return assetVocabulary;
400            }
401    
402            @Override
403            public AssetVocabulary updateImpl(
404                    com.liferay.portlet.asset.model.AssetVocabulary assetVocabulary,
405                    boolean merge) throws SystemException {
406                    assetVocabulary = toUnwrappedModel(assetVocabulary);
407    
408                    boolean isNew = assetVocabulary.isNew();
409    
410                    AssetVocabularyModelImpl assetVocabularyModelImpl = (AssetVocabularyModelImpl)assetVocabulary;
411    
412                    if (Validator.isNull(assetVocabulary.getUuid())) {
413                            String uuid = PortalUUIDUtil.generate();
414    
415                            assetVocabulary.setUuid(uuid);
416                    }
417    
418                    Session session = null;
419    
420                    try {
421                            session = openSession();
422    
423                            BatchSessionUtil.update(session, assetVocabulary, merge);
424    
425                            assetVocabulary.setNew(false);
426                    }
427                    catch (Exception e) {
428                            throw processException(e);
429                    }
430                    finally {
431                            closeSession(session);
432                    }
433    
434                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
435    
436                    if (isNew || !AssetVocabularyModelImpl.COLUMN_BITMASK_ENABLED) {
437                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
438                    }
439    
440                    else {
441                            if ((assetVocabularyModelImpl.getColumnBitmask() &
442                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
443                                    Object[] args = new Object[] {
444                                                    assetVocabularyModelImpl.getOriginalUuid()
445                                            };
446    
447                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
448                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
449                                            args);
450    
451                                    args = new Object[] { assetVocabularyModelImpl.getUuid() };
452    
453                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
454                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
455                                            args);
456                            }
457    
458                            if ((assetVocabularyModelImpl.getColumnBitmask() &
459                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
460                                    Object[] args = new Object[] {
461                                                    Long.valueOf(assetVocabularyModelImpl.getOriginalGroupId())
462                                            };
463    
464                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
465                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
466                                            args);
467    
468                                    args = new Object[] {
469                                                    Long.valueOf(assetVocabularyModelImpl.getGroupId())
470                                            };
471    
472                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
473                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
474                                            args);
475                            }
476    
477                            if ((assetVocabularyModelImpl.getColumnBitmask() &
478                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
479                                    Object[] args = new Object[] {
480                                                    Long.valueOf(assetVocabularyModelImpl.getOriginalCompanyId())
481                                            };
482    
483                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
484                                            args);
485                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
486                                            args);
487    
488                                    args = new Object[] {
489                                                    Long.valueOf(assetVocabularyModelImpl.getCompanyId())
490                                            };
491    
492                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
493                                            args);
494                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
495                                            args);
496                            }
497                    }
498    
499                    EntityCacheUtil.putResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
500                            AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey(),
501                            assetVocabulary);
502    
503                    if (isNew) {
504                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
505                                    new Object[] {
506                                            assetVocabulary.getUuid(),
507                                            Long.valueOf(assetVocabulary.getGroupId())
508                                    }, assetVocabulary);
509    
510                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
511                                    new Object[] {
512                                            Long.valueOf(assetVocabulary.getGroupId()),
513                                            
514                                    assetVocabulary.getName()
515                                    }, assetVocabulary);
516                    }
517                    else {
518                            if ((assetVocabularyModelImpl.getColumnBitmask() &
519                                            FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
520                                    Object[] args = new Object[] {
521                                                    assetVocabularyModelImpl.getOriginalUuid(),
522                                                    Long.valueOf(assetVocabularyModelImpl.getOriginalGroupId())
523                                            };
524    
525                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
526                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
527    
528                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
529                                            new Object[] {
530                                                    assetVocabulary.getUuid(),
531                                                    Long.valueOf(assetVocabulary.getGroupId())
532                                            }, assetVocabulary);
533                            }
534    
535                            if ((assetVocabularyModelImpl.getColumnBitmask() &
536                                            FINDER_PATH_FETCH_BY_G_N.getColumnBitmask()) != 0) {
537                                    Object[] args = new Object[] {
538                                                    Long.valueOf(assetVocabularyModelImpl.getOriginalGroupId()),
539                                                    
540                                                    assetVocabularyModelImpl.getOriginalName()
541                                            };
542    
543                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_N, args);
544                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N, args);
545    
546                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
547                                            new Object[] {
548                                                    Long.valueOf(assetVocabulary.getGroupId()),
549                                                    
550                                            assetVocabulary.getName()
551                                            }, assetVocabulary);
552                            }
553                    }
554    
555                    return assetVocabulary;
556            }
557    
558            protected AssetVocabulary toUnwrappedModel(AssetVocabulary assetVocabulary) {
559                    if (assetVocabulary instanceof AssetVocabularyImpl) {
560                            return assetVocabulary;
561                    }
562    
563                    AssetVocabularyImpl assetVocabularyImpl = new AssetVocabularyImpl();
564    
565                    assetVocabularyImpl.setNew(assetVocabulary.isNew());
566                    assetVocabularyImpl.setPrimaryKey(assetVocabulary.getPrimaryKey());
567    
568                    assetVocabularyImpl.setUuid(assetVocabulary.getUuid());
569                    assetVocabularyImpl.setVocabularyId(assetVocabulary.getVocabularyId());
570                    assetVocabularyImpl.setGroupId(assetVocabulary.getGroupId());
571                    assetVocabularyImpl.setCompanyId(assetVocabulary.getCompanyId());
572                    assetVocabularyImpl.setUserId(assetVocabulary.getUserId());
573                    assetVocabularyImpl.setUserName(assetVocabulary.getUserName());
574                    assetVocabularyImpl.setCreateDate(assetVocabulary.getCreateDate());
575                    assetVocabularyImpl.setModifiedDate(assetVocabulary.getModifiedDate());
576                    assetVocabularyImpl.setName(assetVocabulary.getName());
577                    assetVocabularyImpl.setTitle(assetVocabulary.getTitle());
578                    assetVocabularyImpl.setDescription(assetVocabulary.getDescription());
579                    assetVocabularyImpl.setSettings(assetVocabulary.getSettings());
580    
581                    return assetVocabularyImpl;
582            }
583    
584            /**
585             * Returns the asset vocabulary with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
586             *
587             * @param primaryKey the primary key of the asset vocabulary
588             * @return the asset vocabulary
589             * @throws com.liferay.portal.NoSuchModelException if a asset vocabulary with the primary key could not be found
590             * @throws SystemException if a system exception occurred
591             */
592            @Override
593            public AssetVocabulary findByPrimaryKey(Serializable primaryKey)
594                    throws NoSuchModelException, SystemException {
595                    return findByPrimaryKey(((Long)primaryKey).longValue());
596            }
597    
598            /**
599             * Returns the asset vocabulary with the primary key or throws a {@link com.liferay.portlet.asset.NoSuchVocabularyException} if it could not be found.
600             *
601             * @param vocabularyId the primary key of the asset vocabulary
602             * @return the asset vocabulary
603             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a asset vocabulary with the primary key could not be found
604             * @throws SystemException if a system exception occurred
605             */
606            public AssetVocabulary findByPrimaryKey(long vocabularyId)
607                    throws NoSuchVocabularyException, SystemException {
608                    AssetVocabulary assetVocabulary = fetchByPrimaryKey(vocabularyId);
609    
610                    if (assetVocabulary == null) {
611                            if (_log.isWarnEnabled()) {
612                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + vocabularyId);
613                            }
614    
615                            throw new NoSuchVocabularyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
616                                    vocabularyId);
617                    }
618    
619                    return assetVocabulary;
620            }
621    
622            /**
623             * Returns the asset vocabulary with the primary key or returns <code>null</code> if it could not be found.
624             *
625             * @param primaryKey the primary key of the asset vocabulary
626             * @return the asset vocabulary, or <code>null</code> if a asset vocabulary with the primary key could not be found
627             * @throws SystemException if a system exception occurred
628             */
629            @Override
630            public AssetVocabulary fetchByPrimaryKey(Serializable primaryKey)
631                    throws SystemException {
632                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
633            }
634    
635            /**
636             * Returns the asset vocabulary with the primary key or returns <code>null</code> if it could not be found.
637             *
638             * @param vocabularyId the primary key of the asset vocabulary
639             * @return the asset vocabulary, or <code>null</code> if a asset vocabulary with the primary key could not be found
640             * @throws SystemException if a system exception occurred
641             */
642            public AssetVocabulary fetchByPrimaryKey(long vocabularyId)
643                    throws SystemException {
644                    AssetVocabulary assetVocabulary = (AssetVocabulary)EntityCacheUtil.getResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
645                                    AssetVocabularyImpl.class, vocabularyId);
646    
647                    if (assetVocabulary == _nullAssetVocabulary) {
648                            return null;
649                    }
650    
651                    if (assetVocabulary == null) {
652                            Session session = null;
653    
654                            boolean hasException = false;
655    
656                            try {
657                                    session = openSession();
658    
659                                    assetVocabulary = (AssetVocabulary)session.get(AssetVocabularyImpl.class,
660                                                    Long.valueOf(vocabularyId));
661                            }
662                            catch (Exception e) {
663                                    hasException = true;
664    
665                                    throw processException(e);
666                            }
667                            finally {
668                                    if (assetVocabulary != null) {
669                                            cacheResult(assetVocabulary);
670                                    }
671                                    else if (!hasException) {
672                                            EntityCacheUtil.putResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
673                                                    AssetVocabularyImpl.class, vocabularyId,
674                                                    _nullAssetVocabulary);
675                                    }
676    
677                                    closeSession(session);
678                            }
679                    }
680    
681                    return assetVocabulary;
682            }
683    
684            /**
685             * Returns all the asset vocabularies where uuid = &#63;.
686             *
687             * @param uuid the uuid
688             * @return the matching asset vocabularies
689             * @throws SystemException if a system exception occurred
690             */
691            public List<AssetVocabulary> findByUuid(String uuid)
692                    throws SystemException {
693                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
694            }
695    
696            /**
697             * Returns a range of all the asset vocabularies where uuid = &#63;.
698             *
699             * <p>
700             * 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.
701             * </p>
702             *
703             * @param uuid the uuid
704             * @param start the lower bound of the range of asset vocabularies
705             * @param end the upper bound of the range of asset vocabularies (not inclusive)
706             * @return the range of matching asset vocabularies
707             * @throws SystemException if a system exception occurred
708             */
709            public List<AssetVocabulary> findByUuid(String uuid, int start, int end)
710                    throws SystemException {
711                    return findByUuid(uuid, start, end, null);
712            }
713    
714            /**
715             * Returns an ordered range of all the asset vocabularies where uuid = &#63;.
716             *
717             * <p>
718             * 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.
719             * </p>
720             *
721             * @param uuid the uuid
722             * @param start the lower bound of the range of asset vocabularies
723             * @param end the upper bound of the range of asset vocabularies (not inclusive)
724             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
725             * @return the ordered range of matching asset vocabularies
726             * @throws SystemException if a system exception occurred
727             */
728            public List<AssetVocabulary> findByUuid(String uuid, int start, int end,
729                    OrderByComparator orderByComparator) throws SystemException {
730                    FinderPath finderPath = null;
731                    Object[] finderArgs = null;
732    
733                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
734                                    (orderByComparator == null)) {
735                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
736                            finderArgs = new Object[] { uuid };
737                    }
738                    else {
739                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
740                            finderArgs = new Object[] { uuid, start, end, orderByComparator };
741                    }
742    
743                    List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(finderPath,
744                                    finderArgs, this);
745    
746                    if (list == null) {
747                            StringBundler query = null;
748    
749                            if (orderByComparator != null) {
750                                    query = new StringBundler(3 +
751                                                    (orderByComparator.getOrderByFields().length * 3));
752                            }
753                            else {
754                                    query = new StringBundler(3);
755                            }
756    
757                            query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
758    
759                            if (uuid == null) {
760                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
761                            }
762                            else {
763                                    if (uuid.equals(StringPool.BLANK)) {
764                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
765                                    }
766                                    else {
767                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
768                                    }
769                            }
770    
771                            if (orderByComparator != null) {
772                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
773                                            orderByComparator);
774                            }
775    
776                            else {
777                                    query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
778                            }
779    
780                            String sql = query.toString();
781    
782                            Session session = null;
783    
784                            try {
785                                    session = openSession();
786    
787                                    Query q = session.createQuery(sql);
788    
789                                    QueryPos qPos = QueryPos.getInstance(q);
790    
791                                    if (uuid != null) {
792                                            qPos.add(uuid);
793                                    }
794    
795                                    list = (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
796                                                    start, end);
797                            }
798                            catch (Exception e) {
799                                    throw processException(e);
800                            }
801                            finally {
802                                    if (list == null) {
803                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
804                                    }
805                                    else {
806                                            cacheResult(list);
807    
808                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
809                                    }
810    
811                                    closeSession(session);
812                            }
813                    }
814    
815                    return list;
816            }
817    
818            /**
819             * Returns the first asset vocabulary in the ordered set where uuid = &#63;.
820             *
821             * <p>
822             * 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.
823             * </p>
824             *
825             * @param uuid the uuid
826             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
827             * @return the first matching asset vocabulary
828             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
829             * @throws SystemException if a system exception occurred
830             */
831            public AssetVocabulary findByUuid_First(String uuid,
832                    OrderByComparator orderByComparator)
833                    throws NoSuchVocabularyException, SystemException {
834                    List<AssetVocabulary> list = findByUuid(uuid, 0, 1, orderByComparator);
835    
836                    if (list.isEmpty()) {
837                            StringBundler msg = new StringBundler(4);
838    
839                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
840    
841                            msg.append("uuid=");
842                            msg.append(uuid);
843    
844                            msg.append(StringPool.CLOSE_CURLY_BRACE);
845    
846                            throw new NoSuchVocabularyException(msg.toString());
847                    }
848                    else {
849                            return list.get(0);
850                    }
851            }
852    
853            /**
854             * Returns the last asset vocabulary in the ordered set where uuid = &#63;.
855             *
856             * <p>
857             * 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.
858             * </p>
859             *
860             * @param uuid the uuid
861             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
862             * @return the last matching asset vocabulary
863             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
864             * @throws SystemException if a system exception occurred
865             */
866            public AssetVocabulary findByUuid_Last(String uuid,
867                    OrderByComparator orderByComparator)
868                    throws NoSuchVocabularyException, SystemException {
869                    int count = countByUuid(uuid);
870    
871                    List<AssetVocabulary> list = findByUuid(uuid, count - 1, count,
872                                    orderByComparator);
873    
874                    if (list.isEmpty()) {
875                            StringBundler msg = new StringBundler(4);
876    
877                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
878    
879                            msg.append("uuid=");
880                            msg.append(uuid);
881    
882                            msg.append(StringPool.CLOSE_CURLY_BRACE);
883    
884                            throw new NoSuchVocabularyException(msg.toString());
885                    }
886                    else {
887                            return list.get(0);
888                    }
889            }
890    
891            /**
892             * Returns the asset vocabularies before and after the current asset vocabulary in the ordered set where uuid = &#63;.
893             *
894             * <p>
895             * 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.
896             * </p>
897             *
898             * @param vocabularyId the primary key of the current asset vocabulary
899             * @param uuid the uuid
900             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
901             * @return the previous, current, and next asset vocabulary
902             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a asset vocabulary with the primary key could not be found
903             * @throws SystemException if a system exception occurred
904             */
905            public AssetVocabulary[] findByUuid_PrevAndNext(long vocabularyId,
906                    String uuid, OrderByComparator orderByComparator)
907                    throws NoSuchVocabularyException, SystemException {
908                    AssetVocabulary assetVocabulary = findByPrimaryKey(vocabularyId);
909    
910                    Session session = null;
911    
912                    try {
913                            session = openSession();
914    
915                            AssetVocabulary[] array = new AssetVocabularyImpl[3];
916    
917                            array[0] = getByUuid_PrevAndNext(session, assetVocabulary, uuid,
918                                            orderByComparator, true);
919    
920                            array[1] = assetVocabulary;
921    
922                            array[2] = getByUuid_PrevAndNext(session, assetVocabulary, uuid,
923                                            orderByComparator, false);
924    
925                            return array;
926                    }
927                    catch (Exception e) {
928                            throw processException(e);
929                    }
930                    finally {
931                            closeSession(session);
932                    }
933            }
934    
935            protected AssetVocabulary getByUuid_PrevAndNext(Session session,
936                    AssetVocabulary assetVocabulary, String uuid,
937                    OrderByComparator orderByComparator, boolean previous) {
938                    StringBundler query = null;
939    
940                    if (orderByComparator != null) {
941                            query = new StringBundler(6 +
942                                            (orderByComparator.getOrderByFields().length * 6));
943                    }
944                    else {
945                            query = new StringBundler(3);
946                    }
947    
948                    query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
949    
950                    if (uuid == null) {
951                            query.append(_FINDER_COLUMN_UUID_UUID_1);
952                    }
953                    else {
954                            if (uuid.equals(StringPool.BLANK)) {
955                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
956                            }
957                            else {
958                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
959                            }
960                    }
961    
962                    if (orderByComparator != null) {
963                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
964    
965                            if (orderByConditionFields.length > 0) {
966                                    query.append(WHERE_AND);
967                            }
968    
969                            for (int i = 0; i < orderByConditionFields.length; i++) {
970                                    query.append(_ORDER_BY_ENTITY_ALIAS);
971                                    query.append(orderByConditionFields[i]);
972    
973                                    if ((i + 1) < orderByConditionFields.length) {
974                                            if (orderByComparator.isAscending() ^ previous) {
975                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
976                                            }
977                                            else {
978                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
979                                            }
980                                    }
981                                    else {
982                                            if (orderByComparator.isAscending() ^ previous) {
983                                                    query.append(WHERE_GREATER_THAN);
984                                            }
985                                            else {
986                                                    query.append(WHERE_LESSER_THAN);
987                                            }
988                                    }
989                            }
990    
991                            query.append(ORDER_BY_CLAUSE);
992    
993                            String[] orderByFields = orderByComparator.getOrderByFields();
994    
995                            for (int i = 0; i < orderByFields.length; i++) {
996                                    query.append(_ORDER_BY_ENTITY_ALIAS);
997                                    query.append(orderByFields[i]);
998    
999                                    if ((i + 1) < orderByFields.length) {
1000                                            if (orderByComparator.isAscending() ^ previous) {
1001                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1002                                            }
1003                                            else {
1004                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1005                                            }
1006                                    }
1007                                    else {
1008                                            if (orderByComparator.isAscending() ^ previous) {
1009                                                    query.append(ORDER_BY_ASC);
1010                                            }
1011                                            else {
1012                                                    query.append(ORDER_BY_DESC);
1013                                            }
1014                                    }
1015                            }
1016                    }
1017    
1018                    else {
1019                            query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1020                    }
1021    
1022                    String sql = query.toString();
1023    
1024                    Query q = session.createQuery(sql);
1025    
1026                    q.setFirstResult(0);
1027                    q.setMaxResults(2);
1028    
1029                    QueryPos qPos = QueryPos.getInstance(q);
1030    
1031                    if (uuid != null) {
1032                            qPos.add(uuid);
1033                    }
1034    
1035                    if (orderByComparator != null) {
1036                            Object[] values = orderByComparator.getOrderByConditionValues(assetVocabulary);
1037    
1038                            for (Object value : values) {
1039                                    qPos.add(value);
1040                            }
1041                    }
1042    
1043                    List<AssetVocabulary> list = q.list();
1044    
1045                    if (list.size() == 2) {
1046                            return list.get(1);
1047                    }
1048                    else {
1049                            return null;
1050                    }
1051            }
1052    
1053            /**
1054             * Returns the asset vocabulary where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portlet.asset.NoSuchVocabularyException} if it could not be found.
1055             *
1056             * @param uuid the uuid
1057             * @param groupId the group ID
1058             * @return the matching asset vocabulary
1059             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
1060             * @throws SystemException if a system exception occurred
1061             */
1062            public AssetVocabulary findByUUID_G(String uuid, long groupId)
1063                    throws NoSuchVocabularyException, SystemException {
1064                    AssetVocabulary assetVocabulary = fetchByUUID_G(uuid, groupId);
1065    
1066                    if (assetVocabulary == null) {
1067                            StringBundler msg = new StringBundler(6);
1068    
1069                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1070    
1071                            msg.append("uuid=");
1072                            msg.append(uuid);
1073    
1074                            msg.append(", groupId=");
1075                            msg.append(groupId);
1076    
1077                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1078    
1079                            if (_log.isWarnEnabled()) {
1080                                    _log.warn(msg.toString());
1081                            }
1082    
1083                            throw new NoSuchVocabularyException(msg.toString());
1084                    }
1085    
1086                    return assetVocabulary;
1087            }
1088    
1089            /**
1090             * Returns the asset vocabulary where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1091             *
1092             * @param uuid the uuid
1093             * @param groupId the group ID
1094             * @return the matching asset vocabulary, or <code>null</code> if a matching asset vocabulary could not be found
1095             * @throws SystemException if a system exception occurred
1096             */
1097            public AssetVocabulary fetchByUUID_G(String uuid, long groupId)
1098                    throws SystemException {
1099                    return fetchByUUID_G(uuid, groupId, true);
1100            }
1101    
1102            /**
1103             * Returns the asset vocabulary where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1104             *
1105             * @param uuid the uuid
1106             * @param groupId the group ID
1107             * @param retrieveFromCache whether to use the finder cache
1108             * @return the matching asset vocabulary, or <code>null</code> if a matching asset vocabulary could not be found
1109             * @throws SystemException if a system exception occurred
1110             */
1111            public AssetVocabulary fetchByUUID_G(String uuid, long groupId,
1112                    boolean retrieveFromCache) throws SystemException {
1113                    Object[] finderArgs = new Object[] { uuid, groupId };
1114    
1115                    Object result = null;
1116    
1117                    if (retrieveFromCache) {
1118                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1119                                            finderArgs, this);
1120                    }
1121    
1122                    if (result == null) {
1123                            StringBundler query = new StringBundler(4);
1124    
1125                            query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1126    
1127                            if (uuid == null) {
1128                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1129                            }
1130                            else {
1131                                    if (uuid.equals(StringPool.BLANK)) {
1132                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1133                                    }
1134                                    else {
1135                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1136                                    }
1137                            }
1138    
1139                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1140    
1141                            query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1142    
1143                            String sql = query.toString();
1144    
1145                            Session session = null;
1146    
1147                            try {
1148                                    session = openSession();
1149    
1150                                    Query q = session.createQuery(sql);
1151    
1152                                    QueryPos qPos = QueryPos.getInstance(q);
1153    
1154                                    if (uuid != null) {
1155                                            qPos.add(uuid);
1156                                    }
1157    
1158                                    qPos.add(groupId);
1159    
1160                                    List<AssetVocabulary> list = q.list();
1161    
1162                                    result = list;
1163    
1164                                    AssetVocabulary assetVocabulary = null;
1165    
1166                                    if (list.isEmpty()) {
1167                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1168                                                    finderArgs, list);
1169                                    }
1170                                    else {
1171                                            assetVocabulary = list.get(0);
1172    
1173                                            cacheResult(assetVocabulary);
1174    
1175                                            if ((assetVocabulary.getUuid() == null) ||
1176                                                            !assetVocabulary.getUuid().equals(uuid) ||
1177                                                            (assetVocabulary.getGroupId() != groupId)) {
1178                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1179                                                            finderArgs, assetVocabulary);
1180                                            }
1181                                    }
1182    
1183                                    return assetVocabulary;
1184                            }
1185                            catch (Exception e) {
1186                                    throw processException(e);
1187                            }
1188                            finally {
1189                                    if (result == null) {
1190                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1191                                                    finderArgs);
1192                                    }
1193    
1194                                    closeSession(session);
1195                            }
1196                    }
1197                    else {
1198                            if (result instanceof List<?>) {
1199                                    return null;
1200                            }
1201                            else {
1202                                    return (AssetVocabulary)result;
1203                            }
1204                    }
1205            }
1206    
1207            /**
1208             * Returns all the asset vocabularies where groupId = &#63;.
1209             *
1210             * @param groupId the group ID
1211             * @return the matching asset vocabularies
1212             * @throws SystemException if a system exception occurred
1213             */
1214            public List<AssetVocabulary> findByGroupId(long groupId)
1215                    throws SystemException {
1216                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1217            }
1218    
1219            /**
1220             * Returns a range of all the asset vocabularies where groupId = &#63;.
1221             *
1222             * <p>
1223             * 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.
1224             * </p>
1225             *
1226             * @param groupId the group ID
1227             * @param start the lower bound of the range of asset vocabularies
1228             * @param end the upper bound of the range of asset vocabularies (not inclusive)
1229             * @return the range of matching asset vocabularies
1230             * @throws SystemException if a system exception occurred
1231             */
1232            public List<AssetVocabulary> findByGroupId(long groupId, int start, int end)
1233                    throws SystemException {
1234                    return findByGroupId(groupId, start, end, null);
1235            }
1236    
1237            /**
1238             * Returns an ordered range of all the asset vocabularies where groupId = &#63;.
1239             *
1240             * <p>
1241             * 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.
1242             * </p>
1243             *
1244             * @param groupId the group ID
1245             * @param start the lower bound of the range of asset vocabularies
1246             * @param end the upper bound of the range of asset vocabularies (not inclusive)
1247             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1248             * @return the ordered range of matching asset vocabularies
1249             * @throws SystemException if a system exception occurred
1250             */
1251            public List<AssetVocabulary> findByGroupId(long groupId, int start,
1252                    int end, OrderByComparator orderByComparator) throws SystemException {
1253                    FinderPath finderPath = null;
1254                    Object[] finderArgs = null;
1255    
1256                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1257                                    (orderByComparator == null)) {
1258                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1259                            finderArgs = new Object[] { groupId };
1260                    }
1261                    else {
1262                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1263                            finderArgs = new Object[] { groupId, start, end, orderByComparator };
1264                    }
1265    
1266                    List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(finderPath,
1267                                    finderArgs, this);
1268    
1269                    if (list == null) {
1270                            StringBundler query = null;
1271    
1272                            if (orderByComparator != null) {
1273                                    query = new StringBundler(3 +
1274                                                    (orderByComparator.getOrderByFields().length * 3));
1275                            }
1276                            else {
1277                                    query = new StringBundler(3);
1278                            }
1279    
1280                            query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1281    
1282                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1283    
1284                            if (orderByComparator != null) {
1285                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1286                                            orderByComparator);
1287                            }
1288    
1289                            else {
1290                                    query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1291                            }
1292    
1293                            String sql = query.toString();
1294    
1295                            Session session = null;
1296    
1297                            try {
1298                                    session = openSession();
1299    
1300                                    Query q = session.createQuery(sql);
1301    
1302                                    QueryPos qPos = QueryPos.getInstance(q);
1303    
1304                                    qPos.add(groupId);
1305    
1306                                    list = (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
1307                                                    start, end);
1308                            }
1309                            catch (Exception e) {
1310                                    throw processException(e);
1311                            }
1312                            finally {
1313                                    if (list == null) {
1314                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1315                                    }
1316                                    else {
1317                                            cacheResult(list);
1318    
1319                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1320                                    }
1321    
1322                                    closeSession(session);
1323                            }
1324                    }
1325    
1326                    return list;
1327            }
1328    
1329            /**
1330             * Returns the first asset vocabulary in the ordered set where groupId = &#63;.
1331             *
1332             * <p>
1333             * 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.
1334             * </p>
1335             *
1336             * @param groupId the group ID
1337             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1338             * @return the first matching asset vocabulary
1339             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
1340             * @throws SystemException if a system exception occurred
1341             */
1342            public AssetVocabulary findByGroupId_First(long groupId,
1343                    OrderByComparator orderByComparator)
1344                    throws NoSuchVocabularyException, SystemException {
1345                    List<AssetVocabulary> list = findByGroupId(groupId, 0, 1,
1346                                    orderByComparator);
1347    
1348                    if (list.isEmpty()) {
1349                            StringBundler msg = new StringBundler(4);
1350    
1351                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1352    
1353                            msg.append("groupId=");
1354                            msg.append(groupId);
1355    
1356                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1357    
1358                            throw new NoSuchVocabularyException(msg.toString());
1359                    }
1360                    else {
1361                            return list.get(0);
1362                    }
1363            }
1364    
1365            /**
1366             * Returns the last asset vocabulary in the ordered set where groupId = &#63;.
1367             *
1368             * <p>
1369             * 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.
1370             * </p>
1371             *
1372             * @param groupId the group ID
1373             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1374             * @return the last matching asset vocabulary
1375             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
1376             * @throws SystemException if a system exception occurred
1377             */
1378            public AssetVocabulary findByGroupId_Last(long groupId,
1379                    OrderByComparator orderByComparator)
1380                    throws NoSuchVocabularyException, SystemException {
1381                    int count = countByGroupId(groupId);
1382    
1383                    List<AssetVocabulary> list = findByGroupId(groupId, count - 1, count,
1384                                    orderByComparator);
1385    
1386                    if (list.isEmpty()) {
1387                            StringBundler msg = new StringBundler(4);
1388    
1389                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1390    
1391                            msg.append("groupId=");
1392                            msg.append(groupId);
1393    
1394                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1395    
1396                            throw new NoSuchVocabularyException(msg.toString());
1397                    }
1398                    else {
1399                            return list.get(0);
1400                    }
1401            }
1402    
1403            /**
1404             * Returns the asset vocabularies before and after the current asset vocabulary in the ordered set where groupId = &#63;.
1405             *
1406             * <p>
1407             * 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.
1408             * </p>
1409             *
1410             * @param vocabularyId the primary key of the current asset vocabulary
1411             * @param groupId the group ID
1412             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1413             * @return the previous, current, and next asset vocabulary
1414             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a asset vocabulary with the primary key could not be found
1415             * @throws SystemException if a system exception occurred
1416             */
1417            public AssetVocabulary[] findByGroupId_PrevAndNext(long vocabularyId,
1418                    long groupId, OrderByComparator orderByComparator)
1419                    throws NoSuchVocabularyException, SystemException {
1420                    AssetVocabulary assetVocabulary = findByPrimaryKey(vocabularyId);
1421    
1422                    Session session = null;
1423    
1424                    try {
1425                            session = openSession();
1426    
1427                            AssetVocabulary[] array = new AssetVocabularyImpl[3];
1428    
1429                            array[0] = getByGroupId_PrevAndNext(session, assetVocabulary,
1430                                            groupId, orderByComparator, true);
1431    
1432                            array[1] = assetVocabulary;
1433    
1434                            array[2] = getByGroupId_PrevAndNext(session, assetVocabulary,
1435                                            groupId, orderByComparator, false);
1436    
1437                            return array;
1438                    }
1439                    catch (Exception e) {
1440                            throw processException(e);
1441                    }
1442                    finally {
1443                            closeSession(session);
1444                    }
1445            }
1446    
1447            protected AssetVocabulary getByGroupId_PrevAndNext(Session session,
1448                    AssetVocabulary assetVocabulary, long groupId,
1449                    OrderByComparator orderByComparator, boolean previous) {
1450                    StringBundler query = null;
1451    
1452                    if (orderByComparator != null) {
1453                            query = new StringBundler(6 +
1454                                            (orderByComparator.getOrderByFields().length * 6));
1455                    }
1456                    else {
1457                            query = new StringBundler(3);
1458                    }
1459    
1460                    query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1461    
1462                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1463    
1464                    if (orderByComparator != null) {
1465                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1466    
1467                            if (orderByConditionFields.length > 0) {
1468                                    query.append(WHERE_AND);
1469                            }
1470    
1471                            for (int i = 0; i < orderByConditionFields.length; i++) {
1472                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1473                                    query.append(orderByConditionFields[i]);
1474    
1475                                    if ((i + 1) < orderByConditionFields.length) {
1476                                            if (orderByComparator.isAscending() ^ previous) {
1477                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1478                                            }
1479                                            else {
1480                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1481                                            }
1482                                    }
1483                                    else {
1484                                            if (orderByComparator.isAscending() ^ previous) {
1485                                                    query.append(WHERE_GREATER_THAN);
1486                                            }
1487                                            else {
1488                                                    query.append(WHERE_LESSER_THAN);
1489                                            }
1490                                    }
1491                            }
1492    
1493                            query.append(ORDER_BY_CLAUSE);
1494    
1495                            String[] orderByFields = orderByComparator.getOrderByFields();
1496    
1497                            for (int i = 0; i < orderByFields.length; i++) {
1498                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1499                                    query.append(orderByFields[i]);
1500    
1501                                    if ((i + 1) < orderByFields.length) {
1502                                            if (orderByComparator.isAscending() ^ previous) {
1503                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1504                                            }
1505                                            else {
1506                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1507                                            }
1508                                    }
1509                                    else {
1510                                            if (orderByComparator.isAscending() ^ previous) {
1511                                                    query.append(ORDER_BY_ASC);
1512                                            }
1513                                            else {
1514                                                    query.append(ORDER_BY_DESC);
1515                                            }
1516                                    }
1517                            }
1518                    }
1519    
1520                    else {
1521                            query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1522                    }
1523    
1524                    String sql = query.toString();
1525    
1526                    Query q = session.createQuery(sql);
1527    
1528                    q.setFirstResult(0);
1529                    q.setMaxResults(2);
1530    
1531                    QueryPos qPos = QueryPos.getInstance(q);
1532    
1533                    qPos.add(groupId);
1534    
1535                    if (orderByComparator != null) {
1536                            Object[] values = orderByComparator.getOrderByConditionValues(assetVocabulary);
1537    
1538                            for (Object value : values) {
1539                                    qPos.add(value);
1540                            }
1541                    }
1542    
1543                    List<AssetVocabulary> list = q.list();
1544    
1545                    if (list.size() == 2) {
1546                            return list.get(1);
1547                    }
1548                    else {
1549                            return null;
1550                    }
1551            }
1552    
1553            /**
1554             * Returns all the asset vocabularies that the user has permission to view where groupId = &#63;.
1555             *
1556             * @param groupId the group ID
1557             * @return the matching asset vocabularies that the user has permission to view
1558             * @throws SystemException if a system exception occurred
1559             */
1560            public List<AssetVocabulary> filterFindByGroupId(long groupId)
1561                    throws SystemException {
1562                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1563                            QueryUtil.ALL_POS, null);
1564            }
1565    
1566            /**
1567             * Returns a range of all the asset vocabularies that the user has permission to view where groupId = &#63;.
1568             *
1569             * <p>
1570             * 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.
1571             * </p>
1572             *
1573             * @param groupId the group ID
1574             * @param start the lower bound of the range of asset vocabularies
1575             * @param end the upper bound of the range of asset vocabularies (not inclusive)
1576             * @return the range of matching asset vocabularies that the user has permission to view
1577             * @throws SystemException if a system exception occurred
1578             */
1579            public List<AssetVocabulary> filterFindByGroupId(long groupId, int start,
1580                    int end) throws SystemException {
1581                    return filterFindByGroupId(groupId, start, end, null);
1582            }
1583    
1584            /**
1585             * Returns an ordered range of all the asset vocabularies that the user has permissions to view where groupId = &#63;.
1586             *
1587             * <p>
1588             * 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.
1589             * </p>
1590             *
1591             * @param groupId the group ID
1592             * @param start the lower bound of the range of asset vocabularies
1593             * @param end the upper bound of the range of asset vocabularies (not inclusive)
1594             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1595             * @return the ordered range of matching asset vocabularies that the user has permission to view
1596             * @throws SystemException if a system exception occurred
1597             */
1598            public List<AssetVocabulary> filterFindByGroupId(long groupId, int start,
1599                    int end, OrderByComparator orderByComparator) throws SystemException {
1600                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1601                            return findByGroupId(groupId, start, end, orderByComparator);
1602                    }
1603    
1604                    StringBundler query = null;
1605    
1606                    if (orderByComparator != null) {
1607                            query = new StringBundler(3 +
1608                                            (orderByComparator.getOrderByFields().length * 3));
1609                    }
1610                    else {
1611                            query = new StringBundler(3);
1612                    }
1613    
1614                    if (getDB().isSupportsInlineDistinct()) {
1615                            query.append(_FILTER_SQL_SELECT_ASSETVOCABULARY_WHERE);
1616                    }
1617                    else {
1618                            query.append(_FILTER_SQL_SELECT_ASSETVOCABULARY_NO_INLINE_DISTINCT_WHERE_1);
1619                    }
1620    
1621                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1622    
1623                    if (!getDB().isSupportsInlineDistinct()) {
1624                            query.append(_FILTER_SQL_SELECT_ASSETVOCABULARY_NO_INLINE_DISTINCT_WHERE_2);
1625                    }
1626    
1627                    if (orderByComparator != null) {
1628                            if (getDB().isSupportsInlineDistinct()) {
1629                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1630                                            orderByComparator);
1631                            }
1632                            else {
1633                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1634                                            orderByComparator);
1635                            }
1636                    }
1637    
1638                    else {
1639                            if (getDB().isSupportsInlineDistinct()) {
1640                                    query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1641                            }
1642                            else {
1643                                    query.append(AssetVocabularyModelImpl.ORDER_BY_SQL);
1644                            }
1645                    }
1646    
1647                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1648                                    AssetVocabulary.class.getName(),
1649                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1650    
1651                    Session session = null;
1652    
1653                    try {
1654                            session = openSession();
1655    
1656                            SQLQuery q = session.createSQLQuery(sql);
1657    
1658                            if (getDB().isSupportsInlineDistinct()) {
1659                                    q.addEntity(_FILTER_ENTITY_ALIAS, AssetVocabularyImpl.class);
1660                            }
1661                            else {
1662                                    q.addEntity(_FILTER_ENTITY_TABLE, AssetVocabularyImpl.class);
1663                            }
1664    
1665                            QueryPos qPos = QueryPos.getInstance(q);
1666    
1667                            qPos.add(groupId);
1668    
1669                            return (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
1670                                    start, end);
1671                    }
1672                    catch (Exception e) {
1673                            throw processException(e);
1674                    }
1675                    finally {
1676                            closeSession(session);
1677                    }
1678            }
1679    
1680            /**
1681             * Returns the asset vocabularies before and after the current asset vocabulary in the ordered set of asset vocabularies that the user has permission to view where groupId = &#63;.
1682             *
1683             * @param vocabularyId the primary key of the current asset vocabulary
1684             * @param groupId the group ID
1685             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1686             * @return the previous, current, and next asset vocabulary
1687             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a asset vocabulary with the primary key could not be found
1688             * @throws SystemException if a system exception occurred
1689             */
1690            public AssetVocabulary[] filterFindByGroupId_PrevAndNext(
1691                    long vocabularyId, long groupId, OrderByComparator orderByComparator)
1692                    throws NoSuchVocabularyException, SystemException {
1693                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1694                            return findByGroupId_PrevAndNext(vocabularyId, groupId,
1695                                    orderByComparator);
1696                    }
1697    
1698                    AssetVocabulary assetVocabulary = findByPrimaryKey(vocabularyId);
1699    
1700                    Session session = null;
1701    
1702                    try {
1703                            session = openSession();
1704    
1705                            AssetVocabulary[] array = new AssetVocabularyImpl[3];
1706    
1707                            array[0] = filterGetByGroupId_PrevAndNext(session, assetVocabulary,
1708                                            groupId, orderByComparator, true);
1709    
1710                            array[1] = assetVocabulary;
1711    
1712                            array[2] = filterGetByGroupId_PrevAndNext(session, assetVocabulary,
1713                                            groupId, orderByComparator, false);
1714    
1715                            return array;
1716                    }
1717                    catch (Exception e) {
1718                            throw processException(e);
1719                    }
1720                    finally {
1721                            closeSession(session);
1722                    }
1723            }
1724    
1725            protected AssetVocabulary filterGetByGroupId_PrevAndNext(Session session,
1726                    AssetVocabulary assetVocabulary, long groupId,
1727                    OrderByComparator orderByComparator, boolean previous) {
1728                    StringBundler query = null;
1729    
1730                    if (orderByComparator != null) {
1731                            query = new StringBundler(6 +
1732                                            (orderByComparator.getOrderByFields().length * 6));
1733                    }
1734                    else {
1735                            query = new StringBundler(3);
1736                    }
1737    
1738                    if (getDB().isSupportsInlineDistinct()) {
1739                            query.append(_FILTER_SQL_SELECT_ASSETVOCABULARY_WHERE);
1740                    }
1741                    else {
1742                            query.append(_FILTER_SQL_SELECT_ASSETVOCABULARY_NO_INLINE_DISTINCT_WHERE_1);
1743                    }
1744    
1745                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1746    
1747                    if (!getDB().isSupportsInlineDistinct()) {
1748                            query.append(_FILTER_SQL_SELECT_ASSETVOCABULARY_NO_INLINE_DISTINCT_WHERE_2);
1749                    }
1750    
1751                    if (orderByComparator != null) {
1752                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1753    
1754                            if (orderByConditionFields.length > 0) {
1755                                    query.append(WHERE_AND);
1756                            }
1757    
1758                            for (int i = 0; i < orderByConditionFields.length; i++) {
1759                                    if (getDB().isSupportsInlineDistinct()) {
1760                                            query.append(_ORDER_BY_ENTITY_ALIAS);
1761                                    }
1762                                    else {
1763                                            query.append(_ORDER_BY_ENTITY_TABLE);
1764                                    }
1765    
1766                                    query.append(orderByConditionFields[i]);
1767    
1768                                    if ((i + 1) < orderByConditionFields.length) {
1769                                            if (orderByComparator.isAscending() ^ previous) {
1770                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1771                                            }
1772                                            else {
1773                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1774                                            }
1775                                    }
1776                                    else {
1777                                            if (orderByComparator.isAscending() ^ previous) {
1778                                                    query.append(WHERE_GREATER_THAN);
1779                                            }
1780                                            else {
1781                                                    query.append(WHERE_LESSER_THAN);
1782                                            }
1783                                    }
1784                            }
1785    
1786                            query.append(ORDER_BY_CLAUSE);
1787    
1788                            String[] orderByFields = orderByComparator.getOrderByFields();
1789    
1790                            for (int i = 0; i < orderByFields.length; i++) {
1791                                    if (getDB().isSupportsInlineDistinct()) {
1792                                            query.append(_ORDER_BY_ENTITY_ALIAS);
1793                                    }
1794                                    else {
1795                                            query.append(_ORDER_BY_ENTITY_TABLE);
1796                                    }
1797    
1798                                    query.append(orderByFields[i]);
1799    
1800                                    if ((i + 1) < orderByFields.length) {
1801                                            if (orderByComparator.isAscending() ^ previous) {
1802                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1803                                            }
1804                                            else {
1805                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1806                                            }
1807                                    }
1808                                    else {
1809                                            if (orderByComparator.isAscending() ^ previous) {
1810                                                    query.append(ORDER_BY_ASC);
1811                                            }
1812                                            else {
1813                                                    query.append(ORDER_BY_DESC);
1814                                            }
1815                                    }
1816                            }
1817                    }
1818    
1819                    else {
1820                            if (getDB().isSupportsInlineDistinct()) {
1821                                    query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1822                            }
1823                            else {
1824                                    query.append(AssetVocabularyModelImpl.ORDER_BY_SQL);
1825                            }
1826                    }
1827    
1828                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1829                                    AssetVocabulary.class.getName(),
1830                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1831    
1832                    SQLQuery q = session.createSQLQuery(sql);
1833    
1834                    q.setFirstResult(0);
1835                    q.setMaxResults(2);
1836    
1837                    if (getDB().isSupportsInlineDistinct()) {
1838                            q.addEntity(_FILTER_ENTITY_ALIAS, AssetVocabularyImpl.class);
1839                    }
1840                    else {
1841                            q.addEntity(_FILTER_ENTITY_TABLE, AssetVocabularyImpl.class);
1842                    }
1843    
1844                    QueryPos qPos = QueryPos.getInstance(q);
1845    
1846                    qPos.add(groupId);
1847    
1848                    if (orderByComparator != null) {
1849                            Object[] values = orderByComparator.getOrderByConditionValues(assetVocabulary);
1850    
1851                            for (Object value : values) {
1852                                    qPos.add(value);
1853                            }
1854                    }
1855    
1856                    List<AssetVocabulary> list = q.list();
1857    
1858                    if (list.size() == 2) {
1859                            return list.get(1);
1860                    }
1861                    else {
1862                            return null;
1863                    }
1864            }
1865    
1866            /**
1867             * Returns all the asset vocabularies where companyId = &#63;.
1868             *
1869             * @param companyId the company ID
1870             * @return the matching asset vocabularies
1871             * @throws SystemException if a system exception occurred
1872             */
1873            public List<AssetVocabulary> findByCompanyId(long companyId)
1874                    throws SystemException {
1875                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1876                            null);
1877            }
1878    
1879            /**
1880             * Returns a range of all the asset vocabularies where companyId = &#63;.
1881             *
1882             * <p>
1883             * 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.
1884             * </p>
1885             *
1886             * @param companyId the company ID
1887             * @param start the lower bound of the range of asset vocabularies
1888             * @param end the upper bound of the range of asset vocabularies (not inclusive)
1889             * @return the range of matching asset vocabularies
1890             * @throws SystemException if a system exception occurred
1891             */
1892            public List<AssetVocabulary> findByCompanyId(long companyId, int start,
1893                    int end) throws SystemException {
1894                    return findByCompanyId(companyId, start, end, null);
1895            }
1896    
1897            /**
1898             * Returns an ordered range of all the asset vocabularies where companyId = &#63;.
1899             *
1900             * <p>
1901             * 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.
1902             * </p>
1903             *
1904             * @param companyId the company ID
1905             * @param start the lower bound of the range of asset vocabularies
1906             * @param end the upper bound of the range of asset vocabularies (not inclusive)
1907             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1908             * @return the ordered range of matching asset vocabularies
1909             * @throws SystemException if a system exception occurred
1910             */
1911            public List<AssetVocabulary> findByCompanyId(long companyId, int start,
1912                    int end, OrderByComparator orderByComparator) throws SystemException {
1913                    FinderPath finderPath = null;
1914                    Object[] finderArgs = null;
1915    
1916                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1917                                    (orderByComparator == null)) {
1918                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1919                            finderArgs = new Object[] { companyId };
1920                    }
1921                    else {
1922                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1923                            finderArgs = new Object[] { companyId, start, end, orderByComparator };
1924                    }
1925    
1926                    List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(finderPath,
1927                                    finderArgs, this);
1928    
1929                    if (list == null) {
1930                            StringBundler query = null;
1931    
1932                            if (orderByComparator != null) {
1933                                    query = new StringBundler(3 +
1934                                                    (orderByComparator.getOrderByFields().length * 3));
1935                            }
1936                            else {
1937                                    query = new StringBundler(3);
1938                            }
1939    
1940                            query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1941    
1942                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1943    
1944                            if (orderByComparator != null) {
1945                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1946                                            orderByComparator);
1947                            }
1948    
1949                            else {
1950                                    query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1951                            }
1952    
1953                            String sql = query.toString();
1954    
1955                            Session session = null;
1956    
1957                            try {
1958                                    session = openSession();
1959    
1960                                    Query q = session.createQuery(sql);
1961    
1962                                    QueryPos qPos = QueryPos.getInstance(q);
1963    
1964                                    qPos.add(companyId);
1965    
1966                                    list = (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
1967                                                    start, end);
1968                            }
1969                            catch (Exception e) {
1970                                    throw processException(e);
1971                            }
1972                            finally {
1973                                    if (list == null) {
1974                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1975                                    }
1976                                    else {
1977                                            cacheResult(list);
1978    
1979                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1980                                    }
1981    
1982                                    closeSession(session);
1983                            }
1984                    }
1985    
1986                    return list;
1987            }
1988    
1989            /**
1990             * Returns the first asset vocabulary in the ordered set where companyId = &#63;.
1991             *
1992             * <p>
1993             * 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.
1994             * </p>
1995             *
1996             * @param companyId the company ID
1997             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1998             * @return the first matching asset vocabulary
1999             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
2000             * @throws SystemException if a system exception occurred
2001             */
2002            public AssetVocabulary findByCompanyId_First(long companyId,
2003                    OrderByComparator orderByComparator)
2004                    throws NoSuchVocabularyException, SystemException {
2005                    List<AssetVocabulary> list = findByCompanyId(companyId, 0, 1,
2006                                    orderByComparator);
2007    
2008                    if (list.isEmpty()) {
2009                            StringBundler msg = new StringBundler(4);
2010    
2011                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2012    
2013                            msg.append("companyId=");
2014                            msg.append(companyId);
2015    
2016                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2017    
2018                            throw new NoSuchVocabularyException(msg.toString());
2019                    }
2020                    else {
2021                            return list.get(0);
2022                    }
2023            }
2024    
2025            /**
2026             * Returns the last asset vocabulary in the ordered set where companyId = &#63;.
2027             *
2028             * <p>
2029             * 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.
2030             * </p>
2031             *
2032             * @param companyId the company ID
2033             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2034             * @return the last matching asset vocabulary
2035             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
2036             * @throws SystemException if a system exception occurred
2037             */
2038            public AssetVocabulary findByCompanyId_Last(long companyId,
2039                    OrderByComparator orderByComparator)
2040                    throws NoSuchVocabularyException, SystemException {
2041                    int count = countByCompanyId(companyId);
2042    
2043                    List<AssetVocabulary> list = findByCompanyId(companyId, count - 1,
2044                                    count, orderByComparator);
2045    
2046                    if (list.isEmpty()) {
2047                            StringBundler msg = new StringBundler(4);
2048    
2049                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2050    
2051                            msg.append("companyId=");
2052                            msg.append(companyId);
2053    
2054                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2055    
2056                            throw new NoSuchVocabularyException(msg.toString());
2057                    }
2058                    else {
2059                            return list.get(0);
2060                    }
2061            }
2062    
2063            /**
2064             * Returns the asset vocabularies before and after the current asset vocabulary in the ordered set where companyId = &#63;.
2065             *
2066             * <p>
2067             * 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.
2068             * </p>
2069             *
2070             * @param vocabularyId the primary key of the current asset vocabulary
2071             * @param companyId the company ID
2072             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2073             * @return the previous, current, and next asset vocabulary
2074             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a asset vocabulary with the primary key could not be found
2075             * @throws SystemException if a system exception occurred
2076             */
2077            public AssetVocabulary[] findByCompanyId_PrevAndNext(long vocabularyId,
2078                    long companyId, OrderByComparator orderByComparator)
2079                    throws NoSuchVocabularyException, SystemException {
2080                    AssetVocabulary assetVocabulary = findByPrimaryKey(vocabularyId);
2081    
2082                    Session session = null;
2083    
2084                    try {
2085                            session = openSession();
2086    
2087                            AssetVocabulary[] array = new AssetVocabularyImpl[3];
2088    
2089                            array[0] = getByCompanyId_PrevAndNext(session, assetVocabulary,
2090                                            companyId, orderByComparator, true);
2091    
2092                            array[1] = assetVocabulary;
2093    
2094                            array[2] = getByCompanyId_PrevAndNext(session, assetVocabulary,
2095                                            companyId, orderByComparator, false);
2096    
2097                            return array;
2098                    }
2099                    catch (Exception e) {
2100                            throw processException(e);
2101                    }
2102                    finally {
2103                            closeSession(session);
2104                    }
2105            }
2106    
2107            protected AssetVocabulary getByCompanyId_PrevAndNext(Session session,
2108                    AssetVocabulary assetVocabulary, long companyId,
2109                    OrderByComparator orderByComparator, boolean previous) {
2110                    StringBundler query = null;
2111    
2112                    if (orderByComparator != null) {
2113                            query = new StringBundler(6 +
2114                                            (orderByComparator.getOrderByFields().length * 6));
2115                    }
2116                    else {
2117                            query = new StringBundler(3);
2118                    }
2119    
2120                    query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
2121    
2122                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2123    
2124                    if (orderByComparator != null) {
2125                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2126    
2127                            if (orderByConditionFields.length > 0) {
2128                                    query.append(WHERE_AND);
2129                            }
2130    
2131                            for (int i = 0; i < orderByConditionFields.length; i++) {
2132                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2133                                    query.append(orderByConditionFields[i]);
2134    
2135                                    if ((i + 1) < orderByConditionFields.length) {
2136                                            if (orderByComparator.isAscending() ^ previous) {
2137                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2138                                            }
2139                                            else {
2140                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2141                                            }
2142                                    }
2143                                    else {
2144                                            if (orderByComparator.isAscending() ^ previous) {
2145                                                    query.append(WHERE_GREATER_THAN);
2146                                            }
2147                                            else {
2148                                                    query.append(WHERE_LESSER_THAN);
2149                                            }
2150                                    }
2151                            }
2152    
2153                            query.append(ORDER_BY_CLAUSE);
2154    
2155                            String[] orderByFields = orderByComparator.getOrderByFields();
2156    
2157                            for (int i = 0; i < orderByFields.length; i++) {
2158                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2159                                    query.append(orderByFields[i]);
2160    
2161                                    if ((i + 1) < orderByFields.length) {
2162                                            if (orderByComparator.isAscending() ^ previous) {
2163                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2164                                            }
2165                                            else {
2166                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2167                                            }
2168                                    }
2169                                    else {
2170                                            if (orderByComparator.isAscending() ^ previous) {
2171                                                    query.append(ORDER_BY_ASC);
2172                                            }
2173                                            else {
2174                                                    query.append(ORDER_BY_DESC);
2175                                            }
2176                                    }
2177                            }
2178                    }
2179    
2180                    else {
2181                            query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
2182                    }
2183    
2184                    String sql = query.toString();
2185    
2186                    Query q = session.createQuery(sql);
2187    
2188                    q.setFirstResult(0);
2189                    q.setMaxResults(2);
2190    
2191                    QueryPos qPos = QueryPos.getInstance(q);
2192    
2193                    qPos.add(companyId);
2194    
2195                    if (orderByComparator != null) {
2196                            Object[] values = orderByComparator.getOrderByConditionValues(assetVocabulary);
2197    
2198                            for (Object value : values) {
2199                                    qPos.add(value);
2200                            }
2201                    }
2202    
2203                    List<AssetVocabulary> list = q.list();
2204    
2205                    if (list.size() == 2) {
2206                            return list.get(1);
2207                    }
2208                    else {
2209                            return null;
2210                    }
2211            }
2212    
2213            /**
2214             * Returns the asset vocabulary where groupId = &#63; and name = &#63; or throws a {@link com.liferay.portlet.asset.NoSuchVocabularyException} if it could not be found.
2215             *
2216             * @param groupId the group ID
2217             * @param name the name
2218             * @return the matching asset vocabulary
2219             * @throws com.liferay.portlet.asset.NoSuchVocabularyException if a matching asset vocabulary could not be found
2220             * @throws SystemException if a system exception occurred
2221             */
2222            public AssetVocabulary findByG_N(long groupId, String name)
2223                    throws NoSuchVocabularyException, SystemException {
2224                    AssetVocabulary assetVocabulary = fetchByG_N(groupId, name);
2225    
2226                    if (assetVocabulary == null) {
2227                            StringBundler msg = new StringBundler(6);
2228    
2229                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2230    
2231                            msg.append("groupId=");
2232                            msg.append(groupId);
2233    
2234                            msg.append(", name=");
2235                            msg.append(name);
2236    
2237                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2238    
2239                            if (_log.isWarnEnabled()) {
2240                                    _log.warn(msg.toString());
2241                            }
2242    
2243                            throw new NoSuchVocabularyException(msg.toString());
2244                    }
2245    
2246                    return assetVocabulary;
2247            }
2248    
2249            /**
2250             * Returns the asset vocabulary where groupId = &#63; and name = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
2251             *
2252             * @param groupId the group ID
2253             * @param name the name
2254             * @return the matching asset vocabulary, or <code>null</code> if a matching asset vocabulary could not be found
2255             * @throws SystemException if a system exception occurred
2256             */
2257            public AssetVocabulary fetchByG_N(long groupId, String name)
2258                    throws SystemException {
2259                    return fetchByG_N(groupId, name, true);
2260            }
2261    
2262            /**
2263             * Returns the asset vocabulary where groupId = &#63; and name = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
2264             *
2265             * @param groupId the group ID
2266             * @param name the name
2267             * @param retrieveFromCache whether to use the finder cache
2268             * @return the matching asset vocabulary, or <code>null</code> if a matching asset vocabulary could not be found
2269             * @throws SystemException if a system exception occurred
2270             */
2271            public AssetVocabulary fetchByG_N(long groupId, String name,
2272                    boolean retrieveFromCache) throws SystemException {
2273                    Object[] finderArgs = new Object[] { groupId, name };
2274    
2275                    Object result = null;
2276    
2277                    if (retrieveFromCache) {
2278                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N,
2279                                            finderArgs, this);
2280                    }
2281    
2282                    if (result == null) {
2283                            StringBundler query = new StringBundler(4);
2284    
2285                            query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
2286    
2287                            query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2288    
2289                            if (name == null) {
2290                                    query.append(_FINDER_COLUMN_G_N_NAME_1);
2291                            }
2292                            else {
2293                                    if (name.equals(StringPool.BLANK)) {
2294                                            query.append(_FINDER_COLUMN_G_N_NAME_3);
2295                                    }
2296                                    else {
2297                                            query.append(_FINDER_COLUMN_G_N_NAME_2);
2298                                    }
2299                            }
2300    
2301                            query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
2302    
2303                            String sql = query.toString();
2304    
2305                            Session session = null;
2306    
2307                            try {
2308                                    session = openSession();
2309    
2310                                    Query q = session.createQuery(sql);
2311    
2312                                    QueryPos qPos = QueryPos.getInstance(q);
2313    
2314                                    qPos.add(groupId);
2315    
2316                                    if (name != null) {
2317                                            qPos.add(name);
2318                                    }
2319    
2320                                    List<AssetVocabulary> list = q.list();
2321    
2322                                    result = list;
2323    
2324                                    AssetVocabulary assetVocabulary = null;
2325    
2326                                    if (list.isEmpty()) {
2327                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
2328                                                    finderArgs, list);
2329                                    }
2330                                    else {
2331                                            assetVocabulary = list.get(0);
2332    
2333                                            cacheResult(assetVocabulary);
2334    
2335                                            if ((assetVocabulary.getGroupId() != groupId) ||
2336                                                            (assetVocabulary.getName() == null) ||
2337                                                            !assetVocabulary.getName().equals(name)) {
2338                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
2339                                                            finderArgs, assetVocabulary);
2340                                            }
2341                                    }
2342    
2343                                    return assetVocabulary;
2344                            }
2345                            catch (Exception e) {
2346                                    throw processException(e);
2347                            }
2348                            finally {
2349                                    if (result == null) {
2350                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
2351                                                    finderArgs);
2352                                    }
2353    
2354                                    closeSession(session);
2355                            }
2356                    }
2357                    else {
2358                            if (result instanceof List<?>) {
2359                                    return null;
2360                            }
2361                            else {
2362                                    return (AssetVocabulary)result;
2363                            }
2364                    }
2365            }
2366    
2367            /**
2368             * Returns all the asset vocabularies.
2369             *
2370             * @return the asset vocabularies
2371             * @throws SystemException if a system exception occurred
2372             */
2373            public List<AssetVocabulary> findAll() throws SystemException {
2374                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2375            }
2376    
2377            /**
2378             * Returns a range of all the asset vocabularies.
2379             *
2380             * <p>
2381             * 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.
2382             * </p>
2383             *
2384             * @param start the lower bound of the range of asset vocabularies
2385             * @param end the upper bound of the range of asset vocabularies (not inclusive)
2386             * @return the range of asset vocabularies
2387             * @throws SystemException if a system exception occurred
2388             */
2389            public List<AssetVocabulary> findAll(int start, int end)
2390                    throws SystemException {
2391                    return findAll(start, end, null);
2392            }
2393    
2394            /**
2395             * Returns an ordered range of all the asset vocabularies.
2396             *
2397             * <p>
2398             * 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.
2399             * </p>
2400             *
2401             * @param start the lower bound of the range of asset vocabularies
2402             * @param end the upper bound of the range of asset vocabularies (not inclusive)
2403             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2404             * @return the ordered range of asset vocabularies
2405             * @throws SystemException if a system exception occurred
2406             */
2407            public List<AssetVocabulary> findAll(int start, int end,
2408                    OrderByComparator orderByComparator) throws SystemException {
2409                    FinderPath finderPath = null;
2410                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
2411    
2412                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2413                                    (orderByComparator == null)) {
2414                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2415                            finderArgs = FINDER_ARGS_EMPTY;
2416                    }
2417                    else {
2418                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2419                            finderArgs = new Object[] { start, end, orderByComparator };
2420                    }
2421    
2422                    List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(finderPath,
2423                                    finderArgs, this);
2424    
2425                    if (list == null) {
2426                            StringBundler query = null;
2427                            String sql = null;
2428    
2429                            if (orderByComparator != null) {
2430                                    query = new StringBundler(2 +
2431                                                    (orderByComparator.getOrderByFields().length * 3));
2432    
2433                                    query.append(_SQL_SELECT_ASSETVOCABULARY);
2434    
2435                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2436                                            orderByComparator);
2437    
2438                                    sql = query.toString();
2439                            }
2440                            else {
2441                                    sql = _SQL_SELECT_ASSETVOCABULARY.concat(AssetVocabularyModelImpl.ORDER_BY_JPQL);
2442                            }
2443    
2444                            Session session = null;
2445    
2446                            try {
2447                                    session = openSession();
2448    
2449                                    Query q = session.createQuery(sql);
2450    
2451                                    if (orderByComparator == null) {
2452                                            list = (List<AssetVocabulary>)QueryUtil.list(q,
2453                                                            getDialect(), start, end, false);
2454    
2455                                            Collections.sort(list);
2456                                    }
2457                                    else {
2458                                            list = (List<AssetVocabulary>)QueryUtil.list(q,
2459                                                            getDialect(), start, end);
2460                                    }
2461                            }
2462                            catch (Exception e) {
2463                                    throw processException(e);
2464                            }
2465                            finally {
2466                                    if (list == null) {
2467                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2468                                    }
2469                                    else {
2470                                            cacheResult(list);
2471    
2472                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
2473                                    }
2474    
2475                                    closeSession(session);
2476                            }
2477                    }
2478    
2479                    return list;
2480            }
2481    
2482            /**
2483             * Removes all the asset vocabularies where uuid = &#63; from the database.
2484             *
2485             * @param uuid the uuid
2486             * @throws SystemException if a system exception occurred
2487             */
2488            public void removeByUuid(String uuid) throws SystemException {
2489                    for (AssetVocabulary assetVocabulary : findByUuid(uuid)) {
2490                            assetVocabularyPersistence.remove(assetVocabulary);
2491                    }
2492            }
2493    
2494            /**
2495             * Removes the asset vocabulary where uuid = &#63; and groupId = &#63; from the database.
2496             *
2497             * @param uuid the uuid
2498             * @param groupId the group ID
2499             * @throws SystemException if a system exception occurred
2500             */
2501            public void removeByUUID_G(String uuid, long groupId)
2502                    throws NoSuchVocabularyException, SystemException {
2503                    AssetVocabulary assetVocabulary = findByUUID_G(uuid, groupId);
2504    
2505                    assetVocabularyPersistence.remove(assetVocabulary);
2506            }
2507    
2508            /**
2509             * Removes all the asset vocabularies where groupId = &#63; from the database.
2510             *
2511             * @param groupId the group ID
2512             * @throws SystemException if a system exception occurred
2513             */
2514            public void removeByGroupId(long groupId) throws SystemException {
2515                    for (AssetVocabulary assetVocabulary : findByGroupId(groupId)) {
2516                            assetVocabularyPersistence.remove(assetVocabulary);
2517                    }
2518            }
2519    
2520            /**
2521             * Removes all the asset vocabularies where companyId = &#63; from the database.
2522             *
2523             * @param companyId the company ID
2524             * @throws SystemException if a system exception occurred
2525             */
2526            public void removeByCompanyId(long companyId) throws SystemException {
2527                    for (AssetVocabulary assetVocabulary : findByCompanyId(companyId)) {
2528                            assetVocabularyPersistence.remove(assetVocabulary);
2529                    }
2530            }
2531    
2532            /**
2533             * Removes the asset vocabulary where groupId = &#63; and name = &#63; from the database.
2534             *
2535             * @param groupId the group ID
2536             * @param name the name
2537             * @throws SystemException if a system exception occurred
2538             */
2539            public void removeByG_N(long groupId, String name)
2540                    throws NoSuchVocabularyException, SystemException {
2541                    AssetVocabulary assetVocabulary = findByG_N(groupId, name);
2542    
2543                    assetVocabularyPersistence.remove(assetVocabulary);
2544            }
2545    
2546            /**
2547             * Removes all the asset vocabularies from the database.
2548             *
2549             * @throws SystemException if a system exception occurred
2550             */
2551            public void removeAll() throws SystemException {
2552                    for (AssetVocabulary assetVocabulary : findAll()) {
2553                            assetVocabularyPersistence.remove(assetVocabulary);
2554                    }
2555            }
2556    
2557            /**
2558             * Returns the number of asset vocabularies where uuid = &#63;.
2559             *
2560             * @param uuid the uuid
2561             * @return the number of matching asset vocabularies
2562             * @throws SystemException if a system exception occurred
2563             */
2564            public int countByUuid(String uuid) throws SystemException {
2565                    Object[] finderArgs = new Object[] { uuid };
2566    
2567                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2568                                    finderArgs, this);
2569    
2570                    if (count == null) {
2571                            StringBundler query = new StringBundler(2);
2572    
2573                            query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
2574    
2575                            if (uuid == null) {
2576                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
2577                            }
2578                            else {
2579                                    if (uuid.equals(StringPool.BLANK)) {
2580                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
2581                                    }
2582                                    else {
2583                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
2584                                    }
2585                            }
2586    
2587                            String sql = query.toString();
2588    
2589                            Session session = null;
2590    
2591                            try {
2592                                    session = openSession();
2593    
2594                                    Query q = session.createQuery(sql);
2595    
2596                                    QueryPos qPos = QueryPos.getInstance(q);
2597    
2598                                    if (uuid != null) {
2599                                            qPos.add(uuid);
2600                                    }
2601    
2602                                    count = (Long)q.uniqueResult();
2603                            }
2604                            catch (Exception e) {
2605                                    throw processException(e);
2606                            }
2607                            finally {
2608                                    if (count == null) {
2609                                            count = Long.valueOf(0);
2610                                    }
2611    
2612                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2613                                            finderArgs, count);
2614    
2615                                    closeSession(session);
2616                            }
2617                    }
2618    
2619                    return count.intValue();
2620            }
2621    
2622            /**
2623             * Returns the number of asset vocabularies where uuid = &#63; and groupId = &#63;.
2624             *
2625             * @param uuid the uuid
2626             * @param groupId the group ID
2627             * @return the number of matching asset vocabularies
2628             * @throws SystemException if a system exception occurred
2629             */
2630            public int countByUUID_G(String uuid, long groupId)
2631                    throws SystemException {
2632                    Object[] finderArgs = new Object[] { uuid, groupId };
2633    
2634                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2635                                    finderArgs, this);
2636    
2637                    if (count == null) {
2638                            StringBundler query = new StringBundler(3);
2639    
2640                            query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
2641    
2642                            if (uuid == null) {
2643                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2644                            }
2645                            else {
2646                                    if (uuid.equals(StringPool.BLANK)) {
2647                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2648                                    }
2649                                    else {
2650                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2651                                    }
2652                            }
2653    
2654                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2655    
2656                            String sql = query.toString();
2657    
2658                            Session session = null;
2659    
2660                            try {
2661                                    session = openSession();
2662    
2663                                    Query q = session.createQuery(sql);
2664    
2665                                    QueryPos qPos = QueryPos.getInstance(q);
2666    
2667                                    if (uuid != null) {
2668                                            qPos.add(uuid);
2669                                    }
2670    
2671                                    qPos.add(groupId);
2672    
2673                                    count = (Long)q.uniqueResult();
2674                            }
2675                            catch (Exception e) {
2676                                    throw processException(e);
2677                            }
2678                            finally {
2679                                    if (count == null) {
2680                                            count = Long.valueOf(0);
2681                                    }
2682    
2683                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2684                                            finderArgs, count);
2685    
2686                                    closeSession(session);
2687                            }
2688                    }
2689    
2690                    return count.intValue();
2691            }
2692    
2693            /**
2694             * Returns the number of asset vocabularies where groupId = &#63;.
2695             *
2696             * @param groupId the group ID
2697             * @return the number of matching asset vocabularies
2698             * @throws SystemException if a system exception occurred
2699             */
2700            public int countByGroupId(long groupId) throws SystemException {
2701                    Object[] finderArgs = new Object[] { groupId };
2702    
2703                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2704                                    finderArgs, this);
2705    
2706                    if (count == null) {
2707                            StringBundler query = new StringBundler(2);
2708    
2709                            query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
2710    
2711                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2712    
2713                            String sql = query.toString();
2714    
2715                            Session session = null;
2716    
2717                            try {
2718                                    session = openSession();
2719    
2720                                    Query q = session.createQuery(sql);
2721    
2722                                    QueryPos qPos = QueryPos.getInstance(q);
2723    
2724                                    qPos.add(groupId);
2725    
2726                                    count = (Long)q.uniqueResult();
2727                            }
2728                            catch (Exception e) {
2729                                    throw processException(e);
2730                            }
2731                            finally {
2732                                    if (count == null) {
2733                                            count = Long.valueOf(0);
2734                                    }
2735    
2736                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2737                                            finderArgs, count);
2738    
2739                                    closeSession(session);
2740                            }
2741                    }
2742    
2743                    return count.intValue();
2744            }
2745    
2746            /**
2747             * Returns the number of asset vocabularies that the user has permission to view where groupId = &#63;.
2748             *
2749             * @param groupId the group ID
2750             * @return the number of matching asset vocabularies that the user has permission to view
2751             * @throws SystemException if a system exception occurred
2752             */
2753            public int filterCountByGroupId(long groupId) throws SystemException {
2754                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2755                            return countByGroupId(groupId);
2756                    }
2757    
2758                    StringBundler query = new StringBundler(2);
2759    
2760                    query.append(_FILTER_SQL_COUNT_ASSETVOCABULARY_WHERE);
2761    
2762                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2763    
2764                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2765                                    AssetVocabulary.class.getName(),
2766                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2767    
2768                    Session session = null;
2769    
2770                    try {
2771                            session = openSession();
2772    
2773                            SQLQuery q = session.createSQLQuery(sql);
2774    
2775                            q.addScalar(COUNT_COLUMN_NAME,
2776                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
2777    
2778                            QueryPos qPos = QueryPos.getInstance(q);
2779    
2780                            qPos.add(groupId);
2781    
2782                            Long count = (Long)q.uniqueResult();
2783    
2784                            return count.intValue();
2785                    }
2786                    catch (Exception e) {
2787                            throw processException(e);
2788                    }
2789                    finally {
2790                            closeSession(session);
2791                    }
2792            }
2793    
2794            /**
2795             * Returns the number of asset vocabularies where companyId = &#63;.
2796             *
2797             * @param companyId the company ID
2798             * @return the number of matching asset vocabularies
2799             * @throws SystemException if a system exception occurred
2800             */
2801            public int countByCompanyId(long companyId) throws SystemException {
2802                    Object[] finderArgs = new Object[] { companyId };
2803    
2804                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2805                                    finderArgs, this);
2806    
2807                    if (count == null) {
2808                            StringBundler query = new StringBundler(2);
2809    
2810                            query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
2811    
2812                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2813    
2814                            String sql = query.toString();
2815    
2816                            Session session = null;
2817    
2818                            try {
2819                                    session = openSession();
2820    
2821                                    Query q = session.createQuery(sql);
2822    
2823                                    QueryPos qPos = QueryPos.getInstance(q);
2824    
2825                                    qPos.add(companyId);
2826    
2827                                    count = (Long)q.uniqueResult();
2828                            }
2829                            catch (Exception e) {
2830                                    throw processException(e);
2831                            }
2832                            finally {
2833                                    if (count == null) {
2834                                            count = Long.valueOf(0);
2835                                    }
2836    
2837                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2838                                            finderArgs, count);
2839    
2840                                    closeSession(session);
2841                            }
2842                    }
2843    
2844                    return count.intValue();
2845            }
2846    
2847            /**
2848             * Returns the number of asset vocabularies where groupId = &#63; and name = &#63;.
2849             *
2850             * @param groupId the group ID
2851             * @param name the name
2852             * @return the number of matching asset vocabularies
2853             * @throws SystemException if a system exception occurred
2854             */
2855            public int countByG_N(long groupId, String name) throws SystemException {
2856                    Object[] finderArgs = new Object[] { groupId, name };
2857    
2858                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N,
2859                                    finderArgs, this);
2860    
2861                    if (count == null) {
2862                            StringBundler query = new StringBundler(3);
2863    
2864                            query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
2865    
2866                            query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2867    
2868                            if (name == null) {
2869                                    query.append(_FINDER_COLUMN_G_N_NAME_1);
2870                            }
2871                            else {
2872                                    if (name.equals(StringPool.BLANK)) {
2873                                            query.append(_FINDER_COLUMN_G_N_NAME_3);
2874                                    }
2875                                    else {
2876                                            query.append(_FINDER_COLUMN_G_N_NAME_2);
2877                                    }
2878                            }
2879    
2880                            String sql = query.toString();
2881    
2882                            Session session = null;
2883    
2884                            try {
2885                                    session = openSession();
2886    
2887                                    Query q = session.createQuery(sql);
2888    
2889                                    QueryPos qPos = QueryPos.getInstance(q);
2890    
2891                                    qPos.add(groupId);
2892    
2893                                    if (name != null) {
2894                                            qPos.add(name);
2895                                    }
2896    
2897                                    count = (Long)q.uniqueResult();
2898                            }
2899                            catch (Exception e) {
2900                                    throw processException(e);
2901                            }
2902                            finally {
2903                                    if (count == null) {
2904                                            count = Long.valueOf(0);
2905                                    }
2906    
2907                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, finderArgs,
2908                                            count);
2909    
2910                                    closeSession(session);
2911                            }
2912                    }
2913    
2914                    return count.intValue();
2915            }
2916    
2917            /**
2918             * Returns the number of asset vocabularies.
2919             *
2920             * @return the number of asset vocabularies
2921             * @throws SystemException if a system exception occurred
2922             */
2923            public int countAll() throws SystemException {
2924                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2925                                    FINDER_ARGS_EMPTY, this);
2926    
2927                    if (count == null) {
2928                            Session session = null;
2929    
2930                            try {
2931                                    session = openSession();
2932    
2933                                    Query q = session.createQuery(_SQL_COUNT_ASSETVOCABULARY);
2934    
2935                                    count = (Long)q.uniqueResult();
2936                            }
2937                            catch (Exception e) {
2938                                    throw processException(e);
2939                            }
2940                            finally {
2941                                    if (count == null) {
2942                                            count = Long.valueOf(0);
2943                                    }
2944    
2945                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2946                                            FINDER_ARGS_EMPTY, count);
2947    
2948                                    closeSession(session);
2949                            }
2950                    }
2951    
2952                    return count.intValue();
2953            }
2954    
2955            /**
2956             * Initializes the asset vocabulary persistence.
2957             */
2958            public void afterPropertiesSet() {
2959                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2960                                            com.liferay.portal.util.PropsUtil.get(
2961                                                    "value.object.listener.com.liferay.portlet.asset.model.AssetVocabulary")));
2962    
2963                    if (listenerClassNames.length > 0) {
2964                            try {
2965                                    List<ModelListener<AssetVocabulary>> listenersList = new ArrayList<ModelListener<AssetVocabulary>>();
2966    
2967                                    for (String listenerClassName : listenerClassNames) {
2968                                            listenersList.add((ModelListener<AssetVocabulary>)InstanceFactory.newInstance(
2969                                                            listenerClassName));
2970                                    }
2971    
2972                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2973                            }
2974                            catch (Exception e) {
2975                                    _log.error(e);
2976                            }
2977                    }
2978            }
2979    
2980            public void destroy() {
2981                    EntityCacheUtil.removeCache(AssetVocabularyImpl.class.getName());
2982                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2983                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2984            }
2985    
2986            @BeanReference(type = AssetCategoryPersistence.class)
2987            protected AssetCategoryPersistence assetCategoryPersistence;
2988            @BeanReference(type = AssetCategoryPropertyPersistence.class)
2989            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
2990            @BeanReference(type = AssetEntryPersistence.class)
2991            protected AssetEntryPersistence assetEntryPersistence;
2992            @BeanReference(type = AssetLinkPersistence.class)
2993            protected AssetLinkPersistence assetLinkPersistence;
2994            @BeanReference(type = AssetTagPersistence.class)
2995            protected AssetTagPersistence assetTagPersistence;
2996            @BeanReference(type = AssetTagPropertyPersistence.class)
2997            protected AssetTagPropertyPersistence assetTagPropertyPersistence;
2998            @BeanReference(type = AssetTagStatsPersistence.class)
2999            protected AssetTagStatsPersistence assetTagStatsPersistence;
3000            @BeanReference(type = AssetVocabularyPersistence.class)
3001            protected AssetVocabularyPersistence assetVocabularyPersistence;
3002            @BeanReference(type = GroupPersistence.class)
3003            protected GroupPersistence groupPersistence;
3004            @BeanReference(type = ResourcePersistence.class)
3005            protected ResourcePersistence resourcePersistence;
3006            @BeanReference(type = UserPersistence.class)
3007            protected UserPersistence userPersistence;
3008            private static final String _SQL_SELECT_ASSETVOCABULARY = "SELECT assetVocabulary FROM AssetVocabulary assetVocabulary";
3009            private static final String _SQL_SELECT_ASSETVOCABULARY_WHERE = "SELECT assetVocabulary FROM AssetVocabulary assetVocabulary WHERE ";
3010            private static final String _SQL_COUNT_ASSETVOCABULARY = "SELECT COUNT(assetVocabulary) FROM AssetVocabulary assetVocabulary";
3011            private static final String _SQL_COUNT_ASSETVOCABULARY_WHERE = "SELECT COUNT(assetVocabulary) FROM AssetVocabulary assetVocabulary WHERE ";
3012            private static final String _FINDER_COLUMN_UUID_UUID_1 = "assetVocabulary.uuid IS NULL";
3013            private static final String _FINDER_COLUMN_UUID_UUID_2 = "assetVocabulary.uuid = ?";
3014            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(assetVocabulary.uuid IS NULL OR assetVocabulary.uuid = ?)";
3015            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "assetVocabulary.uuid IS NULL AND ";
3016            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "assetVocabulary.uuid = ? AND ";
3017            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(assetVocabulary.uuid IS NULL OR assetVocabulary.uuid = ?) AND ";
3018            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "assetVocabulary.groupId = ?";
3019            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "assetVocabulary.groupId = ?";
3020            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "assetVocabulary.companyId = ?";
3021            private static final String _FINDER_COLUMN_G_N_GROUPID_2 = "assetVocabulary.groupId = ? AND ";
3022            private static final String _FINDER_COLUMN_G_N_NAME_1 = "assetVocabulary.name IS NULL";
3023            private static final String _FINDER_COLUMN_G_N_NAME_2 = "assetVocabulary.name = ?";
3024            private static final String _FINDER_COLUMN_G_N_NAME_3 = "(assetVocabulary.name IS NULL OR assetVocabulary.name = ?)";
3025            private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "assetVocabulary.vocabularyId";
3026            private static final String _FILTER_SQL_SELECT_ASSETVOCABULARY_WHERE = "SELECT DISTINCT {assetVocabulary.*} FROM AssetVocabulary assetVocabulary WHERE ";
3027            private static final String _FILTER_SQL_SELECT_ASSETVOCABULARY_NO_INLINE_DISTINCT_WHERE_1 =
3028                    "SELECT {AssetVocabulary.*} FROM (SELECT DISTINCT assetVocabulary.vocabularyId FROM AssetVocabulary assetVocabulary WHERE ";
3029            private static final String _FILTER_SQL_SELECT_ASSETVOCABULARY_NO_INLINE_DISTINCT_WHERE_2 =
3030                    ") TEMP_TABLE INNER JOIN AssetVocabulary ON TEMP_TABLE.vocabularyId = AssetVocabulary.vocabularyId";
3031            private static final String _FILTER_SQL_COUNT_ASSETVOCABULARY_WHERE = "SELECT COUNT(DISTINCT assetVocabulary.vocabularyId) AS COUNT_VALUE FROM AssetVocabulary assetVocabulary WHERE ";
3032            private static final String _FILTER_ENTITY_ALIAS = "assetVocabulary";
3033            private static final String _FILTER_ENTITY_TABLE = "AssetVocabulary";
3034            private static final String _ORDER_BY_ENTITY_ALIAS = "assetVocabulary.";
3035            private static final String _ORDER_BY_ENTITY_TABLE = "AssetVocabulary.";
3036            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetVocabulary exists with the primary key ";
3037            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetVocabulary exists with the key {";
3038            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3039            private static Log _log = LogFactoryUtil.getLog(AssetVocabularyPersistenceImpl.class);
3040            private static AssetVocabulary _nullAssetVocabulary = new AssetVocabularyImpl() {
3041                            @Override
3042                            public Object clone() {
3043                                    return this;
3044                            }
3045    
3046                            @Override
3047                            public CacheModel<AssetVocabulary> toCacheModel() {
3048                                    return _nullAssetVocabularyCacheModel;
3049                            }
3050                    };
3051    
3052            private static CacheModel<AssetVocabulary> _nullAssetVocabularyCacheModel = new CacheModel<AssetVocabulary>() {
3053                            public AssetVocabulary toEntityModel() {
3054                                    return _nullAssetVocabulary;
3055                            }
3056                    };
3057    }