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