001
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.jdbc.MappingSqlQuery;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
022 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
026 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
027 import com.liferay.portal.kernel.dao.orm.FinderPath;
028 import com.liferay.portal.kernel.dao.orm.Query;
029 import com.liferay.portal.kernel.dao.orm.QueryPos;
030 import com.liferay.portal.kernel.dao.orm.QueryUtil;
031 import com.liferay.portal.kernel.dao.orm.SQLQuery;
032 import com.liferay.portal.kernel.dao.orm.Session;
033 import com.liferay.portal.kernel.exception.SystemException;
034 import com.liferay.portal.kernel.log.Log;
035 import com.liferay.portal.kernel.log.LogFactoryUtil;
036 import com.liferay.portal.kernel.util.GetterUtil;
037 import com.liferay.portal.kernel.util.InstanceFactory;
038 import com.liferay.portal.kernel.util.OrderByComparator;
039 import com.liferay.portal.kernel.util.SetUtil;
040 import com.liferay.portal.kernel.util.StringBundler;
041 import com.liferay.portal.kernel.util.StringPool;
042 import com.liferay.portal.kernel.util.StringUtil;
043 import com.liferay.portal.kernel.util.Validator;
044 import com.liferay.portal.model.CacheModel;
045 import com.liferay.portal.model.ModelListener;
046 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
047 import com.liferay.portal.service.persistence.UserPersistence;
048 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
049
050 import com.liferay.portlet.asset.NoSuchTagException;
051 import com.liferay.portlet.asset.model.AssetTag;
052 import com.liferay.portlet.asset.model.impl.AssetTagImpl;
053 import com.liferay.portlet.asset.model.impl.AssetTagModelImpl;
054
055 import java.io.Serializable;
056
057 import java.util.ArrayList;
058 import java.util.Collections;
059 import java.util.List;
060 import java.util.Set;
061
062
074 public class AssetTagPersistenceImpl extends BasePersistenceImpl<AssetTag>
075 implements AssetTagPersistence {
076
081 public static final String FINDER_CLASS_NAME_ENTITY = AssetTagImpl.class.getName();
082 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
083 ".List1";
084 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
085 ".List2";
086 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
087 AssetTagModelImpl.FINDER_CACHE_ENABLED, AssetTagImpl.class,
088 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
089 new String[] {
090 Long.class.getName(),
091
092 "java.lang.Integer", "java.lang.Integer",
093 "com.liferay.portal.kernel.util.OrderByComparator"
094 });
095 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
096 new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
097 AssetTagModelImpl.FINDER_CACHE_ENABLED, AssetTagImpl.class,
098 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
099 new String[] { Long.class.getName() },
100 AssetTagModelImpl.GROUPID_COLUMN_BITMASK);
101 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
102 AssetTagModelImpl.FINDER_CACHE_ENABLED, Long.class,
103 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
104 new String[] { Long.class.getName() });
105 public static final FinderPath FINDER_PATH_FETCH_BY_G_N = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
106 AssetTagModelImpl.FINDER_CACHE_ENABLED, AssetTagImpl.class,
107 FINDER_CLASS_NAME_ENTITY, "fetchByG_N",
108 new String[] { Long.class.getName(), String.class.getName() },
109 AssetTagModelImpl.GROUPID_COLUMN_BITMASK |
110 AssetTagModelImpl.NAME_COLUMN_BITMASK);
111 public static final FinderPath FINDER_PATH_COUNT_BY_G_N = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
112 AssetTagModelImpl.FINDER_CACHE_ENABLED, Long.class,
113 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_N",
114 new String[] { Long.class.getName(), String.class.getName() });
115 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
116 AssetTagModelImpl.FINDER_CACHE_ENABLED, AssetTagImpl.class,
117 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
118 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
119 AssetTagModelImpl.FINDER_CACHE_ENABLED, AssetTagImpl.class,
120 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
121 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
122 AssetTagModelImpl.FINDER_CACHE_ENABLED, Long.class,
123 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
124
125
130 public void cacheResult(AssetTag assetTag) {
131 EntityCacheUtil.putResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
132 AssetTagImpl.class, assetTag.getPrimaryKey(), assetTag);
133
134 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
135 new Object[] { Long.valueOf(assetTag.getGroupId()), assetTag.getName() },
136 assetTag);
137
138 assetTag.resetOriginalValues();
139 }
140
141
146 public void cacheResult(List<AssetTag> assetTags) {
147 for (AssetTag assetTag : assetTags) {
148 if (EntityCacheUtil.getResult(
149 AssetTagModelImpl.ENTITY_CACHE_ENABLED,
150 AssetTagImpl.class, assetTag.getPrimaryKey()) == null) {
151 cacheResult(assetTag);
152 }
153 else {
154 assetTag.resetOriginalValues();
155 }
156 }
157 }
158
159
166 @Override
167 public void clearCache() {
168 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
169 CacheRegistryUtil.clear(AssetTagImpl.class.getName());
170 }
171
172 EntityCacheUtil.clearCache(AssetTagImpl.class.getName());
173
174 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
175 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
176 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
177 }
178
179
186 @Override
187 public void clearCache(AssetTag assetTag) {
188 EntityCacheUtil.removeResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
189 AssetTagImpl.class, assetTag.getPrimaryKey());
190
191 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
192 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
193
194 clearUniqueFindersCache(assetTag);
195 }
196
197 @Override
198 public void clearCache(List<AssetTag> assetTags) {
199 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
200 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
201
202 for (AssetTag assetTag : assetTags) {
203 EntityCacheUtil.removeResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
204 AssetTagImpl.class, assetTag.getPrimaryKey());
205
206 clearUniqueFindersCache(assetTag);
207 }
208 }
209
210 protected void clearUniqueFindersCache(AssetTag assetTag) {
211 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
212 new Object[] { Long.valueOf(assetTag.getGroupId()), assetTag.getName() });
213 }
214
215
221 public AssetTag create(long tagId) {
222 AssetTag assetTag = new AssetTagImpl();
223
224 assetTag.setNew(true);
225 assetTag.setPrimaryKey(tagId);
226
227 return assetTag;
228 }
229
230
238 public AssetTag remove(long tagId)
239 throws NoSuchTagException, SystemException {
240 return remove(Long.valueOf(tagId));
241 }
242
243
251 @Override
252 public AssetTag remove(Serializable primaryKey)
253 throws NoSuchTagException, SystemException {
254 Session session = null;
255
256 try {
257 session = openSession();
258
259 AssetTag assetTag = (AssetTag)session.get(AssetTagImpl.class,
260 primaryKey);
261
262 if (assetTag == null) {
263 if (_log.isWarnEnabled()) {
264 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
265 }
266
267 throw new NoSuchTagException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
268 primaryKey);
269 }
270
271 return remove(assetTag);
272 }
273 catch (NoSuchTagException nsee) {
274 throw nsee;
275 }
276 catch (Exception e) {
277 throw processException(e);
278 }
279 finally {
280 closeSession(session);
281 }
282 }
283
284 @Override
285 protected AssetTag removeImpl(AssetTag assetTag) throws SystemException {
286 assetTag = toUnwrappedModel(assetTag);
287
288 try {
289 clearAssetEntries.clear(assetTag.getPrimaryKey());
290 }
291 catch (Exception e) {
292 throw processException(e);
293 }
294 finally {
295 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
296 }
297
298 Session session = null;
299
300 try {
301 session = openSession();
302
303 if (assetTag.isCachedModel()) {
304 assetTag = (AssetTag)session.get(AssetTagImpl.class,
305 assetTag.getPrimaryKeyObj());
306 }
307
308 session.delete(assetTag);
309 }
310 catch (Exception e) {
311 throw processException(e);
312 }
313 finally {
314 closeSession(session);
315 }
316
317 clearCache(assetTag);
318
319 return assetTag;
320 }
321
322 @Override
323 public AssetTag updateImpl(
324 com.liferay.portlet.asset.model.AssetTag assetTag)
325 throws SystemException {
326 assetTag = toUnwrappedModel(assetTag);
327
328 boolean isNew = assetTag.isNew();
329
330 AssetTagModelImpl assetTagModelImpl = (AssetTagModelImpl)assetTag;
331
332 Session session = null;
333
334 try {
335 session = openSession();
336
337 if (assetTag.isNew()) {
338 session.save(assetTag);
339
340 assetTag.setNew(false);
341 }
342 else {
343 session.merge(assetTag);
344 }
345 }
346 catch (Exception e) {
347 throw processException(e);
348 }
349 finally {
350 closeSession(session);
351 }
352
353 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
354
355 if (isNew || !AssetTagModelImpl.COLUMN_BITMASK_ENABLED) {
356 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
357 }
358
359 else {
360 if ((assetTagModelImpl.getColumnBitmask() &
361 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
362 Object[] args = new Object[] {
363 Long.valueOf(assetTagModelImpl.getOriginalGroupId())
364 };
365
366 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
367 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
368 args);
369
370 args = new Object[] { Long.valueOf(assetTagModelImpl.getGroupId()) };
371
372 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
373 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
374 args);
375 }
376 }
377
378 EntityCacheUtil.putResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
379 AssetTagImpl.class, assetTag.getPrimaryKey(), assetTag);
380
381 if (isNew) {
382 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
383 new Object[] {
384 Long.valueOf(assetTag.getGroupId()),
385
386 assetTag.getName()
387 }, assetTag);
388 }
389 else {
390 if ((assetTagModelImpl.getColumnBitmask() &
391 FINDER_PATH_FETCH_BY_G_N.getColumnBitmask()) != 0) {
392 Object[] args = new Object[] {
393 Long.valueOf(assetTagModelImpl.getOriginalGroupId()),
394
395 assetTagModelImpl.getOriginalName()
396 };
397
398 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_N, args);
399
400 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N, args);
401
402 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
403 new Object[] {
404 Long.valueOf(assetTag.getGroupId()),
405
406 assetTag.getName()
407 }, assetTag);
408 }
409 }
410
411 return assetTag;
412 }
413
414 protected AssetTag toUnwrappedModel(AssetTag assetTag) {
415 if (assetTag instanceof AssetTagImpl) {
416 return assetTag;
417 }
418
419 AssetTagImpl assetTagImpl = new AssetTagImpl();
420
421 assetTagImpl.setNew(assetTag.isNew());
422 assetTagImpl.setPrimaryKey(assetTag.getPrimaryKey());
423
424 assetTagImpl.setTagId(assetTag.getTagId());
425 assetTagImpl.setGroupId(assetTag.getGroupId());
426 assetTagImpl.setCompanyId(assetTag.getCompanyId());
427 assetTagImpl.setUserId(assetTag.getUserId());
428 assetTagImpl.setUserName(assetTag.getUserName());
429 assetTagImpl.setCreateDate(assetTag.getCreateDate());
430 assetTagImpl.setModifiedDate(assetTag.getModifiedDate());
431 assetTagImpl.setName(assetTag.getName());
432 assetTagImpl.setAssetCount(assetTag.getAssetCount());
433
434 return assetTagImpl;
435 }
436
437
445 @Override
446 public AssetTag findByPrimaryKey(Serializable primaryKey)
447 throws NoSuchModelException, SystemException {
448 return findByPrimaryKey(((Long)primaryKey).longValue());
449 }
450
451
459 public AssetTag findByPrimaryKey(long tagId)
460 throws NoSuchTagException, SystemException {
461 AssetTag assetTag = fetchByPrimaryKey(tagId);
462
463 if (assetTag == null) {
464 if (_log.isWarnEnabled()) {
465 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + tagId);
466 }
467
468 throw new NoSuchTagException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
469 tagId);
470 }
471
472 return assetTag;
473 }
474
475
482 @Override
483 public AssetTag fetchByPrimaryKey(Serializable primaryKey)
484 throws SystemException {
485 return fetchByPrimaryKey(((Long)primaryKey).longValue());
486 }
487
488
495 public AssetTag fetchByPrimaryKey(long tagId) throws SystemException {
496 AssetTag assetTag = (AssetTag)EntityCacheUtil.getResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
497 AssetTagImpl.class, tagId);
498
499 if (assetTag == _nullAssetTag) {
500 return null;
501 }
502
503 if (assetTag == null) {
504 Session session = null;
505
506 boolean hasException = false;
507
508 try {
509 session = openSession();
510
511 assetTag = (AssetTag)session.get(AssetTagImpl.class,
512 Long.valueOf(tagId));
513 }
514 catch (Exception e) {
515 hasException = true;
516
517 throw processException(e);
518 }
519 finally {
520 if (assetTag != null) {
521 cacheResult(assetTag);
522 }
523 else if (!hasException) {
524 EntityCacheUtil.putResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
525 AssetTagImpl.class, tagId, _nullAssetTag);
526 }
527
528 closeSession(session);
529 }
530 }
531
532 return assetTag;
533 }
534
535
542 public List<AssetTag> findByGroupId(long groupId) throws SystemException {
543 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
544 }
545
546
559 public List<AssetTag> findByGroupId(long groupId, int start, int end)
560 throws SystemException {
561 return findByGroupId(groupId, start, end, null);
562 }
563
564
578 public List<AssetTag> findByGroupId(long groupId, int start, int end,
579 OrderByComparator orderByComparator) throws SystemException {
580 FinderPath finderPath = null;
581 Object[] finderArgs = null;
582
583 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
584 (orderByComparator == null)) {
585 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
586 finderArgs = new Object[] { groupId };
587 }
588 else {
589 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
590 finderArgs = new Object[] { groupId, start, end, orderByComparator };
591 }
592
593 List<AssetTag> list = (List<AssetTag>)FinderCacheUtil.getResult(finderPath,
594 finderArgs, this);
595
596 if ((list != null) && !list.isEmpty()) {
597 for (AssetTag assetTag : list) {
598 if ((groupId != assetTag.getGroupId())) {
599 list = null;
600
601 break;
602 }
603 }
604 }
605
606 if (list == null) {
607 StringBundler query = null;
608
609 if (orderByComparator != null) {
610 query = new StringBundler(3 +
611 (orderByComparator.getOrderByFields().length * 3));
612 }
613 else {
614 query = new StringBundler(3);
615 }
616
617 query.append(_SQL_SELECT_ASSETTAG_WHERE);
618
619 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
620
621 if (orderByComparator != null) {
622 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
623 orderByComparator);
624 }
625
626 else {
627 query.append(AssetTagModelImpl.ORDER_BY_JPQL);
628 }
629
630 String sql = query.toString();
631
632 Session session = null;
633
634 try {
635 session = openSession();
636
637 Query q = session.createQuery(sql);
638
639 QueryPos qPos = QueryPos.getInstance(q);
640
641 qPos.add(groupId);
642
643 list = (List<AssetTag>)QueryUtil.list(q, getDialect(), start,
644 end);
645 }
646 catch (Exception e) {
647 throw processException(e);
648 }
649 finally {
650 if (list == null) {
651 FinderCacheUtil.removeResult(finderPath, finderArgs);
652 }
653 else {
654 cacheResult(list);
655
656 FinderCacheUtil.putResult(finderPath, finderArgs, list);
657 }
658
659 closeSession(session);
660 }
661 }
662
663 return list;
664 }
665
666
675 public AssetTag findByGroupId_First(long groupId,
676 OrderByComparator orderByComparator)
677 throws NoSuchTagException, SystemException {
678 AssetTag assetTag = fetchByGroupId_First(groupId, orderByComparator);
679
680 if (assetTag != null) {
681 return assetTag;
682 }
683
684 StringBundler msg = new StringBundler(4);
685
686 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
687
688 msg.append("groupId=");
689 msg.append(groupId);
690
691 msg.append(StringPool.CLOSE_CURLY_BRACE);
692
693 throw new NoSuchTagException(msg.toString());
694 }
695
696
704 public AssetTag fetchByGroupId_First(long groupId,
705 OrderByComparator orderByComparator) throws SystemException {
706 List<AssetTag> list = findByGroupId(groupId, 0, 1, orderByComparator);
707
708 if (!list.isEmpty()) {
709 return list.get(0);
710 }
711
712 return null;
713 }
714
715
724 public AssetTag findByGroupId_Last(long groupId,
725 OrderByComparator orderByComparator)
726 throws NoSuchTagException, SystemException {
727 AssetTag assetTag = fetchByGroupId_Last(groupId, orderByComparator);
728
729 if (assetTag != null) {
730 return assetTag;
731 }
732
733 StringBundler msg = new StringBundler(4);
734
735 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
736
737 msg.append("groupId=");
738 msg.append(groupId);
739
740 msg.append(StringPool.CLOSE_CURLY_BRACE);
741
742 throw new NoSuchTagException(msg.toString());
743 }
744
745
753 public AssetTag fetchByGroupId_Last(long groupId,
754 OrderByComparator orderByComparator) throws SystemException {
755 int count = countByGroupId(groupId);
756
757 List<AssetTag> list = findByGroupId(groupId, count - 1, count,
758 orderByComparator);
759
760 if (!list.isEmpty()) {
761 return list.get(0);
762 }
763
764 return null;
765 }
766
767
777 public AssetTag[] findByGroupId_PrevAndNext(long tagId, long groupId,
778 OrderByComparator orderByComparator)
779 throws NoSuchTagException, SystemException {
780 AssetTag assetTag = findByPrimaryKey(tagId);
781
782 Session session = null;
783
784 try {
785 session = openSession();
786
787 AssetTag[] array = new AssetTagImpl[3];
788
789 array[0] = getByGroupId_PrevAndNext(session, assetTag, groupId,
790 orderByComparator, true);
791
792 array[1] = assetTag;
793
794 array[2] = getByGroupId_PrevAndNext(session, assetTag, groupId,
795 orderByComparator, false);
796
797 return array;
798 }
799 catch (Exception e) {
800 throw processException(e);
801 }
802 finally {
803 closeSession(session);
804 }
805 }
806
807 protected AssetTag getByGroupId_PrevAndNext(Session session,
808 AssetTag assetTag, long groupId, OrderByComparator orderByComparator,
809 boolean previous) {
810 StringBundler query = null;
811
812 if (orderByComparator != null) {
813 query = new StringBundler(6 +
814 (orderByComparator.getOrderByFields().length * 6));
815 }
816 else {
817 query = new StringBundler(3);
818 }
819
820 query.append(_SQL_SELECT_ASSETTAG_WHERE);
821
822 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
823
824 if (orderByComparator != null) {
825 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
826
827 if (orderByConditionFields.length > 0) {
828 query.append(WHERE_AND);
829 }
830
831 for (int i = 0; i < orderByConditionFields.length; i++) {
832 query.append(_ORDER_BY_ENTITY_ALIAS);
833 query.append(orderByConditionFields[i]);
834
835 if ((i + 1) < orderByConditionFields.length) {
836 if (orderByComparator.isAscending() ^ previous) {
837 query.append(WHERE_GREATER_THAN_HAS_NEXT);
838 }
839 else {
840 query.append(WHERE_LESSER_THAN_HAS_NEXT);
841 }
842 }
843 else {
844 if (orderByComparator.isAscending() ^ previous) {
845 query.append(WHERE_GREATER_THAN);
846 }
847 else {
848 query.append(WHERE_LESSER_THAN);
849 }
850 }
851 }
852
853 query.append(ORDER_BY_CLAUSE);
854
855 String[] orderByFields = orderByComparator.getOrderByFields();
856
857 for (int i = 0; i < orderByFields.length; i++) {
858 query.append(_ORDER_BY_ENTITY_ALIAS);
859 query.append(orderByFields[i]);
860
861 if ((i + 1) < orderByFields.length) {
862 if (orderByComparator.isAscending() ^ previous) {
863 query.append(ORDER_BY_ASC_HAS_NEXT);
864 }
865 else {
866 query.append(ORDER_BY_DESC_HAS_NEXT);
867 }
868 }
869 else {
870 if (orderByComparator.isAscending() ^ previous) {
871 query.append(ORDER_BY_ASC);
872 }
873 else {
874 query.append(ORDER_BY_DESC);
875 }
876 }
877 }
878 }
879
880 else {
881 query.append(AssetTagModelImpl.ORDER_BY_JPQL);
882 }
883
884 String sql = query.toString();
885
886 Query q = session.createQuery(sql);
887
888 q.setFirstResult(0);
889 q.setMaxResults(2);
890
891 QueryPos qPos = QueryPos.getInstance(q);
892
893 qPos.add(groupId);
894
895 if (orderByComparator != null) {
896 Object[] values = orderByComparator.getOrderByConditionValues(assetTag);
897
898 for (Object value : values) {
899 qPos.add(value);
900 }
901 }
902
903 List<AssetTag> list = q.list();
904
905 if (list.size() == 2) {
906 return list.get(1);
907 }
908 else {
909 return null;
910 }
911 }
912
913
920 public List<AssetTag> filterFindByGroupId(long groupId)
921 throws SystemException {
922 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
923 QueryUtil.ALL_POS, null);
924 }
925
926
939 public List<AssetTag> filterFindByGroupId(long groupId, int start, int end)
940 throws SystemException {
941 return filterFindByGroupId(groupId, start, end, null);
942 }
943
944
958 public List<AssetTag> filterFindByGroupId(long groupId, int start, int end,
959 OrderByComparator orderByComparator) throws SystemException {
960 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
961 return findByGroupId(groupId, start, end, orderByComparator);
962 }
963
964 StringBundler query = null;
965
966 if (orderByComparator != null) {
967 query = new StringBundler(3 +
968 (orderByComparator.getOrderByFields().length * 3));
969 }
970 else {
971 query = new StringBundler(3);
972 }
973
974 if (getDB().isSupportsInlineDistinct()) {
975 query.append(_FILTER_SQL_SELECT_ASSETTAG_WHERE);
976 }
977 else {
978 query.append(_FILTER_SQL_SELECT_ASSETTAG_NO_INLINE_DISTINCT_WHERE_1);
979 }
980
981 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
982
983 if (!getDB().isSupportsInlineDistinct()) {
984 query.append(_FILTER_SQL_SELECT_ASSETTAG_NO_INLINE_DISTINCT_WHERE_2);
985 }
986
987 if (orderByComparator != null) {
988 if (getDB().isSupportsInlineDistinct()) {
989 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
990 orderByComparator);
991 }
992 else {
993 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
994 orderByComparator);
995 }
996 }
997
998 else {
999 if (getDB().isSupportsInlineDistinct()) {
1000 query.append(AssetTagModelImpl.ORDER_BY_JPQL);
1001 }
1002 else {
1003 query.append(AssetTagModelImpl.ORDER_BY_SQL);
1004 }
1005 }
1006
1007 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1008 AssetTag.class.getName(),
1009 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1010
1011 Session session = null;
1012
1013 try {
1014 session = openSession();
1015
1016 SQLQuery q = session.createSQLQuery(sql);
1017
1018 if (getDB().isSupportsInlineDistinct()) {
1019 q.addEntity(_FILTER_ENTITY_ALIAS, AssetTagImpl.class);
1020 }
1021 else {
1022 q.addEntity(_FILTER_ENTITY_TABLE, AssetTagImpl.class);
1023 }
1024
1025 QueryPos qPos = QueryPos.getInstance(q);
1026
1027 qPos.add(groupId);
1028
1029 return (List<AssetTag>)QueryUtil.list(q, getDialect(), start, end);
1030 }
1031 catch (Exception e) {
1032 throw processException(e);
1033 }
1034 finally {
1035 closeSession(session);
1036 }
1037 }
1038
1039
1049 public AssetTag[] filterFindByGroupId_PrevAndNext(long tagId, long groupId,
1050 OrderByComparator orderByComparator)
1051 throws NoSuchTagException, SystemException {
1052 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1053 return findByGroupId_PrevAndNext(tagId, groupId, orderByComparator);
1054 }
1055
1056 AssetTag assetTag = findByPrimaryKey(tagId);
1057
1058 Session session = null;
1059
1060 try {
1061 session = openSession();
1062
1063 AssetTag[] array = new AssetTagImpl[3];
1064
1065 array[0] = filterGetByGroupId_PrevAndNext(session, assetTag,
1066 groupId, orderByComparator, true);
1067
1068 array[1] = assetTag;
1069
1070 array[2] = filterGetByGroupId_PrevAndNext(session, assetTag,
1071 groupId, orderByComparator, false);
1072
1073 return array;
1074 }
1075 catch (Exception e) {
1076 throw processException(e);
1077 }
1078 finally {
1079 closeSession(session);
1080 }
1081 }
1082
1083 protected AssetTag filterGetByGroupId_PrevAndNext(Session session,
1084 AssetTag assetTag, long groupId, OrderByComparator orderByComparator,
1085 boolean previous) {
1086 StringBundler query = null;
1087
1088 if (orderByComparator != null) {
1089 query = new StringBundler(6 +
1090 (orderByComparator.getOrderByFields().length * 6));
1091 }
1092 else {
1093 query = new StringBundler(3);
1094 }
1095
1096 if (getDB().isSupportsInlineDistinct()) {
1097 query.append(_FILTER_SQL_SELECT_ASSETTAG_WHERE);
1098 }
1099 else {
1100 query.append(_FILTER_SQL_SELECT_ASSETTAG_NO_INLINE_DISTINCT_WHERE_1);
1101 }
1102
1103 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1104
1105 if (!getDB().isSupportsInlineDistinct()) {
1106 query.append(_FILTER_SQL_SELECT_ASSETTAG_NO_INLINE_DISTINCT_WHERE_2);
1107 }
1108
1109 if (orderByComparator != null) {
1110 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1111
1112 if (orderByConditionFields.length > 0) {
1113 query.append(WHERE_AND);
1114 }
1115
1116 for (int i = 0; i < orderByConditionFields.length; i++) {
1117 if (getDB().isSupportsInlineDistinct()) {
1118 query.append(_ORDER_BY_ENTITY_ALIAS);
1119 }
1120 else {
1121 query.append(_ORDER_BY_ENTITY_TABLE);
1122 }
1123
1124 query.append(orderByConditionFields[i]);
1125
1126 if ((i + 1) < orderByConditionFields.length) {
1127 if (orderByComparator.isAscending() ^ previous) {
1128 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1129 }
1130 else {
1131 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1132 }
1133 }
1134 else {
1135 if (orderByComparator.isAscending() ^ previous) {
1136 query.append(WHERE_GREATER_THAN);
1137 }
1138 else {
1139 query.append(WHERE_LESSER_THAN);
1140 }
1141 }
1142 }
1143
1144 query.append(ORDER_BY_CLAUSE);
1145
1146 String[] orderByFields = orderByComparator.getOrderByFields();
1147
1148 for (int i = 0; i < orderByFields.length; i++) {
1149 if (getDB().isSupportsInlineDistinct()) {
1150 query.append(_ORDER_BY_ENTITY_ALIAS);
1151 }
1152 else {
1153 query.append(_ORDER_BY_ENTITY_TABLE);
1154 }
1155
1156 query.append(orderByFields[i]);
1157
1158 if ((i + 1) < orderByFields.length) {
1159 if (orderByComparator.isAscending() ^ previous) {
1160 query.append(ORDER_BY_ASC_HAS_NEXT);
1161 }
1162 else {
1163 query.append(ORDER_BY_DESC_HAS_NEXT);
1164 }
1165 }
1166 else {
1167 if (orderByComparator.isAscending() ^ previous) {
1168 query.append(ORDER_BY_ASC);
1169 }
1170 else {
1171 query.append(ORDER_BY_DESC);
1172 }
1173 }
1174 }
1175 }
1176
1177 else {
1178 if (getDB().isSupportsInlineDistinct()) {
1179 query.append(AssetTagModelImpl.ORDER_BY_JPQL);
1180 }
1181 else {
1182 query.append(AssetTagModelImpl.ORDER_BY_SQL);
1183 }
1184 }
1185
1186 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1187 AssetTag.class.getName(),
1188 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1189
1190 SQLQuery q = session.createSQLQuery(sql);
1191
1192 q.setFirstResult(0);
1193 q.setMaxResults(2);
1194
1195 if (getDB().isSupportsInlineDistinct()) {
1196 q.addEntity(_FILTER_ENTITY_ALIAS, AssetTagImpl.class);
1197 }
1198 else {
1199 q.addEntity(_FILTER_ENTITY_TABLE, AssetTagImpl.class);
1200 }
1201
1202 QueryPos qPos = QueryPos.getInstance(q);
1203
1204 qPos.add(groupId);
1205
1206 if (orderByComparator != null) {
1207 Object[] values = orderByComparator.getOrderByConditionValues(assetTag);
1208
1209 for (Object value : values) {
1210 qPos.add(value);
1211 }
1212 }
1213
1214 List<AssetTag> list = q.list();
1215
1216 if (list.size() == 2) {
1217 return list.get(1);
1218 }
1219 else {
1220 return null;
1221 }
1222 }
1223
1224
1233 public AssetTag findByG_N(long groupId, String name)
1234 throws NoSuchTagException, SystemException {
1235 AssetTag assetTag = fetchByG_N(groupId, name);
1236
1237 if (assetTag == null) {
1238 StringBundler msg = new StringBundler(6);
1239
1240 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1241
1242 msg.append("groupId=");
1243 msg.append(groupId);
1244
1245 msg.append(", name=");
1246 msg.append(name);
1247
1248 msg.append(StringPool.CLOSE_CURLY_BRACE);
1249
1250 if (_log.isWarnEnabled()) {
1251 _log.warn(msg.toString());
1252 }
1253
1254 throw new NoSuchTagException(msg.toString());
1255 }
1256
1257 return assetTag;
1258 }
1259
1260
1268 public AssetTag fetchByG_N(long groupId, String name)
1269 throws SystemException {
1270 return fetchByG_N(groupId, name, true);
1271 }
1272
1273
1282 public AssetTag fetchByG_N(long groupId, String name,
1283 boolean retrieveFromCache) throws SystemException {
1284 Object[] finderArgs = new Object[] { groupId, name };
1285
1286 Object result = null;
1287
1288 if (retrieveFromCache) {
1289 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N,
1290 finderArgs, this);
1291 }
1292
1293 if (result instanceof AssetTag) {
1294 AssetTag assetTag = (AssetTag)result;
1295
1296 if ((groupId != assetTag.getGroupId()) ||
1297 !Validator.equals(name, assetTag.getName())) {
1298 result = null;
1299 }
1300 }
1301
1302 if (result == null) {
1303 StringBundler query = new StringBundler(4);
1304
1305 query.append(_SQL_SELECT_ASSETTAG_WHERE);
1306
1307 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
1308
1309 if (name == null) {
1310 query.append(_FINDER_COLUMN_G_N_NAME_1);
1311 }
1312 else {
1313 if (name.equals(StringPool.BLANK)) {
1314 query.append(_FINDER_COLUMN_G_N_NAME_3);
1315 }
1316 else {
1317 query.append(_FINDER_COLUMN_G_N_NAME_2);
1318 }
1319 }
1320
1321 query.append(AssetTagModelImpl.ORDER_BY_JPQL);
1322
1323 String sql = query.toString();
1324
1325 Session session = null;
1326
1327 try {
1328 session = openSession();
1329
1330 Query q = session.createQuery(sql);
1331
1332 QueryPos qPos = QueryPos.getInstance(q);
1333
1334 qPos.add(groupId);
1335
1336 if (name != null) {
1337 qPos.add(name);
1338 }
1339
1340 List<AssetTag> list = q.list();
1341
1342 result = list;
1343
1344 AssetTag assetTag = null;
1345
1346 if (list.isEmpty()) {
1347 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1348 finderArgs, list);
1349 }
1350 else {
1351 assetTag = list.get(0);
1352
1353 cacheResult(assetTag);
1354
1355 if ((assetTag.getGroupId() != groupId) ||
1356 (assetTag.getName() == null) ||
1357 !assetTag.getName().equals(name)) {
1358 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1359 finderArgs, assetTag);
1360 }
1361 }
1362
1363 return assetTag;
1364 }
1365 catch (Exception e) {
1366 throw processException(e);
1367 }
1368 finally {
1369 if (result == null) {
1370 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
1371 finderArgs);
1372 }
1373
1374 closeSession(session);
1375 }
1376 }
1377 else {
1378 if (result instanceof List<?>) {
1379 return null;
1380 }
1381 else {
1382 return (AssetTag)result;
1383 }
1384 }
1385 }
1386
1387
1393 public List<AssetTag> findAll() throws SystemException {
1394 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1395 }
1396
1397
1409 public List<AssetTag> findAll(int start, int end) throws SystemException {
1410 return findAll(start, end, null);
1411 }
1412
1413
1426 public List<AssetTag> findAll(int start, int end,
1427 OrderByComparator orderByComparator) throws SystemException {
1428 FinderPath finderPath = null;
1429 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1430
1431 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1432 (orderByComparator == null)) {
1433 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1434 finderArgs = FINDER_ARGS_EMPTY;
1435 }
1436 else {
1437 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1438 finderArgs = new Object[] { start, end, orderByComparator };
1439 }
1440
1441 List<AssetTag> list = (List<AssetTag>)FinderCacheUtil.getResult(finderPath,
1442 finderArgs, this);
1443
1444 if (list == null) {
1445 StringBundler query = null;
1446 String sql = null;
1447
1448 if (orderByComparator != null) {
1449 query = new StringBundler(2 +
1450 (orderByComparator.getOrderByFields().length * 3));
1451
1452 query.append(_SQL_SELECT_ASSETTAG);
1453
1454 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1455 orderByComparator);
1456
1457 sql = query.toString();
1458 }
1459 else {
1460 sql = _SQL_SELECT_ASSETTAG.concat(AssetTagModelImpl.ORDER_BY_JPQL);
1461 }
1462
1463 Session session = null;
1464
1465 try {
1466 session = openSession();
1467
1468 Query q = session.createQuery(sql);
1469
1470 if (orderByComparator == null) {
1471 list = (List<AssetTag>)QueryUtil.list(q, getDialect(),
1472 start, end, false);
1473
1474 Collections.sort(list);
1475 }
1476 else {
1477 list = (List<AssetTag>)QueryUtil.list(q, getDialect(),
1478 start, end);
1479 }
1480 }
1481 catch (Exception e) {
1482 throw processException(e);
1483 }
1484 finally {
1485 if (list == null) {
1486 FinderCacheUtil.removeResult(finderPath, finderArgs);
1487 }
1488 else {
1489 cacheResult(list);
1490
1491 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1492 }
1493
1494 closeSession(session);
1495 }
1496 }
1497
1498 return list;
1499 }
1500
1501
1507 public void removeByGroupId(long groupId) throws SystemException {
1508 for (AssetTag assetTag : findByGroupId(groupId)) {
1509 remove(assetTag);
1510 }
1511 }
1512
1513
1521 public AssetTag removeByG_N(long groupId, String name)
1522 throws NoSuchTagException, SystemException {
1523 AssetTag assetTag = findByG_N(groupId, name);
1524
1525 return remove(assetTag);
1526 }
1527
1528
1533 public void removeAll() throws SystemException {
1534 for (AssetTag assetTag : findAll()) {
1535 remove(assetTag);
1536 }
1537 }
1538
1539
1546 public int countByGroupId(long groupId) throws SystemException {
1547 Object[] finderArgs = new Object[] { groupId };
1548
1549 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1550 finderArgs, this);
1551
1552 if (count == null) {
1553 StringBundler query = new StringBundler(2);
1554
1555 query.append(_SQL_COUNT_ASSETTAG_WHERE);
1556
1557 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1558
1559 String sql = query.toString();
1560
1561 Session session = null;
1562
1563 try {
1564 session = openSession();
1565
1566 Query q = session.createQuery(sql);
1567
1568 QueryPos qPos = QueryPos.getInstance(q);
1569
1570 qPos.add(groupId);
1571
1572 count = (Long)q.uniqueResult();
1573 }
1574 catch (Exception e) {
1575 throw processException(e);
1576 }
1577 finally {
1578 if (count == null) {
1579 count = Long.valueOf(0);
1580 }
1581
1582 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1583 finderArgs, count);
1584
1585 closeSession(session);
1586 }
1587 }
1588
1589 return count.intValue();
1590 }
1591
1592
1599 public int filterCountByGroupId(long groupId) throws SystemException {
1600 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1601 return countByGroupId(groupId);
1602 }
1603
1604 StringBundler query = new StringBundler(2);
1605
1606 query.append(_FILTER_SQL_COUNT_ASSETTAG_WHERE);
1607
1608 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1609
1610 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1611 AssetTag.class.getName(),
1612 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1613
1614 Session session = null;
1615
1616 try {
1617 session = openSession();
1618
1619 SQLQuery q = session.createSQLQuery(sql);
1620
1621 q.addScalar(COUNT_COLUMN_NAME,
1622 com.liferay.portal.kernel.dao.orm.Type.LONG);
1623
1624 QueryPos qPos = QueryPos.getInstance(q);
1625
1626 qPos.add(groupId);
1627
1628 Long count = (Long)q.uniqueResult();
1629
1630 return count.intValue();
1631 }
1632 catch (Exception e) {
1633 throw processException(e);
1634 }
1635 finally {
1636 closeSession(session);
1637 }
1638 }
1639
1640
1648 public int countByG_N(long groupId, String name) throws SystemException {
1649 Object[] finderArgs = new Object[] { groupId, name };
1650
1651 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N,
1652 finderArgs, this);
1653
1654 if (count == null) {
1655 StringBundler query = new StringBundler(3);
1656
1657 query.append(_SQL_COUNT_ASSETTAG_WHERE);
1658
1659 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
1660
1661 if (name == null) {
1662 query.append(_FINDER_COLUMN_G_N_NAME_1);
1663 }
1664 else {
1665 if (name.equals(StringPool.BLANK)) {
1666 query.append(_FINDER_COLUMN_G_N_NAME_3);
1667 }
1668 else {
1669 query.append(_FINDER_COLUMN_G_N_NAME_2);
1670 }
1671 }
1672
1673 String sql = query.toString();
1674
1675 Session session = null;
1676
1677 try {
1678 session = openSession();
1679
1680 Query q = session.createQuery(sql);
1681
1682 QueryPos qPos = QueryPos.getInstance(q);
1683
1684 qPos.add(groupId);
1685
1686 if (name != null) {
1687 qPos.add(name);
1688 }
1689
1690 count = (Long)q.uniqueResult();
1691 }
1692 catch (Exception e) {
1693 throw processException(e);
1694 }
1695 finally {
1696 if (count == null) {
1697 count = Long.valueOf(0);
1698 }
1699
1700 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, finderArgs,
1701 count);
1702
1703 closeSession(session);
1704 }
1705 }
1706
1707 return count.intValue();
1708 }
1709
1710
1716 public int countAll() throws SystemException {
1717 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1718 FINDER_ARGS_EMPTY, this);
1719
1720 if (count == null) {
1721 Session session = null;
1722
1723 try {
1724 session = openSession();
1725
1726 Query q = session.createQuery(_SQL_COUNT_ASSETTAG);
1727
1728 count = (Long)q.uniqueResult();
1729 }
1730 catch (Exception e) {
1731 throw processException(e);
1732 }
1733 finally {
1734 if (count == null) {
1735 count = Long.valueOf(0);
1736 }
1737
1738 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1739 FINDER_ARGS_EMPTY, count);
1740
1741 closeSession(session);
1742 }
1743 }
1744
1745 return count.intValue();
1746 }
1747
1748
1755 public List<com.liferay.portlet.asset.model.AssetEntry> getAssetEntries(
1756 long pk) throws SystemException {
1757 return getAssetEntries(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1758 }
1759
1760
1773 public List<com.liferay.portlet.asset.model.AssetEntry> getAssetEntries(
1774 long pk, int start, int end) throws SystemException {
1775 return getAssetEntries(pk, start, end, null);
1776 }
1777
1778 public static final FinderPath FINDER_PATH_GET_ASSETENTRIES = new FinderPath(com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
1779 AssetTagModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
1780 com.liferay.portlet.asset.model.impl.AssetEntryImpl.class,
1781 AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
1782 "getAssetEntries",
1783 new String[] {
1784 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1785 "com.liferay.portal.kernel.util.OrderByComparator"
1786 });
1787
1788 static {
1789 FINDER_PATH_GET_ASSETENTRIES.setCacheKeyGeneratorCacheName(null);
1790 }
1791
1792
1806 public List<com.liferay.portlet.asset.model.AssetEntry> getAssetEntries(
1807 long pk, int start, int end, OrderByComparator orderByComparator)
1808 throws SystemException {
1809 Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };
1810
1811 List<com.liferay.portlet.asset.model.AssetEntry> list = (List<com.liferay.portlet.asset.model.AssetEntry>)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETENTRIES,
1812 finderArgs, this);
1813
1814 if (list == null) {
1815 Session session = null;
1816
1817 try {
1818 session = openSession();
1819
1820 String sql = null;
1821
1822 if (orderByComparator != null) {
1823 sql = _SQL_GETASSETENTRIES.concat(ORDER_BY_CLAUSE)
1824 .concat(orderByComparator.getOrderBy());
1825 }
1826 else {
1827 sql = _SQL_GETASSETENTRIES;
1828 }
1829
1830 SQLQuery q = session.createSQLQuery(sql);
1831
1832 q.addEntity("AssetEntry",
1833 com.liferay.portlet.asset.model.impl.AssetEntryImpl.class);
1834
1835 QueryPos qPos = QueryPos.getInstance(q);
1836
1837 qPos.add(pk);
1838
1839 list = (List<com.liferay.portlet.asset.model.AssetEntry>)QueryUtil.list(q,
1840 getDialect(), start, end);
1841 }
1842 catch (Exception e) {
1843 throw processException(e);
1844 }
1845 finally {
1846 if (list == null) {
1847 FinderCacheUtil.removeResult(FINDER_PATH_GET_ASSETENTRIES,
1848 finderArgs);
1849 }
1850 else {
1851 assetEntryPersistence.cacheResult(list);
1852
1853 FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETENTRIES,
1854 finderArgs, list);
1855 }
1856
1857 closeSession(session);
1858 }
1859 }
1860
1861 return list;
1862 }
1863
1864 public static final FinderPath FINDER_PATH_GET_ASSETENTRIES_SIZE = new FinderPath(com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
1865 AssetTagModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
1866 Long.class,
1867 AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
1868 "getAssetEntriesSize", new String[] { Long.class.getName() });
1869
1870 static {
1871 FINDER_PATH_GET_ASSETENTRIES_SIZE.setCacheKeyGeneratorCacheName(null);
1872 }
1873
1874
1881 public int getAssetEntriesSize(long pk) throws SystemException {
1882 Object[] finderArgs = new Object[] { pk };
1883
1884 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETENTRIES_SIZE,
1885 finderArgs, this);
1886
1887 if (count == null) {
1888 Session session = null;
1889
1890 try {
1891 session = openSession();
1892
1893 SQLQuery q = session.createSQLQuery(_SQL_GETASSETENTRIESSIZE);
1894
1895 q.addScalar(COUNT_COLUMN_NAME,
1896 com.liferay.portal.kernel.dao.orm.Type.LONG);
1897
1898 QueryPos qPos = QueryPos.getInstance(q);
1899
1900 qPos.add(pk);
1901
1902 count = (Long)q.uniqueResult();
1903 }
1904 catch (Exception e) {
1905 throw processException(e);
1906 }
1907 finally {
1908 if (count == null) {
1909 count = Long.valueOf(0);
1910 }
1911
1912 FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETENTRIES_SIZE,
1913 finderArgs, count);
1914
1915 closeSession(session);
1916 }
1917 }
1918
1919 return count.intValue();
1920 }
1921
1922 public static final FinderPath FINDER_PATH_CONTAINS_ASSETENTRY = new FinderPath(com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
1923 AssetTagModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
1924 Boolean.class,
1925 AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
1926 "containsAssetEntry",
1927 new String[] { Long.class.getName(), Long.class.getName() });
1928
1929
1937 public boolean containsAssetEntry(long pk, long assetEntryPK)
1938 throws SystemException {
1939 Object[] finderArgs = new Object[] { pk, assetEntryPK };
1940
1941 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ASSETENTRY,
1942 finderArgs, this);
1943
1944 if (value == null) {
1945 try {
1946 value = Boolean.valueOf(containsAssetEntry.contains(pk,
1947 assetEntryPK));
1948 }
1949 catch (Exception e) {
1950 throw processException(e);
1951 }
1952 finally {
1953 if (value == null) {
1954 value = Boolean.FALSE;
1955 }
1956
1957 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ASSETENTRY,
1958 finderArgs, value);
1959 }
1960 }
1961
1962 return value.booleanValue();
1963 }
1964
1965
1972 public boolean containsAssetEntries(long pk) throws SystemException {
1973 if (getAssetEntriesSize(pk) > 0) {
1974 return true;
1975 }
1976 else {
1977 return false;
1978 }
1979 }
1980
1981
1988 public void addAssetEntry(long pk, long assetEntryPK)
1989 throws SystemException {
1990 try {
1991 addAssetEntry.add(pk, assetEntryPK);
1992 }
1993 catch (Exception e) {
1994 throw processException(e);
1995 }
1996 finally {
1997 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1998 }
1999 }
2000
2001
2008 public void addAssetEntry(long pk,
2009 com.liferay.portlet.asset.model.AssetEntry assetEntry)
2010 throws SystemException {
2011 try {
2012 addAssetEntry.add(pk, assetEntry.getPrimaryKey());
2013 }
2014 catch (Exception e) {
2015 throw processException(e);
2016 }
2017 finally {
2018 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2019 }
2020 }
2021
2022
2029 public void addAssetEntries(long pk, long[] assetEntryPKs)
2030 throws SystemException {
2031 try {
2032 for (long assetEntryPK : assetEntryPKs) {
2033 addAssetEntry.add(pk, assetEntryPK);
2034 }
2035 }
2036 catch (Exception e) {
2037 throw processException(e);
2038 }
2039 finally {
2040 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2041 }
2042 }
2043
2044
2051 public void addAssetEntries(long pk,
2052 List<com.liferay.portlet.asset.model.AssetEntry> assetEntries)
2053 throws SystemException {
2054 try {
2055 for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
2056 addAssetEntry.add(pk, assetEntry.getPrimaryKey());
2057 }
2058 }
2059 catch (Exception e) {
2060 throw processException(e);
2061 }
2062 finally {
2063 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2064 }
2065 }
2066
2067
2073 public void clearAssetEntries(long pk) throws SystemException {
2074 try {
2075 clearAssetEntries.clear(pk);
2076 }
2077 catch (Exception e) {
2078 throw processException(e);
2079 }
2080 finally {
2081 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2082 }
2083 }
2084
2085
2092 public void removeAssetEntry(long pk, long assetEntryPK)
2093 throws SystemException {
2094 try {
2095 removeAssetEntry.remove(pk, assetEntryPK);
2096 }
2097 catch (Exception e) {
2098 throw processException(e);
2099 }
2100 finally {
2101 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2102 }
2103 }
2104
2105
2112 public void removeAssetEntry(long pk,
2113 com.liferay.portlet.asset.model.AssetEntry assetEntry)
2114 throws SystemException {
2115 try {
2116 removeAssetEntry.remove(pk, assetEntry.getPrimaryKey());
2117 }
2118 catch (Exception e) {
2119 throw processException(e);
2120 }
2121 finally {
2122 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2123 }
2124 }
2125
2126
2133 public void removeAssetEntries(long pk, long[] assetEntryPKs)
2134 throws SystemException {
2135 try {
2136 for (long assetEntryPK : assetEntryPKs) {
2137 removeAssetEntry.remove(pk, assetEntryPK);
2138 }
2139 }
2140 catch (Exception e) {
2141 throw processException(e);
2142 }
2143 finally {
2144 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2145 }
2146 }
2147
2148
2155 public void removeAssetEntries(long pk,
2156 List<com.liferay.portlet.asset.model.AssetEntry> assetEntries)
2157 throws SystemException {
2158 try {
2159 for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
2160 removeAssetEntry.remove(pk, assetEntry.getPrimaryKey());
2161 }
2162 }
2163 catch (Exception e) {
2164 throw processException(e);
2165 }
2166 finally {
2167 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2168 }
2169 }
2170
2171
2178 public void setAssetEntries(long pk, long[] assetEntryPKs)
2179 throws SystemException {
2180 try {
2181 Set<Long> assetEntryPKSet = SetUtil.fromArray(assetEntryPKs);
2182
2183 List<com.liferay.portlet.asset.model.AssetEntry> assetEntries = getAssetEntries(pk);
2184
2185 for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
2186 if (!assetEntryPKSet.remove(assetEntry.getPrimaryKey())) {
2187 removeAssetEntry.remove(pk, assetEntry.getPrimaryKey());
2188 }
2189 }
2190
2191 for (Long assetEntryPK : assetEntryPKSet) {
2192 addAssetEntry.add(pk, assetEntryPK);
2193 }
2194 }
2195 catch (Exception e) {
2196 throw processException(e);
2197 }
2198 finally {
2199 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2200 }
2201 }
2202
2203
2210 public void setAssetEntries(long pk,
2211 List<com.liferay.portlet.asset.model.AssetEntry> assetEntries)
2212 throws SystemException {
2213 try {
2214 long[] assetEntryPKs = new long[assetEntries.size()];
2215
2216 for (int i = 0; i < assetEntries.size(); i++) {
2217 com.liferay.portlet.asset.model.AssetEntry assetEntry = assetEntries.get(i);
2218
2219 assetEntryPKs[i] = assetEntry.getPrimaryKey();
2220 }
2221
2222 setAssetEntries(pk, assetEntryPKs);
2223 }
2224 catch (Exception e) {
2225 throw processException(e);
2226 }
2227 finally {
2228 FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
2229 }
2230 }
2231
2232
2235 public void afterPropertiesSet() {
2236 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2237 com.liferay.portal.util.PropsUtil.get(
2238 "value.object.listener.com.liferay.portlet.asset.model.AssetTag")));
2239
2240 if (listenerClassNames.length > 0) {
2241 try {
2242 List<ModelListener<AssetTag>> listenersList = new ArrayList<ModelListener<AssetTag>>();
2243
2244 for (String listenerClassName : listenerClassNames) {
2245 listenersList.add((ModelListener<AssetTag>)InstanceFactory.newInstance(
2246 listenerClassName));
2247 }
2248
2249 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2250 }
2251 catch (Exception e) {
2252 _log.error(e);
2253 }
2254 }
2255
2256 containsAssetEntry = new ContainsAssetEntry();
2257
2258 addAssetEntry = new AddAssetEntry();
2259 clearAssetEntries = new ClearAssetEntries();
2260 removeAssetEntry = new RemoveAssetEntry();
2261 }
2262
2263 public void destroy() {
2264 EntityCacheUtil.removeCache(AssetTagImpl.class.getName());
2265 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2266 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2267 }
2268
2269 @BeanReference(type = AssetCategoryPersistence.class)
2270 protected AssetCategoryPersistence assetCategoryPersistence;
2271 @BeanReference(type = AssetCategoryPropertyPersistence.class)
2272 protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
2273 @BeanReference(type = AssetEntryPersistence.class)
2274 protected AssetEntryPersistence assetEntryPersistence;
2275 @BeanReference(type = AssetLinkPersistence.class)
2276 protected AssetLinkPersistence assetLinkPersistence;
2277 @BeanReference(type = AssetTagPersistence.class)
2278 protected AssetTagPersistence assetTagPersistence;
2279 @BeanReference(type = AssetTagPropertyPersistence.class)
2280 protected AssetTagPropertyPersistence assetTagPropertyPersistence;
2281 @BeanReference(type = AssetTagStatsPersistence.class)
2282 protected AssetTagStatsPersistence assetTagStatsPersistence;
2283 @BeanReference(type = AssetVocabularyPersistence.class)
2284 protected AssetVocabularyPersistence assetVocabularyPersistence;
2285 @BeanReference(type = UserPersistence.class)
2286 protected UserPersistence userPersistence;
2287 protected ContainsAssetEntry containsAssetEntry;
2288 protected AddAssetEntry addAssetEntry;
2289 protected ClearAssetEntries clearAssetEntries;
2290 protected RemoveAssetEntry removeAssetEntry;
2291
2292 protected class ContainsAssetEntry {
2293 protected ContainsAssetEntry() {
2294 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2295 _SQL_CONTAINSASSETENTRY,
2296 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2297 RowMapper.COUNT);
2298 }
2299
2300 protected boolean contains(long tagId, long entryId) {
2301 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2302 new Long(tagId), new Long(entryId)
2303 });
2304
2305 if (results.size() > 0) {
2306 Integer count = results.get(0);
2307
2308 if (count.intValue() > 0) {
2309 return true;
2310 }
2311 }
2312
2313 return false;
2314 }
2315
2316 private MappingSqlQuery<Integer> _mappingSqlQuery;
2317 }
2318
2319 protected class AddAssetEntry {
2320 protected AddAssetEntry() {
2321 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2322 "INSERT INTO AssetEntries_AssetTags (tagId, entryId) VALUES (?, ?)",
2323 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2324 }
2325
2326 protected void add(long tagId, long entryId) throws SystemException {
2327 if (!containsAssetEntry.contains(tagId, entryId)) {
2328 ModelListener<com.liferay.portlet.asset.model.AssetEntry>[] assetEntryListeners =
2329 assetEntryPersistence.getListeners();
2330
2331 for (ModelListener<AssetTag> listener : listeners) {
2332 listener.onBeforeAddAssociation(tagId,
2333 com.liferay.portlet.asset.model.AssetEntry.class.getName(),
2334 entryId);
2335 }
2336
2337 for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
2338 listener.onBeforeAddAssociation(entryId,
2339 AssetTag.class.getName(), tagId);
2340 }
2341
2342 _sqlUpdate.update(new Object[] {
2343 new Long(tagId), new Long(entryId)
2344 });
2345
2346 for (ModelListener<AssetTag> listener : listeners) {
2347 listener.onAfterAddAssociation(tagId,
2348 com.liferay.portlet.asset.model.AssetEntry.class.getName(),
2349 entryId);
2350 }
2351
2352 for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
2353 listener.onAfterAddAssociation(entryId,
2354 AssetTag.class.getName(), tagId);
2355 }
2356 }
2357 }
2358
2359 private SqlUpdate _sqlUpdate;
2360 }
2361
2362 protected class ClearAssetEntries {
2363 protected ClearAssetEntries() {
2364 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2365 "DELETE FROM AssetEntries_AssetTags WHERE tagId = ?",
2366 new int[] { java.sql.Types.BIGINT });
2367 }
2368
2369 protected void clear(long tagId) throws SystemException {
2370 ModelListener<com.liferay.portlet.asset.model.AssetEntry>[] assetEntryListeners =
2371 assetEntryPersistence.getListeners();
2372
2373 List<com.liferay.portlet.asset.model.AssetEntry> assetEntries = null;
2374
2375 if ((listeners.length > 0) || (assetEntryListeners.length > 0)) {
2376 assetEntries = getAssetEntries(tagId);
2377
2378 for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
2379 for (ModelListener<AssetTag> listener : listeners) {
2380 listener.onBeforeRemoveAssociation(tagId,
2381 com.liferay.portlet.asset.model.AssetEntry.class.getName(),
2382 assetEntry.getPrimaryKey());
2383 }
2384
2385 for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
2386 listener.onBeforeRemoveAssociation(assetEntry.getPrimaryKey(),
2387 AssetTag.class.getName(), tagId);
2388 }
2389 }
2390 }
2391
2392 _sqlUpdate.update(new Object[] { new Long(tagId) });
2393
2394 if ((listeners.length > 0) || (assetEntryListeners.length > 0)) {
2395 for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
2396 for (ModelListener<AssetTag> listener : listeners) {
2397 listener.onAfterRemoveAssociation(tagId,
2398 com.liferay.portlet.asset.model.AssetEntry.class.getName(),
2399 assetEntry.getPrimaryKey());
2400 }
2401
2402 for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
2403 listener.onAfterRemoveAssociation(assetEntry.getPrimaryKey(),
2404 AssetTag.class.getName(), tagId);
2405 }
2406 }
2407 }
2408 }
2409
2410 private SqlUpdate _sqlUpdate;
2411 }
2412
2413 protected class RemoveAssetEntry {
2414 protected RemoveAssetEntry() {
2415 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2416 "DELETE FROM AssetEntries_AssetTags WHERE tagId = ? AND entryId = ?",
2417 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2418 }
2419
2420 protected void remove(long tagId, long entryId)
2421 throws SystemException {
2422 if (containsAssetEntry.contains(tagId, entryId)) {
2423 ModelListener<com.liferay.portlet.asset.model.AssetEntry>[] assetEntryListeners =
2424 assetEntryPersistence.getListeners();
2425
2426 for (ModelListener<AssetTag> listener : listeners) {
2427 listener.onBeforeRemoveAssociation(tagId,
2428 com.liferay.portlet.asset.model.AssetEntry.class.getName(),
2429 entryId);
2430 }
2431
2432 for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
2433 listener.onBeforeRemoveAssociation(entryId,
2434 AssetTag.class.getName(), tagId);
2435 }
2436
2437 _sqlUpdate.update(new Object[] {
2438 new Long(tagId), new Long(entryId)
2439 });
2440
2441 for (ModelListener<AssetTag> listener : listeners) {
2442 listener.onAfterRemoveAssociation(tagId,
2443 com.liferay.portlet.asset.model.AssetEntry.class.getName(),
2444 entryId);
2445 }
2446
2447 for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
2448 listener.onAfterRemoveAssociation(entryId,
2449 AssetTag.class.getName(), tagId);
2450 }
2451 }
2452 }
2453
2454 private SqlUpdate _sqlUpdate;
2455 }
2456
2457 private static final String _SQL_SELECT_ASSETTAG = "SELECT assetTag FROM AssetTag assetTag";
2458 private static final String _SQL_SELECT_ASSETTAG_WHERE = "SELECT assetTag FROM AssetTag assetTag WHERE ";
2459 private static final String _SQL_COUNT_ASSETTAG = "SELECT COUNT(assetTag) FROM AssetTag assetTag";
2460 private static final String _SQL_COUNT_ASSETTAG_WHERE = "SELECT COUNT(assetTag) FROM AssetTag assetTag WHERE ";
2461 private static final String _SQL_GETASSETENTRIES = "SELECT {AssetEntry.*} FROM AssetEntry INNER JOIN AssetEntries_AssetTags ON (AssetEntries_AssetTags.entryId = AssetEntry.entryId) WHERE (AssetEntries_AssetTags.tagId = ?)";
2462 private static final String _SQL_GETASSETENTRIESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetTags WHERE tagId = ?";
2463 private static final String _SQL_CONTAINSASSETENTRY = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetTags WHERE tagId = ? AND entryId = ?";
2464 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "assetTag.groupId = ?";
2465 private static final String _FINDER_COLUMN_G_N_GROUPID_2 = "assetTag.groupId = ? AND ";
2466 private static final String _FINDER_COLUMN_G_N_NAME_1 = "assetTag.name IS NULL";
2467 private static final String _FINDER_COLUMN_G_N_NAME_2 = "assetTag.name = ?";
2468 private static final String _FINDER_COLUMN_G_N_NAME_3 = "(assetTag.name IS NULL OR assetTag.name = ?)";
2469 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "assetTag.tagId";
2470 private static final String _FILTER_SQL_SELECT_ASSETTAG_WHERE = "SELECT DISTINCT {assetTag.*} FROM AssetTag assetTag WHERE ";
2471 private static final String _FILTER_SQL_SELECT_ASSETTAG_NO_INLINE_DISTINCT_WHERE_1 =
2472 "SELECT {AssetTag.*} FROM (SELECT DISTINCT assetTag.tagId FROM AssetTag assetTag WHERE ";
2473 private static final String _FILTER_SQL_SELECT_ASSETTAG_NO_INLINE_DISTINCT_WHERE_2 =
2474 ") TEMP_TABLE INNER JOIN AssetTag ON TEMP_TABLE.tagId = AssetTag.tagId";
2475 private static final String _FILTER_SQL_COUNT_ASSETTAG_WHERE = "SELECT COUNT(DISTINCT assetTag.tagId) AS COUNT_VALUE FROM AssetTag assetTag WHERE ";
2476 private static final String _FILTER_ENTITY_ALIAS = "assetTag";
2477 private static final String _FILTER_ENTITY_TABLE = "AssetTag";
2478 private static final String _ORDER_BY_ENTITY_ALIAS = "assetTag.";
2479 private static final String _ORDER_BY_ENTITY_TABLE = "AssetTag.";
2480 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetTag exists with the primary key ";
2481 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetTag exists with the key {";
2482 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2483 private static Log _log = LogFactoryUtil.getLog(AssetTagPersistenceImpl.class);
2484 private static AssetTag _nullAssetTag = new AssetTagImpl() {
2485 @Override
2486 public Object clone() {
2487 return this;
2488 }
2489
2490 @Override
2491 public CacheModel<AssetTag> toCacheModel() {
2492 return _nullAssetTagCacheModel;
2493 }
2494 };
2495
2496 private static CacheModel<AssetTag> _nullAssetTagCacheModel = new CacheModel<AssetTag>() {
2497 public AssetTag toEntityModel() {
2498 return _nullAssetTag;
2499 }
2500 };
2501 }