1
22
23 package com.liferay.portlet.tags.service.persistence;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.annotation.BeanReference;
27 import com.liferay.portal.kernel.cache.CacheRegistry;
28 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
29 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
30 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
31 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
32 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
33 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
34 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
35 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
36 import com.liferay.portal.kernel.dao.orm.FinderPath;
37 import com.liferay.portal.kernel.dao.orm.Query;
38 import com.liferay.portal.kernel.dao.orm.QueryPos;
39 import com.liferay.portal.kernel.dao.orm.QueryUtil;
40 import com.liferay.portal.kernel.dao.orm.SQLQuery;
41 import com.liferay.portal.kernel.dao.orm.Session;
42 import com.liferay.portal.kernel.dao.orm.Type;
43 import com.liferay.portal.kernel.log.Log;
44 import com.liferay.portal.kernel.log.LogFactoryUtil;
45 import com.liferay.portal.kernel.util.GetterUtil;
46 import com.liferay.portal.kernel.util.OrderByComparator;
47 import com.liferay.portal.kernel.util.StringPool;
48 import com.liferay.portal.kernel.util.StringUtil;
49 import com.liferay.portal.model.ModelListener;
50 import com.liferay.portal.service.persistence.BatchSessionUtil;
51 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
52
53 import com.liferay.portlet.tags.NoSuchAssetException;
54 import com.liferay.portlet.tags.model.TagsAsset;
55 import com.liferay.portlet.tags.model.impl.TagsAssetImpl;
56 import com.liferay.portlet.tags.model.impl.TagsAssetModelImpl;
57
58 import java.sql.Types;
59
60 import java.util.ArrayList;
61 import java.util.Collections;
62 import java.util.List;
63
64
70 public class TagsAssetPersistenceImpl extends BasePersistenceImpl
71 implements TagsAssetPersistence {
72 public static final String FINDER_CLASS_NAME_ENTITY = TagsAssetImpl.class.getName();
73 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
74 ".List";
75 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
76 TagsAssetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
77 "findByCompanyId", new String[] { Long.class.getName() });
78 public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
79 TagsAssetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
80 "findByCompanyId",
81 new String[] {
82 Long.class.getName(),
83
84 "java.lang.Integer", "java.lang.Integer",
85 "com.liferay.portal.kernel.util.OrderByComparator"
86 });
87 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
88 TagsAssetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
89 "countByCompanyId", new String[] { Long.class.getName() });
90 public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
91 TagsAssetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
92 "fetchByC_C",
93 new String[] { Long.class.getName(), Long.class.getName() });
94 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
95 TagsAssetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96 "countByC_C",
97 new String[] { Long.class.getName(), Long.class.getName() });
98 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
99 TagsAssetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
100 "findAll", new String[0]);
101 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
102 TagsAssetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
103 "countAll", new String[0]);
104
105 public void cacheResult(TagsAsset tagsAsset) {
106 EntityCacheUtil.putResult(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
107 TagsAssetImpl.class, tagsAsset.getPrimaryKey(), tagsAsset);
108
109 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
110 new Object[] {
111 new Long(tagsAsset.getClassNameId()),
112 new Long(tagsAsset.getClassPK())
113 }, tagsAsset);
114 }
115
116 public void cacheResult(List<TagsAsset> tagsAssets) {
117 for (TagsAsset tagsAsset : tagsAssets) {
118 if (EntityCacheUtil.getResult(
119 TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
120 TagsAssetImpl.class, tagsAsset.getPrimaryKey(), this) == null) {
121 cacheResult(tagsAsset);
122 }
123 }
124 }
125
126 public void clearCache() {
127 CacheRegistry.clear(TagsAssetImpl.class.getName());
128 EntityCacheUtil.clearCache(TagsAssetImpl.class.getName());
129 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
130 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
131 }
132
133 public TagsAsset create(long assetId) {
134 TagsAsset tagsAsset = new TagsAssetImpl();
135
136 tagsAsset.setNew(true);
137 tagsAsset.setPrimaryKey(assetId);
138
139 return tagsAsset;
140 }
141
142 public TagsAsset remove(long assetId)
143 throws NoSuchAssetException, SystemException {
144 Session session = null;
145
146 try {
147 session = openSession();
148
149 TagsAsset tagsAsset = (TagsAsset)session.get(TagsAssetImpl.class,
150 new Long(assetId));
151
152 if (tagsAsset == null) {
153 if (_log.isWarnEnabled()) {
154 _log.warn("No TagsAsset exists with the primary key " +
155 assetId);
156 }
157
158 throw new NoSuchAssetException(
159 "No TagsAsset exists with the primary key " + assetId);
160 }
161
162 return remove(tagsAsset);
163 }
164 catch (NoSuchAssetException nsee) {
165 throw nsee;
166 }
167 catch (Exception e) {
168 throw processException(e);
169 }
170 finally {
171 closeSession(session);
172 }
173 }
174
175 public TagsAsset remove(TagsAsset tagsAsset) throws SystemException {
176 for (ModelListener<TagsAsset> listener : listeners) {
177 listener.onBeforeRemove(tagsAsset);
178 }
179
180 tagsAsset = removeImpl(tagsAsset);
181
182 for (ModelListener<TagsAsset> listener : listeners) {
183 listener.onAfterRemove(tagsAsset);
184 }
185
186 return tagsAsset;
187 }
188
189 protected TagsAsset removeImpl(TagsAsset tagsAsset)
190 throws SystemException {
191 try {
192 clearTagsEntries.clear(tagsAsset.getPrimaryKey());
193 }
194 catch (Exception e) {
195 throw processException(e);
196 }
197 finally {
198 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
199 }
200
201 Session session = null;
202
203 try {
204 session = openSession();
205
206 if (tagsAsset.isCachedModel() || BatchSessionUtil.isEnabled()) {
207 Object staleObject = session.get(TagsAssetImpl.class,
208 tagsAsset.getPrimaryKeyObj());
209
210 if (staleObject != null) {
211 session.evict(staleObject);
212 }
213 }
214
215 session.delete(tagsAsset);
216
217 session.flush();
218 }
219 catch (Exception e) {
220 throw processException(e);
221 }
222 finally {
223 closeSession(session);
224 }
225
226 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
227
228 TagsAssetModelImpl tagsAssetModelImpl = (TagsAssetModelImpl)tagsAsset;
229
230 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
231 new Object[] {
232 new Long(tagsAssetModelImpl.getOriginalClassNameId()),
233 new Long(tagsAssetModelImpl.getOriginalClassPK())
234 });
235
236 EntityCacheUtil.removeResult(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
237 TagsAssetImpl.class, tagsAsset.getPrimaryKey());
238
239 return tagsAsset;
240 }
241
242
245 public TagsAsset update(TagsAsset tagsAsset) throws SystemException {
246 if (_log.isWarnEnabled()) {
247 _log.warn(
248 "Using the deprecated update(TagsAsset tagsAsset) method. Use update(TagsAsset tagsAsset, boolean merge) instead.");
249 }
250
251 return update(tagsAsset, false);
252 }
253
254
267 public TagsAsset update(TagsAsset tagsAsset, boolean merge)
268 throws SystemException {
269 boolean isNew = tagsAsset.isNew();
270
271 for (ModelListener<TagsAsset> listener : listeners) {
272 if (isNew) {
273 listener.onBeforeCreate(tagsAsset);
274 }
275 else {
276 listener.onBeforeUpdate(tagsAsset);
277 }
278 }
279
280 tagsAsset = updateImpl(tagsAsset, merge);
281
282 for (ModelListener<TagsAsset> listener : listeners) {
283 if (isNew) {
284 listener.onAfterCreate(tagsAsset);
285 }
286 else {
287 listener.onAfterUpdate(tagsAsset);
288 }
289 }
290
291 return tagsAsset;
292 }
293
294 public TagsAsset updateImpl(
295 com.liferay.portlet.tags.model.TagsAsset tagsAsset, boolean merge)
296 throws SystemException {
297 boolean isNew = tagsAsset.isNew();
298
299 TagsAssetModelImpl tagsAssetModelImpl = (TagsAssetModelImpl)tagsAsset;
300
301 Session session = null;
302
303 try {
304 session = openSession();
305
306 BatchSessionUtil.update(session, tagsAsset, merge);
307
308 tagsAsset.setNew(false);
309 }
310 catch (Exception e) {
311 throw processException(e);
312 }
313 finally {
314 closeSession(session);
315 }
316
317 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
318
319 EntityCacheUtil.putResult(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
320 TagsAssetImpl.class, tagsAsset.getPrimaryKey(), tagsAsset);
321
322 if (!isNew &&
323 ((tagsAsset.getClassNameId() != tagsAssetModelImpl.getOriginalClassNameId()) ||
324 (tagsAsset.getClassPK() != tagsAssetModelImpl.getOriginalClassPK()))) {
325 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
326 new Object[] {
327 new Long(tagsAssetModelImpl.getOriginalClassNameId()),
328 new Long(tagsAssetModelImpl.getOriginalClassPK())
329 });
330 }
331
332 if (isNew ||
333 ((tagsAsset.getClassNameId() != tagsAssetModelImpl.getOriginalClassNameId()) ||
334 (tagsAsset.getClassPK() != tagsAssetModelImpl.getOriginalClassPK()))) {
335 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
336 new Object[] {
337 new Long(tagsAsset.getClassNameId()),
338 new Long(tagsAsset.getClassPK())
339 }, tagsAsset);
340 }
341
342 return tagsAsset;
343 }
344
345 public TagsAsset findByPrimaryKey(long assetId)
346 throws NoSuchAssetException, SystemException {
347 TagsAsset tagsAsset = fetchByPrimaryKey(assetId);
348
349 if (tagsAsset == null) {
350 if (_log.isWarnEnabled()) {
351 _log.warn("No TagsAsset exists with the primary key " +
352 assetId);
353 }
354
355 throw new NoSuchAssetException(
356 "No TagsAsset exists with the primary key " + assetId);
357 }
358
359 return tagsAsset;
360 }
361
362 public TagsAsset fetchByPrimaryKey(long assetId) throws SystemException {
363 TagsAsset tagsAsset = (TagsAsset)EntityCacheUtil.getResult(TagsAssetModelImpl.ENTITY_CACHE_ENABLED,
364 TagsAssetImpl.class, assetId, this);
365
366 if (tagsAsset == null) {
367 Session session = null;
368
369 try {
370 session = openSession();
371
372 tagsAsset = (TagsAsset)session.get(TagsAssetImpl.class,
373 new Long(assetId));
374 }
375 catch (Exception e) {
376 throw processException(e);
377 }
378 finally {
379 if (tagsAsset != null) {
380 cacheResult(tagsAsset);
381 }
382
383 closeSession(session);
384 }
385 }
386
387 return tagsAsset;
388 }
389
390 public List<TagsAsset> findByCompanyId(long companyId)
391 throws SystemException {
392 Object[] finderArgs = new Object[] { new Long(companyId) };
393
394 List<TagsAsset> list = (List<TagsAsset>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
395 finderArgs, this);
396
397 if (list == null) {
398 Session session = null;
399
400 try {
401 session = openSession();
402
403 StringBuilder query = new StringBuilder();
404
405 query.append("SELECT tagsAsset FROM TagsAsset tagsAsset WHERE ");
406
407 query.append("tagsAsset.companyId = ?");
408
409 query.append(" ");
410
411 Query q = session.createQuery(query.toString());
412
413 QueryPos qPos = QueryPos.getInstance(q);
414
415 qPos.add(companyId);
416
417 list = q.list();
418 }
419 catch (Exception e) {
420 throw processException(e);
421 }
422 finally {
423 if (list == null) {
424 list = new ArrayList<TagsAsset>();
425 }
426
427 cacheResult(list);
428
429 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
430 finderArgs, list);
431
432 closeSession(session);
433 }
434 }
435
436 return list;
437 }
438
439 public List<TagsAsset> findByCompanyId(long companyId, int start, int end)
440 throws SystemException {
441 return findByCompanyId(companyId, start, end, null);
442 }
443
444 public List<TagsAsset> findByCompanyId(long companyId, int start, int end,
445 OrderByComparator obc) throws SystemException {
446 Object[] finderArgs = new Object[] {
447 new Long(companyId),
448
449 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
450 };
451
452 List<TagsAsset> list = (List<TagsAsset>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
453 finderArgs, this);
454
455 if (list == null) {
456 Session session = null;
457
458 try {
459 session = openSession();
460
461 StringBuilder query = new StringBuilder();
462
463 query.append("SELECT tagsAsset FROM TagsAsset tagsAsset WHERE ");
464
465 query.append("tagsAsset.companyId = ?");
466
467 query.append(" ");
468
469 if (obc != null) {
470 query.append("ORDER BY ");
471
472 String[] orderByFields = obc.getOrderByFields();
473
474 for (int i = 0; i < orderByFields.length; i++) {
475 query.append("tagsAsset.");
476 query.append(orderByFields[i]);
477
478 if (obc.isAscending()) {
479 query.append(" ASC");
480 }
481 else {
482 query.append(" DESC");
483 }
484
485 if ((i + 1) < orderByFields.length) {
486 query.append(", ");
487 }
488 }
489 }
490
491 Query q = session.createQuery(query.toString());
492
493 QueryPos qPos = QueryPos.getInstance(q);
494
495 qPos.add(companyId);
496
497 list = (List<TagsAsset>)QueryUtil.list(q, getDialect(), start,
498 end);
499 }
500 catch (Exception e) {
501 throw processException(e);
502 }
503 finally {
504 if (list == null) {
505 list = new ArrayList<TagsAsset>();
506 }
507
508 cacheResult(list);
509
510 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
511 finderArgs, list);
512
513 closeSession(session);
514 }
515 }
516
517 return list;
518 }
519
520 public TagsAsset findByCompanyId_First(long companyId, OrderByComparator obc)
521 throws NoSuchAssetException, SystemException {
522 List<TagsAsset> list = findByCompanyId(companyId, 0, 1, obc);
523
524 if (list.isEmpty()) {
525 StringBuilder msg = new StringBuilder();
526
527 msg.append("No TagsAsset exists with the key {");
528
529 msg.append("companyId=" + companyId);
530
531 msg.append(StringPool.CLOSE_CURLY_BRACE);
532
533 throw new NoSuchAssetException(msg.toString());
534 }
535 else {
536 return list.get(0);
537 }
538 }
539
540 public TagsAsset findByCompanyId_Last(long companyId, OrderByComparator obc)
541 throws NoSuchAssetException, SystemException {
542 int count = countByCompanyId(companyId);
543
544 List<TagsAsset> list = findByCompanyId(companyId, count - 1, count, obc);
545
546 if (list.isEmpty()) {
547 StringBuilder msg = new StringBuilder();
548
549 msg.append("No TagsAsset exists with the key {");
550
551 msg.append("companyId=" + companyId);
552
553 msg.append(StringPool.CLOSE_CURLY_BRACE);
554
555 throw new NoSuchAssetException(msg.toString());
556 }
557 else {
558 return list.get(0);
559 }
560 }
561
562 public TagsAsset[] findByCompanyId_PrevAndNext(long assetId,
563 long companyId, OrderByComparator obc)
564 throws NoSuchAssetException, SystemException {
565 TagsAsset tagsAsset = findByPrimaryKey(assetId);
566
567 int count = countByCompanyId(companyId);
568
569 Session session = null;
570
571 try {
572 session = openSession();
573
574 StringBuilder query = new StringBuilder();
575
576 query.append("SELECT tagsAsset FROM TagsAsset tagsAsset WHERE ");
577
578 query.append("tagsAsset.companyId = ?");
579
580 query.append(" ");
581
582 if (obc != null) {
583 query.append("ORDER BY ");
584
585 String[] orderByFields = obc.getOrderByFields();
586
587 for (int i = 0; i < orderByFields.length; i++) {
588 query.append("tagsAsset.");
589 query.append(orderByFields[i]);
590
591 if (obc.isAscending()) {
592 query.append(" ASC");
593 }
594 else {
595 query.append(" DESC");
596 }
597
598 if ((i + 1) < orderByFields.length) {
599 query.append(", ");
600 }
601 }
602 }
603
604 Query q = session.createQuery(query.toString());
605
606 QueryPos qPos = QueryPos.getInstance(q);
607
608 qPos.add(companyId);
609
610 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
611 tagsAsset);
612
613 TagsAsset[] array = new TagsAssetImpl[3];
614
615 array[0] = (TagsAsset)objArray[0];
616 array[1] = (TagsAsset)objArray[1];
617 array[2] = (TagsAsset)objArray[2];
618
619 return array;
620 }
621 catch (Exception e) {
622 throw processException(e);
623 }
624 finally {
625 closeSession(session);
626 }
627 }
628
629 public TagsAsset findByC_C(long classNameId, long classPK)
630 throws NoSuchAssetException, SystemException {
631 TagsAsset tagsAsset = fetchByC_C(classNameId, classPK);
632
633 if (tagsAsset == null) {
634 StringBuilder msg = new StringBuilder();
635
636 msg.append("No TagsAsset exists with the key {");
637
638 msg.append("classNameId=" + classNameId);
639
640 msg.append(", ");
641 msg.append("classPK=" + classPK);
642
643 msg.append(StringPool.CLOSE_CURLY_BRACE);
644
645 if (_log.isWarnEnabled()) {
646 _log.warn(msg.toString());
647 }
648
649 throw new NoSuchAssetException(msg.toString());
650 }
651
652 return tagsAsset;
653 }
654
655 public TagsAsset fetchByC_C(long classNameId, long classPK)
656 throws SystemException {
657 return fetchByC_C(classNameId, classPK, true);
658 }
659
660 public TagsAsset fetchByC_C(long classNameId, long classPK,
661 boolean retrieveFromCache) throws SystemException {
662 Object[] finderArgs = new Object[] {
663 new Long(classNameId), new Long(classPK)
664 };
665
666 Object result = null;
667
668 if (retrieveFromCache) {
669 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
670 finderArgs, this);
671 }
672
673 if (result == null) {
674 Session session = null;
675
676 try {
677 session = openSession();
678
679 StringBuilder query = new StringBuilder();
680
681 query.append("SELECT tagsAsset FROM TagsAsset tagsAsset WHERE ");
682
683 query.append("tagsAsset.classNameId = ?");
684
685 query.append(" AND ");
686
687 query.append("tagsAsset.classPK = ?");
688
689 query.append(" ");
690
691 Query q = session.createQuery(query.toString());
692
693 QueryPos qPos = QueryPos.getInstance(q);
694
695 qPos.add(classNameId);
696
697 qPos.add(classPK);
698
699 List<TagsAsset> list = q.list();
700
701 result = list;
702
703 TagsAsset tagsAsset = null;
704
705 if (list.isEmpty()) {
706 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
707 finderArgs, list);
708 }
709 else {
710 tagsAsset = list.get(0);
711
712 cacheResult(tagsAsset);
713
714 if ((tagsAsset.getClassNameId() != classNameId) ||
715 (tagsAsset.getClassPK() != classPK)) {
716 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
717 finderArgs, tagsAsset);
718 }
719 }
720
721 return tagsAsset;
722 }
723 catch (Exception e) {
724 throw processException(e);
725 }
726 finally {
727 if (result == null) {
728 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
729 finderArgs, new ArrayList<TagsAsset>());
730 }
731
732 closeSession(session);
733 }
734 }
735 else {
736 if (result instanceof List) {
737 return null;
738 }
739 else {
740 return (TagsAsset)result;
741 }
742 }
743 }
744
745 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
746 throws SystemException {
747 Session session = null;
748
749 try {
750 session = openSession();
751
752 dynamicQuery.compile(session);
753
754 return dynamicQuery.list();
755 }
756 catch (Exception e) {
757 throw processException(e);
758 }
759 finally {
760 closeSession(session);
761 }
762 }
763
764 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
765 int start, int end) throws SystemException {
766 Session session = null;
767
768 try {
769 session = openSession();
770
771 dynamicQuery.setLimit(start, end);
772
773 dynamicQuery.compile(session);
774
775 return dynamicQuery.list();
776 }
777 catch (Exception e) {
778 throw processException(e);
779 }
780 finally {
781 closeSession(session);
782 }
783 }
784
785 public List<TagsAsset> findAll() throws SystemException {
786 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
787 }
788
789 public List<TagsAsset> findAll(int start, int end)
790 throws SystemException {
791 return findAll(start, end, null);
792 }
793
794 public List<TagsAsset> findAll(int start, int end, OrderByComparator obc)
795 throws SystemException {
796 Object[] finderArgs = new Object[] {
797 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
798 };
799
800 List<TagsAsset> list = (List<TagsAsset>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
801 finderArgs, this);
802
803 if (list == null) {
804 Session session = null;
805
806 try {
807 session = openSession();
808
809 StringBuilder query = new StringBuilder();
810
811 query.append("SELECT tagsAsset FROM TagsAsset tagsAsset ");
812
813 if (obc != null) {
814 query.append("ORDER BY ");
815
816 String[] orderByFields = obc.getOrderByFields();
817
818 for (int i = 0; i < orderByFields.length; i++) {
819 query.append("tagsAsset.");
820 query.append(orderByFields[i]);
821
822 if (obc.isAscending()) {
823 query.append(" ASC");
824 }
825 else {
826 query.append(" DESC");
827 }
828
829 if ((i + 1) < orderByFields.length) {
830 query.append(", ");
831 }
832 }
833 }
834
835 Query q = session.createQuery(query.toString());
836
837 if (obc == null) {
838 list = (List<TagsAsset>)QueryUtil.list(q, getDialect(),
839 start, end, false);
840
841 Collections.sort(list);
842 }
843 else {
844 list = (List<TagsAsset>)QueryUtil.list(q, getDialect(),
845 start, end);
846 }
847 }
848 catch (Exception e) {
849 throw processException(e);
850 }
851 finally {
852 if (list == null) {
853 list = new ArrayList<TagsAsset>();
854 }
855
856 cacheResult(list);
857
858 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
859
860 closeSession(session);
861 }
862 }
863
864 return list;
865 }
866
867 public void removeByCompanyId(long companyId) throws SystemException {
868 for (TagsAsset tagsAsset : findByCompanyId(companyId)) {
869 remove(tagsAsset);
870 }
871 }
872
873 public void removeByC_C(long classNameId, long classPK)
874 throws NoSuchAssetException, SystemException {
875 TagsAsset tagsAsset = findByC_C(classNameId, classPK);
876
877 remove(tagsAsset);
878 }
879
880 public void removeAll() throws SystemException {
881 for (TagsAsset tagsAsset : findAll()) {
882 remove(tagsAsset);
883 }
884 }
885
886 public int countByCompanyId(long companyId) throws SystemException {
887 Object[] finderArgs = new Object[] { new Long(companyId) };
888
889 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
890 finderArgs, this);
891
892 if (count == null) {
893 Session session = null;
894
895 try {
896 session = openSession();
897
898 StringBuilder query = new StringBuilder();
899
900 query.append("SELECT COUNT(tagsAsset) ");
901 query.append("FROM TagsAsset tagsAsset WHERE ");
902
903 query.append("tagsAsset.companyId = ?");
904
905 query.append(" ");
906
907 Query q = session.createQuery(query.toString());
908
909 QueryPos qPos = QueryPos.getInstance(q);
910
911 qPos.add(companyId);
912
913 count = (Long)q.uniqueResult();
914 }
915 catch (Exception e) {
916 throw processException(e);
917 }
918 finally {
919 if (count == null) {
920 count = Long.valueOf(0);
921 }
922
923 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
924 finderArgs, count);
925
926 closeSession(session);
927 }
928 }
929
930 return count.intValue();
931 }
932
933 public int countByC_C(long classNameId, long classPK)
934 throws SystemException {
935 Object[] finderArgs = new Object[] {
936 new Long(classNameId), new Long(classPK)
937 };
938
939 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
940 finderArgs, this);
941
942 if (count == null) {
943 Session session = null;
944
945 try {
946 session = openSession();
947
948 StringBuilder query = new StringBuilder();
949
950 query.append("SELECT COUNT(tagsAsset) ");
951 query.append("FROM TagsAsset tagsAsset WHERE ");
952
953 query.append("tagsAsset.classNameId = ?");
954
955 query.append(" AND ");
956
957 query.append("tagsAsset.classPK = ?");
958
959 query.append(" ");
960
961 Query q = session.createQuery(query.toString());
962
963 QueryPos qPos = QueryPos.getInstance(q);
964
965 qPos.add(classNameId);
966
967 qPos.add(classPK);
968
969 count = (Long)q.uniqueResult();
970 }
971 catch (Exception e) {
972 throw processException(e);
973 }
974 finally {
975 if (count == null) {
976 count = Long.valueOf(0);
977 }
978
979 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
980 count);
981
982 closeSession(session);
983 }
984 }
985
986 return count.intValue();
987 }
988
989 public int countAll() throws SystemException {
990 Object[] finderArgs = new Object[0];
991
992 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
993 finderArgs, this);
994
995 if (count == null) {
996 Session session = null;
997
998 try {
999 session = openSession();
1000
1001 Query q = session.createQuery(
1002 "SELECT COUNT(tagsAsset) FROM TagsAsset tagsAsset");
1003
1004 count = (Long)q.uniqueResult();
1005 }
1006 catch (Exception e) {
1007 throw processException(e);
1008 }
1009 finally {
1010 if (count == null) {
1011 count = Long.valueOf(0);
1012 }
1013
1014 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1015 count);
1016
1017 closeSession(session);
1018 }
1019 }
1020
1021 return count.intValue();
1022 }
1023
1024 public List<com.liferay.portlet.tags.model.TagsEntry> getTagsEntries(
1025 long pk) throws SystemException {
1026 return getTagsEntries(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1027 }
1028
1029 public List<com.liferay.portlet.tags.model.TagsEntry> getTagsEntries(
1030 long pk, int start, int end) throws SystemException {
1031 return getTagsEntries(pk, start, end, null);
1032 }
1033
1034 public static final FinderPath FINDER_PATH_GET_TAGSENTRIES = new FinderPath(com.liferay.portlet.tags.model.impl.TagsEntryModelImpl.ENTITY_CACHE_ENABLED,
1035 TagsAssetModelImpl.FINDER_CACHE_ENABLED_TAGSASSETS_TAGSENTRIES,
1036 "TagsAssets_TagsEntries", "getTagsEntries",
1037 new String[] {
1038 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1039 "com.liferay.portal.kernel.util.OrderByComparator"
1040 });
1041
1042 public List<com.liferay.portlet.tags.model.TagsEntry> getTagsEntries(
1043 long pk, int start, int end, OrderByComparator obc)
1044 throws SystemException {
1045 Object[] finderArgs = new Object[] {
1046 new Long(pk), String.valueOf(start), String.valueOf(end),
1047 String.valueOf(obc)
1048 };
1049
1050 List<com.liferay.portlet.tags.model.TagsEntry> list = (List<com.liferay.portlet.tags.model.TagsEntry>)FinderCacheUtil.getResult(FINDER_PATH_GET_TAGSENTRIES,
1051 finderArgs, this);
1052
1053 if (list == null) {
1054 Session session = null;
1055
1056 try {
1057 session = openSession();
1058
1059 StringBuilder sb = new StringBuilder();
1060
1061 sb.append(_SQL_GETTAGSENTRIES);
1062
1063 if (obc != null) {
1064 sb.append("ORDER BY ");
1065 sb.append(obc.getOrderBy());
1066 }
1067
1068 else {
1069 sb.append("ORDER BY ");
1070
1071 sb.append("TagsEntry.name ASC");
1072 }
1073
1074 String sql = sb.toString();
1075
1076 SQLQuery q = session.createSQLQuery(sql);
1077
1078 q.addEntity("TagsEntry",
1079 com.liferay.portlet.tags.model.impl.TagsEntryImpl.class);
1080
1081 QueryPos qPos = QueryPos.getInstance(q);
1082
1083 qPos.add(pk);
1084
1085 list = (List<com.liferay.portlet.tags.model.TagsEntry>)QueryUtil.list(q,
1086 getDialect(), start, end);
1087 }
1088 catch (Exception e) {
1089 throw processException(e);
1090 }
1091 finally {
1092 if (list == null) {
1093 list = new ArrayList<com.liferay.portlet.tags.model.TagsEntry>();
1094 }
1095
1096 tagsEntryPersistence.cacheResult(list);
1097
1098 FinderCacheUtil.putResult(FINDER_PATH_GET_TAGSENTRIES,
1099 finderArgs, list);
1100
1101 closeSession(session);
1102 }
1103 }
1104
1105 return list;
1106 }
1107
1108 public static final FinderPath FINDER_PATH_GET_TAGSENTRIES_SIZE = new FinderPath(com.liferay.portlet.tags.model.impl.TagsEntryModelImpl.ENTITY_CACHE_ENABLED,
1109 TagsAssetModelImpl.FINDER_CACHE_ENABLED_TAGSASSETS_TAGSENTRIES,
1110 "TagsAssets_TagsEntries", "getTagsEntriesSize",
1111 new String[] { Long.class.getName() });
1112
1113 public int getTagsEntriesSize(long pk) throws SystemException {
1114 Object[] finderArgs = new Object[] { new Long(pk) };
1115
1116 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_TAGSENTRIES_SIZE,
1117 finderArgs, this);
1118
1119 if (count == null) {
1120 Session session = null;
1121
1122 try {
1123 session = openSession();
1124
1125 SQLQuery q = session.createSQLQuery(_SQL_GETTAGSENTRIESSIZE);
1126
1127 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1128
1129 QueryPos qPos = QueryPos.getInstance(q);
1130
1131 qPos.add(pk);
1132
1133 count = (Long)q.uniqueResult();
1134 }
1135 catch (Exception e) {
1136 throw processException(e);
1137 }
1138 finally {
1139 if (count == null) {
1140 count = Long.valueOf(0);
1141 }
1142
1143 FinderCacheUtil.putResult(FINDER_PATH_GET_TAGSENTRIES_SIZE,
1144 finderArgs, count);
1145
1146 closeSession(session);
1147 }
1148 }
1149
1150 return count.intValue();
1151 }
1152
1153 public static final FinderPath FINDER_PATH_CONTAINS_TAGSENTRY = new FinderPath(com.liferay.portlet.tags.model.impl.TagsEntryModelImpl.ENTITY_CACHE_ENABLED,
1154 TagsAssetModelImpl.FINDER_CACHE_ENABLED_TAGSASSETS_TAGSENTRIES,
1155 "TagsAssets_TagsEntries", "containsTagsEntry",
1156 new String[] { Long.class.getName(), Long.class.getName() });
1157
1158 public boolean containsTagsEntry(long pk, long tagsEntryPK)
1159 throws SystemException {
1160 Object[] finderArgs = new Object[] { new Long(pk), new Long(tagsEntryPK) };
1161
1162 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_TAGSENTRY,
1163 finderArgs, this);
1164
1165 if (value == null) {
1166 try {
1167 value = Boolean.valueOf(containsTagsEntry.contains(pk,
1168 tagsEntryPK));
1169 }
1170 catch (Exception e) {
1171 throw processException(e);
1172 }
1173 finally {
1174 if (value == null) {
1175 value = Boolean.FALSE;
1176 }
1177
1178 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_TAGSENTRY,
1179 finderArgs, value);
1180 }
1181 }
1182
1183 return value.booleanValue();
1184 }
1185
1186 public boolean containsTagsEntries(long pk) throws SystemException {
1187 if (getTagsEntriesSize(pk) > 0) {
1188 return true;
1189 }
1190 else {
1191 return false;
1192 }
1193 }
1194
1195 public void addTagsEntry(long pk, long tagsEntryPK)
1196 throws SystemException {
1197 try {
1198 addTagsEntry.add(pk, tagsEntryPK);
1199 }
1200 catch (Exception e) {
1201 throw processException(e);
1202 }
1203 finally {
1204 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1205 }
1206 }
1207
1208 public void addTagsEntry(long pk,
1209 com.liferay.portlet.tags.model.TagsEntry tagsEntry)
1210 throws SystemException {
1211 try {
1212 addTagsEntry.add(pk, tagsEntry.getPrimaryKey());
1213 }
1214 catch (Exception e) {
1215 throw processException(e);
1216 }
1217 finally {
1218 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1219 }
1220 }
1221
1222 public void addTagsEntries(long pk, long[] tagsEntryPKs)
1223 throws SystemException {
1224 try {
1225 for (long tagsEntryPK : tagsEntryPKs) {
1226 addTagsEntry.add(pk, tagsEntryPK);
1227 }
1228 }
1229 catch (Exception e) {
1230 throw processException(e);
1231 }
1232 finally {
1233 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1234 }
1235 }
1236
1237 public void addTagsEntries(long pk,
1238 List<com.liferay.portlet.tags.model.TagsEntry> tagsEntries)
1239 throws SystemException {
1240 try {
1241 for (com.liferay.portlet.tags.model.TagsEntry tagsEntry : tagsEntries) {
1242 addTagsEntry.add(pk, tagsEntry.getPrimaryKey());
1243 }
1244 }
1245 catch (Exception e) {
1246 throw processException(e);
1247 }
1248 finally {
1249 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1250 }
1251 }
1252
1253 public void clearTagsEntries(long pk) throws SystemException {
1254 try {
1255 clearTagsEntries.clear(pk);
1256 }
1257 catch (Exception e) {
1258 throw processException(e);
1259 }
1260 finally {
1261 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1262 }
1263 }
1264
1265 public void removeTagsEntry(long pk, long tagsEntryPK)
1266 throws SystemException {
1267 try {
1268 removeTagsEntry.remove(pk, tagsEntryPK);
1269 }
1270 catch (Exception e) {
1271 throw processException(e);
1272 }
1273 finally {
1274 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1275 }
1276 }
1277
1278 public void removeTagsEntry(long pk,
1279 com.liferay.portlet.tags.model.TagsEntry tagsEntry)
1280 throws SystemException {
1281 try {
1282 removeTagsEntry.remove(pk, tagsEntry.getPrimaryKey());
1283 }
1284 catch (Exception e) {
1285 throw processException(e);
1286 }
1287 finally {
1288 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1289 }
1290 }
1291
1292 public void removeTagsEntries(long pk, long[] tagsEntryPKs)
1293 throws SystemException {
1294 try {
1295 for (long tagsEntryPK : tagsEntryPKs) {
1296 removeTagsEntry.remove(pk, tagsEntryPK);
1297 }
1298 }
1299 catch (Exception e) {
1300 throw processException(e);
1301 }
1302 finally {
1303 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1304 }
1305 }
1306
1307 public void removeTagsEntries(long pk,
1308 List<com.liferay.portlet.tags.model.TagsEntry> tagsEntries)
1309 throws SystemException {
1310 try {
1311 for (com.liferay.portlet.tags.model.TagsEntry tagsEntry : tagsEntries) {
1312 removeTagsEntry.remove(pk, tagsEntry.getPrimaryKey());
1313 }
1314 }
1315 catch (Exception e) {
1316 throw processException(e);
1317 }
1318 finally {
1319 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1320 }
1321 }
1322
1323 public void setTagsEntries(long pk, long[] tagsEntryPKs)
1324 throws SystemException {
1325 try {
1326 clearTagsEntries.clear(pk);
1327
1328 for (long tagsEntryPK : tagsEntryPKs) {
1329 addTagsEntry.add(pk, tagsEntryPK);
1330 }
1331 }
1332 catch (Exception e) {
1333 throw processException(e);
1334 }
1335 finally {
1336 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1337 }
1338 }
1339
1340 public void setTagsEntries(long pk,
1341 List<com.liferay.portlet.tags.model.TagsEntry> tagsEntries)
1342 throws SystemException {
1343 try {
1344 clearTagsEntries.clear(pk);
1345
1346 for (com.liferay.portlet.tags.model.TagsEntry tagsEntry : tagsEntries) {
1347 addTagsEntry.add(pk, tagsEntry.getPrimaryKey());
1348 }
1349 }
1350 catch (Exception e) {
1351 throw processException(e);
1352 }
1353 finally {
1354 FinderCacheUtil.clearCache("TagsAssets_TagsEntries");
1355 }
1356 }
1357
1358 public void afterPropertiesSet() {
1359 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1360 com.liferay.portal.util.PropsUtil.get(
1361 "value.object.listener.com.liferay.portlet.tags.model.TagsAsset")));
1362
1363 if (listenerClassNames.length > 0) {
1364 try {
1365 List<ModelListener<TagsAsset>> listenersList = new ArrayList<ModelListener<TagsAsset>>();
1366
1367 for (String listenerClassName : listenerClassNames) {
1368 listenersList.add((ModelListener<TagsAsset>)Class.forName(
1369 listenerClassName).newInstance());
1370 }
1371
1372 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1373 }
1374 catch (Exception e) {
1375 _log.error(e);
1376 }
1377 }
1378
1379 containsTagsEntry = new ContainsTagsEntry(this);
1380
1381 addTagsEntry = new AddTagsEntry(this);
1382 clearTagsEntries = new ClearTagsEntries(this);
1383 removeTagsEntry = new RemoveTagsEntry(this);
1384 }
1385
1386 @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsAssetPersistence.impl")
1387 protected com.liferay.portlet.tags.service.persistence.TagsAssetPersistence tagsAssetPersistence;
1388 @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsEntryPersistence.impl")
1389 protected com.liferay.portlet.tags.service.persistence.TagsEntryPersistence tagsEntryPersistence;
1390 @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsPropertyPersistence.impl")
1391 protected com.liferay.portlet.tags.service.persistence.TagsPropertyPersistence tagsPropertyPersistence;
1392 @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsSourcePersistence.impl")
1393 protected com.liferay.portlet.tags.service.persistence.TagsSourcePersistence tagsSourcePersistence;
1394 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
1395 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
1396 @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
1397 protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
1398 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
1399 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1400 @BeanReference(name = "com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence.impl")
1401 protected com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence blogsEntryPersistence;
1402 @BeanReference(name = "com.liferay.portlet.bookmarks.service.persistence.BookmarksEntryPersistence.impl")
1403 protected com.liferay.portlet.bookmarks.service.persistence.BookmarksEntryPersistence bookmarksEntryPersistence;
1404 @BeanReference(name = "com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistence.impl")
1405 protected com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistence dlFileEntryPersistence;
1406 @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticlePersistence.impl")
1407 protected com.liferay.portlet.journal.service.persistence.JournalArticlePersistence journalArticlePersistence;
1408 @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence.impl")
1409 protected com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence journalArticleResourcePersistence;
1410 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence.impl")
1411 protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
1412 @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiPagePersistence.impl")
1413 protected com.liferay.portlet.wiki.service.persistence.WikiPagePersistence wikiPagePersistence;
1414 @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence.impl")
1415 protected com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence wikiPageResourcePersistence;
1416 protected ContainsTagsEntry containsTagsEntry;
1417 protected AddTagsEntry addTagsEntry;
1418 protected ClearTagsEntries clearTagsEntries;
1419 protected RemoveTagsEntry removeTagsEntry;
1420
1421 protected class ContainsTagsEntry {
1422 protected ContainsTagsEntry(TagsAssetPersistenceImpl persistenceImpl) {
1423 super();
1424
1425 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
1426 _SQL_CONTAINSTAGSENTRY,
1427 new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
1428 }
1429
1430 protected boolean contains(long assetId, long entryId) {
1431 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
1432 new Long(assetId), new Long(entryId)
1433 });
1434
1435 if (results.size() > 0) {
1436 Integer count = results.get(0);
1437
1438 if (count.intValue() > 0) {
1439 return true;
1440 }
1441 }
1442
1443 return false;
1444 }
1445
1446 private MappingSqlQuery _mappingSqlQuery;
1447 }
1448
1449 protected class AddTagsEntry {
1450 protected AddTagsEntry(TagsAssetPersistenceImpl persistenceImpl) {
1451 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1452 "INSERT INTO TagsAssets_TagsEntries (assetId, entryId) VALUES (?, ?)",
1453 new int[] { Types.BIGINT, Types.BIGINT });
1454 _persistenceImpl = persistenceImpl;
1455 }
1456
1457 protected void add(long assetId, long entryId) {
1458 if (!_persistenceImpl.containsTagsEntry.contains(assetId, entryId)) {
1459 _sqlUpdate.update(new Object[] {
1460 new Long(assetId), new Long(entryId)
1461 });
1462 }
1463 }
1464
1465 private SqlUpdate _sqlUpdate;
1466 private TagsAssetPersistenceImpl _persistenceImpl;
1467 }
1468
1469 protected class ClearTagsEntries {
1470 protected ClearTagsEntries(TagsAssetPersistenceImpl persistenceImpl) {
1471 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1472 "DELETE FROM TagsAssets_TagsEntries WHERE assetId = ?",
1473 new int[] { Types.BIGINT });
1474 }
1475
1476 protected void clear(long assetId) {
1477 _sqlUpdate.update(new Object[] { new Long(assetId) });
1478 }
1479
1480 private SqlUpdate _sqlUpdate;
1481 }
1482
1483 protected class RemoveTagsEntry {
1484 protected RemoveTagsEntry(TagsAssetPersistenceImpl persistenceImpl) {
1485 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1486 "DELETE FROM TagsAssets_TagsEntries WHERE assetId = ? AND entryId = ?",
1487 new int[] { Types.BIGINT, Types.BIGINT });
1488 }
1489
1490 protected void remove(long assetId, long entryId) {
1491 _sqlUpdate.update(new Object[] { new Long(assetId), new Long(
1492 entryId) });
1493 }
1494
1495 private SqlUpdate _sqlUpdate;
1496 }
1497
1498 private static final String _SQL_GETTAGSENTRIES = "SELECT {TagsEntry.*} FROM TagsEntry INNER JOIN TagsAssets_TagsEntries ON (TagsAssets_TagsEntries.entryId = TagsEntry.entryId) WHERE (TagsAssets_TagsEntries.assetId = ?)";
1499 private static final String _SQL_GETTAGSENTRIESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM TagsAssets_TagsEntries WHERE assetId = ?";
1500 private static final String _SQL_CONTAINSTAGSENTRY = "SELECT COUNT(*) AS COUNT_VALUE FROM TagsAssets_TagsEntries WHERE assetId = ? AND entryId = ?";
1501 private static Log _log = LogFactoryUtil.getLog(TagsAssetPersistenceImpl.class);
1502}