1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.asset.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.annotation.BeanReference;
19  import com.liferay.portal.kernel.cache.CacheRegistry;
20  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
21  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderPath;
23  import com.liferay.portal.kernel.dao.orm.Query;
24  import com.liferay.portal.kernel.dao.orm.QueryPos;
25  import com.liferay.portal.kernel.dao.orm.QueryUtil;
26  import com.liferay.portal.kernel.dao.orm.SQLQuery;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.dao.orm.Type;
29  import com.liferay.portal.kernel.exception.SystemException;
30  import com.liferay.portal.kernel.log.Log;
31  import com.liferay.portal.kernel.log.LogFactoryUtil;
32  import com.liferay.portal.kernel.util.GetterUtil;
33  import com.liferay.portal.kernel.util.InstanceFactory;
34  import com.liferay.portal.kernel.util.OrderByComparator;
35  import com.liferay.portal.kernel.util.StringBundler;
36  import com.liferay.portal.kernel.util.StringPool;
37  import com.liferay.portal.kernel.util.StringUtil;
38  import com.liferay.portal.kernel.util.Validator;
39  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
40  import com.liferay.portal.model.ModelListener;
41  import com.liferay.portal.security.permission.InlineSQLHelperUtil;
42  import com.liferay.portal.service.persistence.BatchSessionUtil;
43  import com.liferay.portal.service.persistence.GroupPersistence;
44  import com.liferay.portal.service.persistence.ResourcePersistence;
45  import com.liferay.portal.service.persistence.UserPersistence;
46  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
47  
48  import com.liferay.portlet.asset.NoSuchVocabularyException;
49  import com.liferay.portlet.asset.model.AssetVocabulary;
50  import com.liferay.portlet.asset.model.impl.AssetVocabularyImpl;
51  import com.liferay.portlet.asset.model.impl.AssetVocabularyModelImpl;
52  
53  import java.io.Serializable;
54  
55  import java.util.ArrayList;
56  import java.util.Collections;
57  import java.util.List;
58  
59  /**
60   * <a href="AssetVocabularyPersistenceImpl.java.html"><b><i>View Source</i></b></a>
61   *
62   * <p>
63   * ServiceBuilder generated this class. Modifications in this class will be
64   * overwritten the next time is generated.
65   * </p>
66   *
67   * @author    Brian Wing Shun Chan
68   * @see       AssetVocabularyPersistence
69   * @see       AssetVocabularyUtil
70   * @generated
71   */
72  public class AssetVocabularyPersistenceImpl extends BasePersistenceImpl<AssetVocabulary>
73      implements AssetVocabularyPersistence {
74      public static final String FINDER_CLASS_NAME_ENTITY = AssetVocabularyImpl.class.getName();
75      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
76          ".List";
77      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
78              AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
79              FINDER_CLASS_NAME_LIST, "findByUuid",
80              new String[] {
81                  String.class.getName(),
82                  
83              "java.lang.Integer", "java.lang.Integer",
84                  "com.liferay.portal.kernel.util.OrderByComparator"
85              });
86      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
87              AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
88              FINDER_CLASS_NAME_LIST, "countByUuid",
89              new String[] { String.class.getName() });
90      public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
91              AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
92              FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
93              new String[] { String.class.getName(), Long.class.getName() });
94      public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
95              AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
96              FINDER_CLASS_NAME_LIST, "countByUUID_G",
97              new String[] { String.class.getName(), Long.class.getName() });
98      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
99              AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
100             FINDER_CLASS_NAME_LIST, "findByGroupId",
101             new String[] {
102                 Long.class.getName(),
103                 
104             "java.lang.Integer", "java.lang.Integer",
105                 "com.liferay.portal.kernel.util.OrderByComparator"
106             });
107     public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
108             AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
109             FINDER_CLASS_NAME_LIST, "countByGroupId",
110             new String[] { Long.class.getName() });
111     public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
112             AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
113             FINDER_CLASS_NAME_LIST, "findByCompanyId",
114             new String[] {
115                 Long.class.getName(),
116                 
117             "java.lang.Integer", "java.lang.Integer",
118                 "com.liferay.portal.kernel.util.OrderByComparator"
119             });
120     public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
121             AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
122             FINDER_CLASS_NAME_LIST, "countByCompanyId",
123             new String[] { Long.class.getName() });
124     public static final FinderPath FINDER_PATH_FETCH_BY_G_N = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
125             AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
126             FINDER_CLASS_NAME_ENTITY, "fetchByG_N",
127             new String[] { Long.class.getName(), String.class.getName() });
128     public static final FinderPath FINDER_PATH_COUNT_BY_G_N = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
129             AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
130             FINDER_CLASS_NAME_LIST, "countByG_N",
131             new String[] { Long.class.getName(), String.class.getName() });
132     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
133             AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
134             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
135     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
136             AssetVocabularyModelImpl.FINDER_CACHE_ENABLED,
137             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
138 
139     public void cacheResult(AssetVocabulary assetVocabulary) {
140         EntityCacheUtil.putResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
141             AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey(),
142             assetVocabulary);
143 
144         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
145             new Object[] {
146                 assetVocabulary.getUuid(),
147                 new Long(assetVocabulary.getGroupId())
148             }, assetVocabulary);
149 
150         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
151             new Object[] {
152                 new Long(assetVocabulary.getGroupId()),
153                 
154             assetVocabulary.getName()
155             }, assetVocabulary);
156     }
157 
158     public void cacheResult(List<AssetVocabulary> assetVocabularies) {
159         for (AssetVocabulary assetVocabulary : assetVocabularies) {
160             if (EntityCacheUtil.getResult(
161                         AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
162                         AssetVocabularyImpl.class,
163                         assetVocabulary.getPrimaryKey(), this) == null) {
164                 cacheResult(assetVocabulary);
165             }
166         }
167     }
168 
169     public void clearCache() {
170         CacheRegistry.clear(AssetVocabularyImpl.class.getName());
171         EntityCacheUtil.clearCache(AssetVocabularyImpl.class.getName());
172         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
173         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
174     }
175 
176     public void clearCache(AssetVocabulary assetVocabulary) {
177         EntityCacheUtil.removeResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
178             AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey());
179 
180         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
181             new Object[] {
182                 assetVocabulary.getUuid(),
183                 new Long(assetVocabulary.getGroupId())
184             });
185 
186         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
187             new Object[] {
188                 new Long(assetVocabulary.getGroupId()),
189                 
190             assetVocabulary.getName()
191             });
192     }
193 
194     public AssetVocabulary create(long vocabularyId) {
195         AssetVocabulary assetVocabulary = new AssetVocabularyImpl();
196 
197         assetVocabulary.setNew(true);
198         assetVocabulary.setPrimaryKey(vocabularyId);
199 
200         String uuid = PortalUUIDUtil.generate();
201 
202         assetVocabulary.setUuid(uuid);
203 
204         return assetVocabulary;
205     }
206 
207     public AssetVocabulary remove(Serializable primaryKey)
208         throws NoSuchModelException, SystemException {
209         return remove(((Long)primaryKey).longValue());
210     }
211 
212     public AssetVocabulary remove(long vocabularyId)
213         throws NoSuchVocabularyException, SystemException {
214         Session session = null;
215 
216         try {
217             session = openSession();
218 
219             AssetVocabulary assetVocabulary = (AssetVocabulary)session.get(AssetVocabularyImpl.class,
220                     new Long(vocabularyId));
221 
222             if (assetVocabulary == null) {
223                 if (_log.isWarnEnabled()) {
224                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + vocabularyId);
225                 }
226 
227                 throw new NoSuchVocabularyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
228                     vocabularyId);
229             }
230 
231             return remove(assetVocabulary);
232         }
233         catch (NoSuchVocabularyException nsee) {
234             throw nsee;
235         }
236         catch (Exception e) {
237             throw processException(e);
238         }
239         finally {
240             closeSession(session);
241         }
242     }
243 
244     public AssetVocabulary remove(AssetVocabulary assetVocabulary)
245         throws SystemException {
246         for (ModelListener<AssetVocabulary> listener : listeners) {
247             listener.onBeforeRemove(assetVocabulary);
248         }
249 
250         assetVocabulary = removeImpl(assetVocabulary);
251 
252         for (ModelListener<AssetVocabulary> listener : listeners) {
253             listener.onAfterRemove(assetVocabulary);
254         }
255 
256         return assetVocabulary;
257     }
258 
259     protected AssetVocabulary removeImpl(AssetVocabulary assetVocabulary)
260         throws SystemException {
261         assetVocabulary = toUnwrappedModel(assetVocabulary);
262 
263         Session session = null;
264 
265         try {
266             session = openSession();
267 
268             if (assetVocabulary.isCachedModel() ||
269                     BatchSessionUtil.isEnabled()) {
270                 Object staleObject = session.get(AssetVocabularyImpl.class,
271                         assetVocabulary.getPrimaryKeyObj());
272 
273                 if (staleObject != null) {
274                     session.evict(staleObject);
275                 }
276             }
277 
278             session.delete(assetVocabulary);
279 
280             session.flush();
281         }
282         catch (Exception e) {
283             throw processException(e);
284         }
285         finally {
286             closeSession(session);
287         }
288 
289         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
290 
291         AssetVocabularyModelImpl assetVocabularyModelImpl = (AssetVocabularyModelImpl)assetVocabulary;
292 
293         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
294             new Object[] {
295                 assetVocabularyModelImpl.getOriginalUuid(),
296                 new Long(assetVocabularyModelImpl.getOriginalGroupId())
297             });
298 
299         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
300             new Object[] {
301                 new Long(assetVocabularyModelImpl.getOriginalGroupId()),
302                 
303             assetVocabularyModelImpl.getOriginalName()
304             });
305 
306         EntityCacheUtil.removeResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
307             AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey());
308 
309         return assetVocabulary;
310     }
311 
312     public AssetVocabulary updateImpl(
313         com.liferay.portlet.asset.model.AssetVocabulary assetVocabulary,
314         boolean merge) throws SystemException {
315         assetVocabulary = toUnwrappedModel(assetVocabulary);
316 
317         boolean isNew = assetVocabulary.isNew();
318 
319         AssetVocabularyModelImpl assetVocabularyModelImpl = (AssetVocabularyModelImpl)assetVocabulary;
320 
321         if (Validator.isNull(assetVocabulary.getUuid())) {
322             String uuid = PortalUUIDUtil.generate();
323 
324             assetVocabulary.setUuid(uuid);
325         }
326 
327         Session session = null;
328 
329         try {
330             session = openSession();
331 
332             BatchSessionUtil.update(session, assetVocabulary, merge);
333 
334             assetVocabulary.setNew(false);
335         }
336         catch (Exception e) {
337             throw processException(e);
338         }
339         finally {
340             closeSession(session);
341         }
342 
343         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
344 
345         EntityCacheUtil.putResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
346             AssetVocabularyImpl.class, assetVocabulary.getPrimaryKey(),
347             assetVocabulary);
348 
349         if (!isNew &&
350                 (!Validator.equals(assetVocabulary.getUuid(),
351                     assetVocabularyModelImpl.getOriginalUuid()) ||
352                 (assetVocabulary.getGroupId() != assetVocabularyModelImpl.getOriginalGroupId()))) {
353             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
354                 new Object[] {
355                     assetVocabularyModelImpl.getOriginalUuid(),
356                     new Long(assetVocabularyModelImpl.getOriginalGroupId())
357                 });
358         }
359 
360         if (isNew ||
361                 (!Validator.equals(assetVocabulary.getUuid(),
362                     assetVocabularyModelImpl.getOriginalUuid()) ||
363                 (assetVocabulary.getGroupId() != assetVocabularyModelImpl.getOriginalGroupId()))) {
364             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
365                 new Object[] {
366                     assetVocabulary.getUuid(),
367                     new Long(assetVocabulary.getGroupId())
368                 }, assetVocabulary);
369         }
370 
371         if (!isNew &&
372                 ((assetVocabulary.getGroupId() != assetVocabularyModelImpl.getOriginalGroupId()) ||
373                 !Validator.equals(assetVocabulary.getName(),
374                     assetVocabularyModelImpl.getOriginalName()))) {
375             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
376                 new Object[] {
377                     new Long(assetVocabularyModelImpl.getOriginalGroupId()),
378                     
379                 assetVocabularyModelImpl.getOriginalName()
380                 });
381         }
382 
383         if (isNew ||
384                 ((assetVocabulary.getGroupId() != assetVocabularyModelImpl.getOriginalGroupId()) ||
385                 !Validator.equals(assetVocabulary.getName(),
386                     assetVocabularyModelImpl.getOriginalName()))) {
387             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
388                 new Object[] {
389                     new Long(assetVocabulary.getGroupId()),
390                     
391                 assetVocabulary.getName()
392                 }, assetVocabulary);
393         }
394 
395         return assetVocabulary;
396     }
397 
398     protected AssetVocabulary toUnwrappedModel(AssetVocabulary assetVocabulary) {
399         if (assetVocabulary instanceof AssetVocabularyImpl) {
400             return assetVocabulary;
401         }
402 
403         AssetVocabularyImpl assetVocabularyImpl = new AssetVocabularyImpl();
404 
405         assetVocabularyImpl.setNew(assetVocabulary.isNew());
406         assetVocabularyImpl.setPrimaryKey(assetVocabulary.getPrimaryKey());
407 
408         assetVocabularyImpl.setUuid(assetVocabulary.getUuid());
409         assetVocabularyImpl.setVocabularyId(assetVocabulary.getVocabularyId());
410         assetVocabularyImpl.setGroupId(assetVocabulary.getGroupId());
411         assetVocabularyImpl.setCompanyId(assetVocabulary.getCompanyId());
412         assetVocabularyImpl.setUserId(assetVocabulary.getUserId());
413         assetVocabularyImpl.setUserName(assetVocabulary.getUserName());
414         assetVocabularyImpl.setCreateDate(assetVocabulary.getCreateDate());
415         assetVocabularyImpl.setModifiedDate(assetVocabulary.getModifiedDate());
416         assetVocabularyImpl.setName(assetVocabulary.getName());
417         assetVocabularyImpl.setTitle(assetVocabulary.getTitle());
418         assetVocabularyImpl.setDescription(assetVocabulary.getDescription());
419         assetVocabularyImpl.setSettings(assetVocabulary.getSettings());
420 
421         return assetVocabularyImpl;
422     }
423 
424     public AssetVocabulary findByPrimaryKey(Serializable primaryKey)
425         throws NoSuchModelException, SystemException {
426         return findByPrimaryKey(((Long)primaryKey).longValue());
427     }
428 
429     public AssetVocabulary findByPrimaryKey(long vocabularyId)
430         throws NoSuchVocabularyException, SystemException {
431         AssetVocabulary assetVocabulary = fetchByPrimaryKey(vocabularyId);
432 
433         if (assetVocabulary == null) {
434             if (_log.isWarnEnabled()) {
435                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + vocabularyId);
436             }
437 
438             throw new NoSuchVocabularyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
439                 vocabularyId);
440         }
441 
442         return assetVocabulary;
443     }
444 
445     public AssetVocabulary fetchByPrimaryKey(Serializable primaryKey)
446         throws SystemException {
447         return fetchByPrimaryKey(((Long)primaryKey).longValue());
448     }
449 
450     public AssetVocabulary fetchByPrimaryKey(long vocabularyId)
451         throws SystemException {
452         AssetVocabulary assetVocabulary = (AssetVocabulary)EntityCacheUtil.getResult(AssetVocabularyModelImpl.ENTITY_CACHE_ENABLED,
453                 AssetVocabularyImpl.class, vocabularyId, this);
454 
455         if (assetVocabulary == null) {
456             Session session = null;
457 
458             try {
459                 session = openSession();
460 
461                 assetVocabulary = (AssetVocabulary)session.get(AssetVocabularyImpl.class,
462                         new Long(vocabularyId));
463             }
464             catch (Exception e) {
465                 throw processException(e);
466             }
467             finally {
468                 if (assetVocabulary != null) {
469                     cacheResult(assetVocabulary);
470                 }
471 
472                 closeSession(session);
473             }
474         }
475 
476         return assetVocabulary;
477     }
478 
479     public List<AssetVocabulary> findByUuid(String uuid)
480         throws SystemException {
481         return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
482     }
483 
484     public List<AssetVocabulary> findByUuid(String uuid, int start, int end)
485         throws SystemException {
486         return findByUuid(uuid, start, end, null);
487     }
488 
489     public List<AssetVocabulary> findByUuid(String uuid, int start, int end,
490         OrderByComparator orderByComparator) throws SystemException {
491         Object[] finderArgs = new Object[] {
492                 uuid,
493                 
494                 String.valueOf(start), String.valueOf(end),
495                 String.valueOf(orderByComparator)
496             };
497 
498         List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
499                 finderArgs, this);
500 
501         if (list == null) {
502             Session session = null;
503 
504             try {
505                 session = openSession();
506 
507                 StringBundler query = null;
508 
509                 if (orderByComparator != null) {
510                     query = new StringBundler(3 +
511                             (orderByComparator.getOrderByFields().length * 3));
512                 }
513                 else {
514                     query = new StringBundler(3);
515                 }
516 
517                 query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
518 
519                 if (uuid == null) {
520                     query.append(_FINDER_COLUMN_UUID_UUID_1);
521                 }
522                 else {
523                     if (uuid.equals(StringPool.BLANK)) {
524                         query.append(_FINDER_COLUMN_UUID_UUID_3);
525                     }
526                     else {
527                         query.append(_FINDER_COLUMN_UUID_UUID_2);
528                     }
529                 }
530 
531                 if (orderByComparator != null) {
532                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
533                         orderByComparator);
534                 }
535 
536                 else {
537                     query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
538                 }
539 
540                 String sql = query.toString();
541 
542                 Query q = session.createQuery(sql);
543 
544                 QueryPos qPos = QueryPos.getInstance(q);
545 
546                 if (uuid != null) {
547                     qPos.add(uuid);
548                 }
549 
550                 list = (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
551                         start, end);
552             }
553             catch (Exception e) {
554                 throw processException(e);
555             }
556             finally {
557                 if (list == null) {
558                     list = new ArrayList<AssetVocabulary>();
559                 }
560 
561                 cacheResult(list);
562 
563                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
564                     list);
565 
566                 closeSession(session);
567             }
568         }
569 
570         return list;
571     }
572 
573     public AssetVocabulary findByUuid_First(String uuid,
574         OrderByComparator orderByComparator)
575         throws NoSuchVocabularyException, SystemException {
576         List<AssetVocabulary> list = findByUuid(uuid, 0, 1, orderByComparator);
577 
578         if (list.isEmpty()) {
579             StringBundler msg = new StringBundler(4);
580 
581             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
582 
583             msg.append("uuid=");
584             msg.append(uuid);
585 
586             msg.append(StringPool.CLOSE_CURLY_BRACE);
587 
588             throw new NoSuchVocabularyException(msg.toString());
589         }
590         else {
591             return list.get(0);
592         }
593     }
594 
595     public AssetVocabulary findByUuid_Last(String uuid,
596         OrderByComparator orderByComparator)
597         throws NoSuchVocabularyException, SystemException {
598         int count = countByUuid(uuid);
599 
600         List<AssetVocabulary> list = findByUuid(uuid, count - 1, count,
601                 orderByComparator);
602 
603         if (list.isEmpty()) {
604             StringBundler msg = new StringBundler(4);
605 
606             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
607 
608             msg.append("uuid=");
609             msg.append(uuid);
610 
611             msg.append(StringPool.CLOSE_CURLY_BRACE);
612 
613             throw new NoSuchVocabularyException(msg.toString());
614         }
615         else {
616             return list.get(0);
617         }
618     }
619 
620     public AssetVocabulary[] findByUuid_PrevAndNext(long vocabularyId,
621         String uuid, OrderByComparator orderByComparator)
622         throws NoSuchVocabularyException, SystemException {
623         AssetVocabulary assetVocabulary = findByPrimaryKey(vocabularyId);
624 
625         Session session = null;
626 
627         try {
628             session = openSession();
629 
630             AssetVocabulary[] array = new AssetVocabularyImpl[3];
631 
632             array[0] = getByUuid_PrevAndNext(session, assetVocabulary, uuid,
633                     orderByComparator, true);
634 
635             array[1] = assetVocabulary;
636 
637             array[2] = getByUuid_PrevAndNext(session, assetVocabulary, uuid,
638                     orderByComparator, false);
639 
640             return array;
641         }
642         catch (Exception e) {
643             throw processException(e);
644         }
645         finally {
646             closeSession(session);
647         }
648     }
649 
650     protected AssetVocabulary getByUuid_PrevAndNext(Session session,
651         AssetVocabulary assetVocabulary, String uuid,
652         OrderByComparator orderByComparator, boolean previous) {
653         StringBundler query = null;
654 
655         if (orderByComparator != null) {
656             query = new StringBundler(6 +
657                     (orderByComparator.getOrderByFields().length * 6));
658         }
659         else {
660             query = new StringBundler(3);
661         }
662 
663         query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
664 
665         if (uuid == null) {
666             query.append(_FINDER_COLUMN_UUID_UUID_1);
667         }
668         else {
669             if (uuid.equals(StringPool.BLANK)) {
670                 query.append(_FINDER_COLUMN_UUID_UUID_3);
671             }
672             else {
673                 query.append(_FINDER_COLUMN_UUID_UUID_2);
674             }
675         }
676 
677         if (orderByComparator != null) {
678             String[] orderByFields = orderByComparator.getOrderByFields();
679 
680             if (orderByFields.length > 0) {
681                 query.append(WHERE_AND);
682             }
683 
684             for (int i = 0; i < orderByFields.length; i++) {
685                 query.append(_ORDER_BY_ENTITY_ALIAS);
686                 query.append(orderByFields[i]);
687 
688                 if ((i + 1) < orderByFields.length) {
689                     if (orderByComparator.isAscending() ^ previous) {
690                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
691                     }
692                     else {
693                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
694                     }
695                 }
696                 else {
697                     if (orderByComparator.isAscending() ^ previous) {
698                         query.append(WHERE_GREATER_THAN);
699                     }
700                     else {
701                         query.append(WHERE_LESSER_THAN);
702                     }
703                 }
704             }
705 
706             query.append(ORDER_BY_CLAUSE);
707 
708             for (int i = 0; i < orderByFields.length; i++) {
709                 query.append(_ORDER_BY_ENTITY_ALIAS);
710                 query.append(orderByFields[i]);
711 
712                 if ((i + 1) < orderByFields.length) {
713                     if (orderByComparator.isAscending() ^ previous) {
714                         query.append(ORDER_BY_ASC_HAS_NEXT);
715                     }
716                     else {
717                         query.append(ORDER_BY_DESC_HAS_NEXT);
718                     }
719                 }
720                 else {
721                     if (orderByComparator.isAscending() ^ previous) {
722                         query.append(ORDER_BY_ASC);
723                     }
724                     else {
725                         query.append(ORDER_BY_DESC);
726                     }
727                 }
728             }
729         }
730 
731         else {
732             query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
733         }
734 
735         String sql = query.toString();
736 
737         Query q = session.createQuery(sql);
738 
739         q.setFirstResult(0);
740         q.setMaxResults(2);
741 
742         QueryPos qPos = QueryPos.getInstance(q);
743 
744         if (uuid != null) {
745             qPos.add(uuid);
746         }
747 
748         if (orderByComparator != null) {
749             Object[] values = orderByComparator.getOrderByValues(assetVocabulary);
750 
751             for (Object value : values) {
752                 qPos.add(value);
753             }
754         }
755 
756         List<AssetVocabulary> list = q.list();
757 
758         if (list.size() == 2) {
759             return list.get(1);
760         }
761         else {
762             return null;
763         }
764     }
765 
766     public AssetVocabulary findByUUID_G(String uuid, long groupId)
767         throws NoSuchVocabularyException, SystemException {
768         AssetVocabulary assetVocabulary = fetchByUUID_G(uuid, groupId);
769 
770         if (assetVocabulary == null) {
771             StringBundler msg = new StringBundler(6);
772 
773             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
774 
775             msg.append("uuid=");
776             msg.append(uuid);
777 
778             msg.append(", groupId=");
779             msg.append(groupId);
780 
781             msg.append(StringPool.CLOSE_CURLY_BRACE);
782 
783             if (_log.isWarnEnabled()) {
784                 _log.warn(msg.toString());
785             }
786 
787             throw new NoSuchVocabularyException(msg.toString());
788         }
789 
790         return assetVocabulary;
791     }
792 
793     public AssetVocabulary fetchByUUID_G(String uuid, long groupId)
794         throws SystemException {
795         return fetchByUUID_G(uuid, groupId, true);
796     }
797 
798     public AssetVocabulary fetchByUUID_G(String uuid, long groupId,
799         boolean retrieveFromCache) throws SystemException {
800         Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
801 
802         Object result = null;
803 
804         if (retrieveFromCache) {
805             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
806                     finderArgs, this);
807         }
808 
809         if (result == null) {
810             Session session = null;
811 
812             try {
813                 session = openSession();
814 
815                 StringBundler query = new StringBundler(4);
816 
817                 query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
818 
819                 if (uuid == null) {
820                     query.append(_FINDER_COLUMN_UUID_G_UUID_1);
821                 }
822                 else {
823                     if (uuid.equals(StringPool.BLANK)) {
824                         query.append(_FINDER_COLUMN_UUID_G_UUID_3);
825                     }
826                     else {
827                         query.append(_FINDER_COLUMN_UUID_G_UUID_2);
828                     }
829                 }
830 
831                 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
832 
833                 query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
834 
835                 String sql = query.toString();
836 
837                 Query q = session.createQuery(sql);
838 
839                 QueryPos qPos = QueryPos.getInstance(q);
840 
841                 if (uuid != null) {
842                     qPos.add(uuid);
843                 }
844 
845                 qPos.add(groupId);
846 
847                 List<AssetVocabulary> list = q.list();
848 
849                 result = list;
850 
851                 AssetVocabulary assetVocabulary = null;
852 
853                 if (list.isEmpty()) {
854                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
855                         finderArgs, list);
856                 }
857                 else {
858                     assetVocabulary = list.get(0);
859 
860                     cacheResult(assetVocabulary);
861 
862                     if ((assetVocabulary.getUuid() == null) ||
863                             !assetVocabulary.getUuid().equals(uuid) ||
864                             (assetVocabulary.getGroupId() != groupId)) {
865                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
866                             finderArgs, assetVocabulary);
867                     }
868                 }
869 
870                 return assetVocabulary;
871             }
872             catch (Exception e) {
873                 throw processException(e);
874             }
875             finally {
876                 if (result == null) {
877                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
878                         finderArgs, new ArrayList<AssetVocabulary>());
879                 }
880 
881                 closeSession(session);
882             }
883         }
884         else {
885             if (result instanceof List<?>) {
886                 return null;
887             }
888             else {
889                 return (AssetVocabulary)result;
890             }
891         }
892     }
893 
894     public List<AssetVocabulary> findByGroupId(long groupId)
895         throws SystemException {
896         return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
897     }
898 
899     public List<AssetVocabulary> findByGroupId(long groupId, int start, int end)
900         throws SystemException {
901         return findByGroupId(groupId, start, end, null);
902     }
903 
904     public List<AssetVocabulary> findByGroupId(long groupId, int start,
905         int end, OrderByComparator orderByComparator) throws SystemException {
906         Object[] finderArgs = new Object[] {
907                 new Long(groupId),
908                 
909                 String.valueOf(start), String.valueOf(end),
910                 String.valueOf(orderByComparator)
911             };
912 
913         List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
914                 finderArgs, this);
915 
916         if (list == null) {
917             Session session = null;
918 
919             try {
920                 session = openSession();
921 
922                 StringBundler query = null;
923 
924                 if (orderByComparator != null) {
925                     query = new StringBundler(3 +
926                             (orderByComparator.getOrderByFields().length * 3));
927                 }
928                 else {
929                     query = new StringBundler(3);
930                 }
931 
932                 query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
933 
934                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
935 
936                 if (orderByComparator != null) {
937                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
938                         orderByComparator);
939                 }
940 
941                 else {
942                     query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
943                 }
944 
945                 String sql = query.toString();
946 
947                 Query q = session.createQuery(sql);
948 
949                 QueryPos qPos = QueryPos.getInstance(q);
950 
951                 qPos.add(groupId);
952 
953                 list = (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
954                         start, end);
955             }
956             catch (Exception e) {
957                 throw processException(e);
958             }
959             finally {
960                 if (list == null) {
961                     list = new ArrayList<AssetVocabulary>();
962                 }
963 
964                 cacheResult(list);
965 
966                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
967                     finderArgs, list);
968 
969                 closeSession(session);
970             }
971         }
972 
973         return list;
974     }
975 
976     public AssetVocabulary findByGroupId_First(long groupId,
977         OrderByComparator orderByComparator)
978         throws NoSuchVocabularyException, SystemException {
979         List<AssetVocabulary> list = findByGroupId(groupId, 0, 1,
980                 orderByComparator);
981 
982         if (list.isEmpty()) {
983             StringBundler msg = new StringBundler(4);
984 
985             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
986 
987             msg.append("groupId=");
988             msg.append(groupId);
989 
990             msg.append(StringPool.CLOSE_CURLY_BRACE);
991 
992             throw new NoSuchVocabularyException(msg.toString());
993         }
994         else {
995             return list.get(0);
996         }
997     }
998 
999     public AssetVocabulary findByGroupId_Last(long groupId,
1000        OrderByComparator orderByComparator)
1001        throws NoSuchVocabularyException, SystemException {
1002        int count = countByGroupId(groupId);
1003
1004        List<AssetVocabulary> list = findByGroupId(groupId, count - 1, count,
1005                orderByComparator);
1006
1007        if (list.isEmpty()) {
1008            StringBundler msg = new StringBundler(4);
1009
1010            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1011
1012            msg.append("groupId=");
1013            msg.append(groupId);
1014
1015            msg.append(StringPool.CLOSE_CURLY_BRACE);
1016
1017            throw new NoSuchVocabularyException(msg.toString());
1018        }
1019        else {
1020            return list.get(0);
1021        }
1022    }
1023
1024    public AssetVocabulary[] findByGroupId_PrevAndNext(long vocabularyId,
1025        long groupId, OrderByComparator orderByComparator)
1026        throws NoSuchVocabularyException, SystemException {
1027        AssetVocabulary assetVocabulary = findByPrimaryKey(vocabularyId);
1028
1029        Session session = null;
1030
1031        try {
1032            session = openSession();
1033
1034            AssetVocabulary[] array = new AssetVocabularyImpl[3];
1035
1036            array[0] = getByGroupId_PrevAndNext(session, assetVocabulary,
1037                    groupId, orderByComparator, true);
1038
1039            array[1] = assetVocabulary;
1040
1041            array[2] = getByGroupId_PrevAndNext(session, assetVocabulary,
1042                    groupId, orderByComparator, false);
1043
1044            return array;
1045        }
1046        catch (Exception e) {
1047            throw processException(e);
1048        }
1049        finally {
1050            closeSession(session);
1051        }
1052    }
1053
1054    protected AssetVocabulary getByGroupId_PrevAndNext(Session session,
1055        AssetVocabulary assetVocabulary, long groupId,
1056        OrderByComparator orderByComparator, boolean previous) {
1057        StringBundler query = null;
1058
1059        if (orderByComparator != null) {
1060            query = new StringBundler(6 +
1061                    (orderByComparator.getOrderByFields().length * 6));
1062        }
1063        else {
1064            query = new StringBundler(3);
1065        }
1066
1067        query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1068
1069        query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1070
1071        if (orderByComparator != null) {
1072            String[] orderByFields = orderByComparator.getOrderByFields();
1073
1074            if (orderByFields.length > 0) {
1075                query.append(WHERE_AND);
1076            }
1077
1078            for (int i = 0; i < orderByFields.length; i++) {
1079                query.append(_ORDER_BY_ENTITY_ALIAS);
1080                query.append(orderByFields[i]);
1081
1082                if ((i + 1) < orderByFields.length) {
1083                    if (orderByComparator.isAscending() ^ previous) {
1084                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1085                    }
1086                    else {
1087                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1088                    }
1089                }
1090                else {
1091                    if (orderByComparator.isAscending() ^ previous) {
1092                        query.append(WHERE_GREATER_THAN);
1093                    }
1094                    else {
1095                        query.append(WHERE_LESSER_THAN);
1096                    }
1097                }
1098            }
1099
1100            query.append(ORDER_BY_CLAUSE);
1101
1102            for (int i = 0; i < orderByFields.length; i++) {
1103                query.append(_ORDER_BY_ENTITY_ALIAS);
1104                query.append(orderByFields[i]);
1105
1106                if ((i + 1) < orderByFields.length) {
1107                    if (orderByComparator.isAscending() ^ previous) {
1108                        query.append(ORDER_BY_ASC_HAS_NEXT);
1109                    }
1110                    else {
1111                        query.append(ORDER_BY_DESC_HAS_NEXT);
1112                    }
1113                }
1114                else {
1115                    if (orderByComparator.isAscending() ^ previous) {
1116                        query.append(ORDER_BY_ASC);
1117                    }
1118                    else {
1119                        query.append(ORDER_BY_DESC);
1120                    }
1121                }
1122            }
1123        }
1124
1125        else {
1126            query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1127        }
1128
1129        String sql = query.toString();
1130
1131        Query q = session.createQuery(sql);
1132
1133        q.setFirstResult(0);
1134        q.setMaxResults(2);
1135
1136        QueryPos qPos = QueryPos.getInstance(q);
1137
1138        qPos.add(groupId);
1139
1140        if (orderByComparator != null) {
1141            Object[] values = orderByComparator.getOrderByValues(assetVocabulary);
1142
1143            for (Object value : values) {
1144                qPos.add(value);
1145            }
1146        }
1147
1148        List<AssetVocabulary> list = q.list();
1149
1150        if (list.size() == 2) {
1151            return list.get(1);
1152        }
1153        else {
1154            return null;
1155        }
1156    }
1157
1158    public List<AssetVocabulary> filterFindByGroupId(long groupId)
1159        throws SystemException {
1160        return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1161            QueryUtil.ALL_POS, null);
1162    }
1163
1164    public List<AssetVocabulary> filterFindByGroupId(long groupId, int start,
1165        int end) throws SystemException {
1166        return filterFindByGroupId(groupId, start, end, null);
1167    }
1168
1169    public List<AssetVocabulary> filterFindByGroupId(long groupId, int start,
1170        int end, OrderByComparator orderByComparator) throws SystemException {
1171        if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1172            return findByGroupId(groupId, start, end, orderByComparator);
1173        }
1174
1175        Session session = null;
1176
1177        try {
1178            session = openSession();
1179
1180            StringBundler query = null;
1181
1182            if (orderByComparator != null) {
1183                query = new StringBundler(3 +
1184                        (orderByComparator.getOrderByFields().length * 3));
1185            }
1186            else {
1187                query = new StringBundler(3);
1188            }
1189
1190            query.append(_FILTER_SQL_SELECT_ASSETVOCABULARY_WHERE);
1191
1192            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1193
1194            if (orderByComparator != null) {
1195                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1196                    orderByComparator);
1197            }
1198
1199            else {
1200                query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1201            }
1202
1203            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1204                    AssetVocabulary.class.getName(),
1205                    _FILTER_COLUMN_VOCABULARYID, _FILTER_COLUMN_USERID, groupId);
1206
1207            SQLQuery q = session.createSQLQuery(sql);
1208
1209            q.addEntity(_FILTER_ENTITY_ALIAS, AssetVocabularyImpl.class);
1210
1211            QueryPos qPos = QueryPos.getInstance(q);
1212
1213            qPos.add(groupId);
1214
1215            return (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
1216                start, end);
1217        }
1218        catch (Exception e) {
1219            throw processException(e);
1220        }
1221        finally {
1222            closeSession(session);
1223        }
1224    }
1225
1226    public List<AssetVocabulary> findByCompanyId(long companyId)
1227        throws SystemException {
1228        return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1229            null);
1230    }
1231
1232    public List<AssetVocabulary> findByCompanyId(long companyId, int start,
1233        int end) throws SystemException {
1234        return findByCompanyId(companyId, start, end, null);
1235    }
1236
1237    public List<AssetVocabulary> findByCompanyId(long companyId, int start,
1238        int end, OrderByComparator orderByComparator) throws SystemException {
1239        Object[] finderArgs = new Object[] {
1240                new Long(companyId),
1241                
1242                String.valueOf(start), String.valueOf(end),
1243                String.valueOf(orderByComparator)
1244            };
1245
1246        List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1247                finderArgs, this);
1248
1249        if (list == null) {
1250            Session session = null;
1251
1252            try {
1253                session = openSession();
1254
1255                StringBundler query = null;
1256
1257                if (orderByComparator != null) {
1258                    query = new StringBundler(3 +
1259                            (orderByComparator.getOrderByFields().length * 3));
1260                }
1261                else {
1262                    query = new StringBundler(3);
1263                }
1264
1265                query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1266
1267                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1268
1269                if (orderByComparator != null) {
1270                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1271                        orderByComparator);
1272                }
1273
1274                else {
1275                    query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1276                }
1277
1278                String sql = query.toString();
1279
1280                Query q = session.createQuery(sql);
1281
1282                QueryPos qPos = QueryPos.getInstance(q);
1283
1284                qPos.add(companyId);
1285
1286                list = (List<AssetVocabulary>)QueryUtil.list(q, getDialect(),
1287                        start, end);
1288            }
1289            catch (Exception e) {
1290                throw processException(e);
1291            }
1292            finally {
1293                if (list == null) {
1294                    list = new ArrayList<AssetVocabulary>();
1295                }
1296
1297                cacheResult(list);
1298
1299                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1300                    finderArgs, list);
1301
1302                closeSession(session);
1303            }
1304        }
1305
1306        return list;
1307    }
1308
1309    public AssetVocabulary findByCompanyId_First(long companyId,
1310        OrderByComparator orderByComparator)
1311        throws NoSuchVocabularyException, SystemException {
1312        List<AssetVocabulary> list = findByCompanyId(companyId, 0, 1,
1313                orderByComparator);
1314
1315        if (list.isEmpty()) {
1316            StringBundler msg = new StringBundler(4);
1317
1318            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1319
1320            msg.append("companyId=");
1321            msg.append(companyId);
1322
1323            msg.append(StringPool.CLOSE_CURLY_BRACE);
1324
1325            throw new NoSuchVocabularyException(msg.toString());
1326        }
1327        else {
1328            return list.get(0);
1329        }
1330    }
1331
1332    public AssetVocabulary findByCompanyId_Last(long companyId,
1333        OrderByComparator orderByComparator)
1334        throws NoSuchVocabularyException, SystemException {
1335        int count = countByCompanyId(companyId);
1336
1337        List<AssetVocabulary> list = findByCompanyId(companyId, count - 1,
1338                count, orderByComparator);
1339
1340        if (list.isEmpty()) {
1341            StringBundler msg = new StringBundler(4);
1342
1343            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1344
1345            msg.append("companyId=");
1346            msg.append(companyId);
1347
1348            msg.append(StringPool.CLOSE_CURLY_BRACE);
1349
1350            throw new NoSuchVocabularyException(msg.toString());
1351        }
1352        else {
1353            return list.get(0);
1354        }
1355    }
1356
1357    public AssetVocabulary[] findByCompanyId_PrevAndNext(long vocabularyId,
1358        long companyId, OrderByComparator orderByComparator)
1359        throws NoSuchVocabularyException, SystemException {
1360        AssetVocabulary assetVocabulary = findByPrimaryKey(vocabularyId);
1361
1362        Session session = null;
1363
1364        try {
1365            session = openSession();
1366
1367            AssetVocabulary[] array = new AssetVocabularyImpl[3];
1368
1369            array[0] = getByCompanyId_PrevAndNext(session, assetVocabulary,
1370                    companyId, orderByComparator, true);
1371
1372            array[1] = assetVocabulary;
1373
1374            array[2] = getByCompanyId_PrevAndNext(session, assetVocabulary,
1375                    companyId, orderByComparator, false);
1376
1377            return array;
1378        }
1379        catch (Exception e) {
1380            throw processException(e);
1381        }
1382        finally {
1383            closeSession(session);
1384        }
1385    }
1386
1387    protected AssetVocabulary getByCompanyId_PrevAndNext(Session session,
1388        AssetVocabulary assetVocabulary, long companyId,
1389        OrderByComparator orderByComparator, boolean previous) {
1390        StringBundler query = null;
1391
1392        if (orderByComparator != null) {
1393            query = new StringBundler(6 +
1394                    (orderByComparator.getOrderByFields().length * 6));
1395        }
1396        else {
1397            query = new StringBundler(3);
1398        }
1399
1400        query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1401
1402        query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1403
1404        if (orderByComparator != null) {
1405            String[] orderByFields = orderByComparator.getOrderByFields();
1406
1407            if (orderByFields.length > 0) {
1408                query.append(WHERE_AND);
1409            }
1410
1411            for (int i = 0; i < orderByFields.length; i++) {
1412                query.append(_ORDER_BY_ENTITY_ALIAS);
1413                query.append(orderByFields[i]);
1414
1415                if ((i + 1) < orderByFields.length) {
1416                    if (orderByComparator.isAscending() ^ previous) {
1417                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1418                    }
1419                    else {
1420                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1421                    }
1422                }
1423                else {
1424                    if (orderByComparator.isAscending() ^ previous) {
1425                        query.append(WHERE_GREATER_THAN);
1426                    }
1427                    else {
1428                        query.append(WHERE_LESSER_THAN);
1429                    }
1430                }
1431            }
1432
1433            query.append(ORDER_BY_CLAUSE);
1434
1435            for (int i = 0; i < orderByFields.length; i++) {
1436                query.append(_ORDER_BY_ENTITY_ALIAS);
1437                query.append(orderByFields[i]);
1438
1439                if ((i + 1) < orderByFields.length) {
1440                    if (orderByComparator.isAscending() ^ previous) {
1441                        query.append(ORDER_BY_ASC_HAS_NEXT);
1442                    }
1443                    else {
1444                        query.append(ORDER_BY_DESC_HAS_NEXT);
1445                    }
1446                }
1447                else {
1448                    if (orderByComparator.isAscending() ^ previous) {
1449                        query.append(ORDER_BY_ASC);
1450                    }
1451                    else {
1452                        query.append(ORDER_BY_DESC);
1453                    }
1454                }
1455            }
1456        }
1457
1458        else {
1459            query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1460        }
1461
1462        String sql = query.toString();
1463
1464        Query q = session.createQuery(sql);
1465
1466        q.setFirstResult(0);
1467        q.setMaxResults(2);
1468
1469        QueryPos qPos = QueryPos.getInstance(q);
1470
1471        qPos.add(companyId);
1472
1473        if (orderByComparator != null) {
1474            Object[] values = orderByComparator.getOrderByValues(assetVocabulary);
1475
1476            for (Object value : values) {
1477                qPos.add(value);
1478            }
1479        }
1480
1481        List<AssetVocabulary> list = q.list();
1482
1483        if (list.size() == 2) {
1484            return list.get(1);
1485        }
1486        else {
1487            return null;
1488        }
1489    }
1490
1491    public AssetVocabulary findByG_N(long groupId, String name)
1492        throws NoSuchVocabularyException, SystemException {
1493        AssetVocabulary assetVocabulary = fetchByG_N(groupId, name);
1494
1495        if (assetVocabulary == null) {
1496            StringBundler msg = new StringBundler(6);
1497
1498            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1499
1500            msg.append("groupId=");
1501            msg.append(groupId);
1502
1503            msg.append(", name=");
1504            msg.append(name);
1505
1506            msg.append(StringPool.CLOSE_CURLY_BRACE);
1507
1508            if (_log.isWarnEnabled()) {
1509                _log.warn(msg.toString());
1510            }
1511
1512            throw new NoSuchVocabularyException(msg.toString());
1513        }
1514
1515        return assetVocabulary;
1516    }
1517
1518    public AssetVocabulary fetchByG_N(long groupId, String name)
1519        throws SystemException {
1520        return fetchByG_N(groupId, name, true);
1521    }
1522
1523    public AssetVocabulary fetchByG_N(long groupId, String name,
1524        boolean retrieveFromCache) throws SystemException {
1525        Object[] finderArgs = new Object[] { new Long(groupId), name };
1526
1527        Object result = null;
1528
1529        if (retrieveFromCache) {
1530            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N,
1531                    finderArgs, this);
1532        }
1533
1534        if (result == null) {
1535            Session session = null;
1536
1537            try {
1538                session = openSession();
1539
1540                StringBundler query = new StringBundler(4);
1541
1542                query.append(_SQL_SELECT_ASSETVOCABULARY_WHERE);
1543
1544                query.append(_FINDER_COLUMN_G_N_GROUPID_2);
1545
1546                if (name == null) {
1547                    query.append(_FINDER_COLUMN_G_N_NAME_1);
1548                }
1549                else {
1550                    if (name.equals(StringPool.BLANK)) {
1551                        query.append(_FINDER_COLUMN_G_N_NAME_3);
1552                    }
1553                    else {
1554                        query.append(_FINDER_COLUMN_G_N_NAME_2);
1555                    }
1556                }
1557
1558                query.append(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1559
1560                String sql = query.toString();
1561
1562                Query q = session.createQuery(sql);
1563
1564                QueryPos qPos = QueryPos.getInstance(q);
1565
1566                qPos.add(groupId);
1567
1568                if (name != null) {
1569                    qPos.add(name);
1570                }
1571
1572                List<AssetVocabulary> list = q.list();
1573
1574                result = list;
1575
1576                AssetVocabulary assetVocabulary = null;
1577
1578                if (list.isEmpty()) {
1579                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1580                        finderArgs, list);
1581                }
1582                else {
1583                    assetVocabulary = list.get(0);
1584
1585                    cacheResult(assetVocabulary);
1586
1587                    if ((assetVocabulary.getGroupId() != groupId) ||
1588                            (assetVocabulary.getName() == null) ||
1589                            !assetVocabulary.getName().equals(name)) {
1590                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1591                            finderArgs, assetVocabulary);
1592                    }
1593                }
1594
1595                return assetVocabulary;
1596            }
1597            catch (Exception e) {
1598                throw processException(e);
1599            }
1600            finally {
1601                if (result == null) {
1602                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1603                        finderArgs, new ArrayList<AssetVocabulary>());
1604                }
1605
1606                closeSession(session);
1607            }
1608        }
1609        else {
1610            if (result instanceof List<?>) {
1611                return null;
1612            }
1613            else {
1614                return (AssetVocabulary)result;
1615            }
1616        }
1617    }
1618
1619    public List<AssetVocabulary> findAll() throws SystemException {
1620        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1621    }
1622
1623    public List<AssetVocabulary> findAll(int start, int end)
1624        throws SystemException {
1625        return findAll(start, end, null);
1626    }
1627
1628    public List<AssetVocabulary> findAll(int start, int end,
1629        OrderByComparator orderByComparator) throws SystemException {
1630        Object[] finderArgs = new Object[] {
1631                String.valueOf(start), String.valueOf(end),
1632                String.valueOf(orderByComparator)
1633            };
1634
1635        List<AssetVocabulary> list = (List<AssetVocabulary>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1636                finderArgs, this);
1637
1638        if (list == null) {
1639            Session session = null;
1640
1641            try {
1642                session = openSession();
1643
1644                StringBundler query = null;
1645                String sql = null;
1646
1647                if (orderByComparator != null) {
1648                    query = new StringBundler(2 +
1649                            (orderByComparator.getOrderByFields().length * 3));
1650
1651                    query.append(_SQL_SELECT_ASSETVOCABULARY);
1652
1653                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1654                        orderByComparator);
1655
1656                    sql = query.toString();
1657                }
1658
1659                else {
1660                    sql = _SQL_SELECT_ASSETVOCABULARY.concat(AssetVocabularyModelImpl.ORDER_BY_JPQL);
1661                }
1662
1663                Query q = session.createQuery(sql);
1664
1665                if (orderByComparator == null) {
1666                    list = (List<AssetVocabulary>)QueryUtil.list(q,
1667                            getDialect(), start, end, false);
1668
1669                    Collections.sort(list);
1670                }
1671                else {
1672                    list = (List<AssetVocabulary>)QueryUtil.list(q,
1673                            getDialect(), start, end);
1674                }
1675            }
1676            catch (Exception e) {
1677                throw processException(e);
1678            }
1679            finally {
1680                if (list == null) {
1681                    list = new ArrayList<AssetVocabulary>();
1682                }
1683
1684                cacheResult(list);
1685
1686                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1687
1688                closeSession(session);
1689            }
1690        }
1691
1692        return list;
1693    }
1694
1695    public void removeByUuid(String uuid) throws SystemException {
1696        for (AssetVocabulary assetVocabulary : findByUuid(uuid)) {
1697            remove(assetVocabulary);
1698        }
1699    }
1700
1701    public void removeByUUID_G(String uuid, long groupId)
1702        throws NoSuchVocabularyException, SystemException {
1703        AssetVocabulary assetVocabulary = findByUUID_G(uuid, groupId);
1704
1705        remove(assetVocabulary);
1706    }
1707
1708    public void removeByGroupId(long groupId) throws SystemException {
1709        for (AssetVocabulary assetVocabulary : findByGroupId(groupId)) {
1710            remove(assetVocabulary);
1711        }
1712    }
1713
1714    public void removeByCompanyId(long companyId) throws SystemException {
1715        for (AssetVocabulary assetVocabulary : findByCompanyId(companyId)) {
1716            remove(assetVocabulary);
1717        }
1718    }
1719
1720    public void removeByG_N(long groupId, String name)
1721        throws NoSuchVocabularyException, SystemException {
1722        AssetVocabulary assetVocabulary = findByG_N(groupId, name);
1723
1724        remove(assetVocabulary);
1725    }
1726
1727    public void removeAll() throws SystemException {
1728        for (AssetVocabulary assetVocabulary : findAll()) {
1729            remove(assetVocabulary);
1730        }
1731    }
1732
1733    public int countByUuid(String uuid) throws SystemException {
1734        Object[] finderArgs = new Object[] { uuid };
1735
1736        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
1737                finderArgs, this);
1738
1739        if (count == null) {
1740            Session session = null;
1741
1742            try {
1743                session = openSession();
1744
1745                StringBundler query = new StringBundler(2);
1746
1747                query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
1748
1749                if (uuid == null) {
1750                    query.append(_FINDER_COLUMN_UUID_UUID_1);
1751                }
1752                else {
1753                    if (uuid.equals(StringPool.BLANK)) {
1754                        query.append(_FINDER_COLUMN_UUID_UUID_3);
1755                    }
1756                    else {
1757                        query.append(_FINDER_COLUMN_UUID_UUID_2);
1758                    }
1759                }
1760
1761                String sql = query.toString();
1762
1763                Query q = session.createQuery(sql);
1764
1765                QueryPos qPos = QueryPos.getInstance(q);
1766
1767                if (uuid != null) {
1768                    qPos.add(uuid);
1769                }
1770
1771                count = (Long)q.uniqueResult();
1772            }
1773            catch (Exception e) {
1774                throw processException(e);
1775            }
1776            finally {
1777                if (count == null) {
1778                    count = Long.valueOf(0);
1779                }
1780
1781                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
1782                    finderArgs, count);
1783
1784                closeSession(session);
1785            }
1786        }
1787
1788        return count.intValue();
1789    }
1790
1791    public int countByUUID_G(String uuid, long groupId)
1792        throws SystemException {
1793        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
1794
1795        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
1796                finderArgs, this);
1797
1798        if (count == null) {
1799            Session session = null;
1800
1801            try {
1802                session = openSession();
1803
1804                StringBundler query = new StringBundler(3);
1805
1806                query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
1807
1808                if (uuid == null) {
1809                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1810                }
1811                else {
1812                    if (uuid.equals(StringPool.BLANK)) {
1813                        query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1814                    }
1815                    else {
1816                        query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1817                    }
1818                }
1819
1820                query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1821
1822                String sql = query.toString();
1823
1824                Query q = session.createQuery(sql);
1825
1826                QueryPos qPos = QueryPos.getInstance(q);
1827
1828                if (uuid != null) {
1829                    qPos.add(uuid);
1830                }
1831
1832                qPos.add(groupId);
1833
1834                count = (Long)q.uniqueResult();
1835            }
1836            catch (Exception e) {
1837                throw processException(e);
1838            }
1839            finally {
1840                if (count == null) {
1841                    count = Long.valueOf(0);
1842                }
1843
1844                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
1845                    finderArgs, count);
1846
1847                closeSession(session);
1848            }
1849        }
1850
1851        return count.intValue();
1852    }
1853
1854    public int countByGroupId(long groupId) throws SystemException {
1855        Object[] finderArgs = new Object[] { new Long(groupId) };
1856
1857        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1858                finderArgs, this);
1859
1860        if (count == null) {
1861            Session session = null;
1862
1863            try {
1864                session = openSession();
1865
1866                StringBundler query = new StringBundler(2);
1867
1868                query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
1869
1870                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1871
1872                String sql = query.toString();
1873
1874                Query q = session.createQuery(sql);
1875
1876                QueryPos qPos = QueryPos.getInstance(q);
1877
1878                qPos.add(groupId);
1879
1880                count = (Long)q.uniqueResult();
1881            }
1882            catch (Exception e) {
1883                throw processException(e);
1884            }
1885            finally {
1886                if (count == null) {
1887                    count = Long.valueOf(0);
1888                }
1889
1890                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1891                    finderArgs, count);
1892
1893                closeSession(session);
1894            }
1895        }
1896
1897        return count.intValue();
1898    }
1899
1900    public int filterCountByGroupId(long groupId) throws SystemException {
1901        if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1902            return countByGroupId(groupId);
1903        }
1904
1905        Session session = null;
1906
1907        try {
1908            session = openSession();
1909
1910            StringBundler query = new StringBundler(2);
1911
1912            query.append(_FILTER_SQL_COUNT_ASSETVOCABULARY_WHERE);
1913
1914            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1915
1916            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1917                    AssetVocabulary.class.getName(),
1918                    _FILTER_COLUMN_VOCABULARYID, _FILTER_COLUMN_USERID, groupId);
1919
1920            SQLQuery q = session.createSQLQuery(sql);
1921
1922            q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1923
1924            QueryPos qPos = QueryPos.getInstance(q);
1925
1926            qPos.add(groupId);
1927
1928            Long count = (Long)q.uniqueResult();
1929
1930            return count.intValue();
1931        }
1932        catch (Exception e) {
1933            throw processException(e);
1934        }
1935        finally {
1936            closeSession(session);
1937        }
1938    }
1939
1940    public int countByCompanyId(long companyId) throws SystemException {
1941        Object[] finderArgs = new Object[] { new Long(companyId) };
1942
1943        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1944                finderArgs, this);
1945
1946        if (count == null) {
1947            Session session = null;
1948
1949            try {
1950                session = openSession();
1951
1952                StringBundler query = new StringBundler(2);
1953
1954                query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
1955
1956                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1957
1958                String sql = query.toString();
1959
1960                Query q = session.createQuery(sql);
1961
1962                QueryPos qPos = QueryPos.getInstance(q);
1963
1964                qPos.add(companyId);
1965
1966                count = (Long)q.uniqueResult();
1967            }
1968            catch (Exception e) {
1969                throw processException(e);
1970            }
1971            finally {
1972                if (count == null) {
1973                    count = Long.valueOf(0);
1974                }
1975
1976                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1977                    finderArgs, count);
1978
1979                closeSession(session);
1980            }
1981        }
1982
1983        return count.intValue();
1984    }
1985
1986    public int countByG_N(long groupId, String name) throws SystemException {
1987        Object[] finderArgs = new Object[] { new Long(groupId), name };
1988
1989        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N,
1990                finderArgs, this);
1991
1992        if (count == null) {
1993            Session session = null;
1994
1995            try {
1996                session = openSession();
1997
1998                StringBundler query = new StringBundler(3);
1999
2000                query.append(_SQL_COUNT_ASSETVOCABULARY_WHERE);
2001
2002                query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2003
2004                if (name == null) {
2005                    query.append(_FINDER_COLUMN_G_N_NAME_1);
2006                }
2007                else {
2008                    if (name.equals(StringPool.BLANK)) {
2009                        query.append(_FINDER_COLUMN_G_N_NAME_3);
2010                    }
2011                    else {
2012                        query.append(_FINDER_COLUMN_G_N_NAME_2);
2013                    }
2014                }
2015
2016                String sql = query.toString();
2017
2018                Query q = session.createQuery(sql);
2019
2020                QueryPos qPos = QueryPos.getInstance(q);
2021
2022                qPos.add(groupId);
2023
2024                if (name != null) {
2025                    qPos.add(name);
2026                }
2027
2028                count = (Long)q.uniqueResult();
2029            }
2030            catch (Exception e) {
2031                throw processException(e);
2032            }
2033            finally {
2034                if (count == null) {
2035                    count = Long.valueOf(0);
2036                }
2037
2038                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, finderArgs,
2039                    count);
2040
2041                closeSession(session);
2042            }
2043        }
2044
2045        return count.intValue();
2046    }
2047
2048    public int filterCountByG_N(long groupId, String name)
2049        throws SystemException {
2050        if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2051            return countByG_N(groupId, name);
2052        }
2053
2054        Session session = null;
2055
2056        try {
2057            session = openSession();
2058
2059            StringBundler query = new StringBundler(3);
2060
2061            query.append(_FILTER_SQL_COUNT_ASSETVOCABULARY_WHERE);
2062
2063            query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2064
2065            if (name == null) {
2066                query.append(_FINDER_COLUMN_G_N_NAME_1);
2067            }
2068            else {
2069                if (name.equals(StringPool.BLANK)) {
2070                    query.append(_FINDER_COLUMN_G_N_NAME_3);
2071                }
2072                else {
2073                    query.append(_FINDER_COLUMN_G_N_NAME_2);
2074                }
2075            }
2076
2077            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2078                    AssetVocabulary.class.getName(),
2079                    _FILTER_COLUMN_VOCABULARYID, _FILTER_COLUMN_USERID, groupId);
2080
2081            SQLQuery q = session.createSQLQuery(sql);
2082
2083            q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
2084
2085            QueryPos qPos = QueryPos.getInstance(q);
2086
2087            qPos.add(groupId);
2088
2089            if (name != null) {
2090                qPos.add(name);
2091            }
2092
2093            Long count = (Long)q.uniqueResult();
2094
2095            return count.intValue();
2096        }
2097        catch (Exception e) {
2098            throw processException(e);
2099        }
2100        finally {
2101            closeSession(session);
2102        }
2103    }
2104
2105    public int countAll() throws SystemException {
2106        Object[] finderArgs = new Object[0];
2107
2108        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2109                finderArgs, this);
2110
2111        if (count == null) {
2112            Session session = null;
2113
2114            try {
2115                session = openSession();
2116
2117                Query q = session.createQuery(_SQL_COUNT_ASSETVOCABULARY);
2118
2119                count = (Long)q.uniqueResult();
2120            }
2121            catch (Exception e) {
2122                throw processException(e);
2123            }
2124            finally {
2125                if (count == null) {
2126                    count = Long.valueOf(0);
2127                }
2128
2129                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2130                    count);
2131
2132                closeSession(session);
2133            }
2134        }
2135
2136        return count.intValue();
2137    }
2138
2139    public void afterPropertiesSet() {
2140        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2141                    com.liferay.portal.util.PropsUtil.get(
2142                        "value.object.listener.com.liferay.portlet.asset.model.AssetVocabulary")));
2143
2144        if (listenerClassNames.length > 0) {
2145            try {
2146                List<ModelListener<AssetVocabulary>> listenersList = new ArrayList<ModelListener<AssetVocabulary>>();
2147
2148                for (String listenerClassName : listenerClassNames) {
2149                    listenersList.add((ModelListener<AssetVocabulary>)InstanceFactory.newInstance(
2150                            listenerClassName));
2151                }
2152
2153                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2154            }
2155            catch (Exception e) {
2156                _log.error(e);
2157            }
2158        }
2159    }
2160
2161    @BeanReference(type = AssetCategoryPersistence.class)
2162    protected AssetCategoryPersistence assetCategoryPersistence;
2163    @BeanReference(type = AssetCategoryPropertyPersistence.class)
2164    protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
2165    @BeanReference(type = AssetEntryPersistence.class)
2166    protected AssetEntryPersistence assetEntryPersistence;
2167    @BeanReference(type = AssetLinkPersistence.class)
2168    protected AssetLinkPersistence assetLinkPersistence;
2169    @BeanReference(type = AssetTagPersistence.class)
2170    protected AssetTagPersistence assetTagPersistence;
2171    @BeanReference(type = AssetTagPropertyPersistence.class)
2172    protected AssetTagPropertyPersistence assetTagPropertyPersistence;
2173    @BeanReference(type = AssetTagStatsPersistence.class)
2174    protected AssetTagStatsPersistence assetTagStatsPersistence;
2175    @BeanReference(type = AssetVocabularyPersistence.class)
2176    protected AssetVocabularyPersistence assetVocabularyPersistence;
2177    @BeanReference(type = GroupPersistence.class)
2178    protected GroupPersistence groupPersistence;
2179    @BeanReference(type = ResourcePersistence.class)
2180    protected ResourcePersistence resourcePersistence;
2181    @BeanReference(type = UserPersistence.class)
2182    protected UserPersistence userPersistence;
2183    private static final String _SQL_SELECT_ASSETVOCABULARY = "SELECT assetVocabulary FROM AssetVocabulary assetVocabulary";
2184    private static final String _SQL_SELECT_ASSETVOCABULARY_WHERE = "SELECT assetVocabulary FROM AssetVocabulary assetVocabulary WHERE ";
2185    private static final String _SQL_COUNT_ASSETVOCABULARY = "SELECT COUNT(assetVocabulary) FROM AssetVocabulary assetVocabulary";
2186    private static final String _SQL_COUNT_ASSETVOCABULARY_WHERE = "SELECT COUNT(assetVocabulary) FROM AssetVocabulary assetVocabulary WHERE ";
2187    private static final String _FINDER_COLUMN_UUID_UUID_1 = "assetVocabulary.uuid IS NULL";
2188    private static final String _FINDER_COLUMN_UUID_UUID_2 = "assetVocabulary.uuid = ?";
2189    private static final String _FINDER_COLUMN_UUID_UUID_3 = "(assetVocabulary.uuid IS NULL OR assetVocabulary.uuid = ?)";
2190    private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "assetVocabulary.uuid IS NULL AND ";
2191    private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "assetVocabulary.uuid = ? AND ";
2192    private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(assetVocabulary.uuid IS NULL OR assetVocabulary.uuid = ?) AND ";
2193    private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "assetVocabulary.groupId = ?";
2194    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "assetVocabulary.groupId = ?";
2195    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "assetVocabulary.companyId = ?";
2196    private static final String _FINDER_COLUMN_G_N_GROUPID_2 = "assetVocabulary.groupId = ? AND ";
2197    private static final String _FINDER_COLUMN_G_N_NAME_1 = "assetVocabulary.name IS NULL";
2198    private static final String _FINDER_COLUMN_G_N_NAME_2 = "assetVocabulary.name = ?";
2199    private static final String _FINDER_COLUMN_G_N_NAME_3 = "(assetVocabulary.name IS NULL OR assetVocabulary.name = ?)";
2200    private static final String _FILTER_SQL_SELECT_ASSETVOCABULARY_WHERE = "SELECT DISTINCT {assetVocabulary.*} FROM AssetVocabulary assetVocabulary WHERE ";
2201    private static final String _FILTER_SQL_COUNT_ASSETVOCABULARY_WHERE = "SELECT COUNT(DISTINCT assetVocabulary.vocabularyId) AS COUNT_VALUE FROM AssetVocabulary assetVocabulary WHERE ";
2202    private static final String _FILTER_COLUMN_VOCABULARYID = "assetVocabulary.vocabularyId";
2203    private static final String _FILTER_COLUMN_USERID = "assetVocabulary.userId";
2204    private static final String _FILTER_ENTITY_ALIAS = "assetVocabulary";
2205    private static final String _ORDER_BY_ENTITY_ALIAS = "assetVocabulary.";
2206    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetVocabulary exists with the primary key ";
2207    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetVocabulary exists with the key {";
2208    private static Log _log = LogFactoryUtil.getLog(AssetVocabularyPersistenceImpl.class);
2209}