1
22
23 package com.liferay.portlet.expando.service.persistence;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.annotation.BeanReference;
27 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
28 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
29 import com.liferay.portal.kernel.dao.orm.Query;
30 import com.liferay.portal.kernel.dao.orm.QueryPos;
31 import com.liferay.portal.kernel.dao.orm.QueryUtil;
32 import com.liferay.portal.kernel.dao.orm.Session;
33 import com.liferay.portal.kernel.log.Log;
34 import com.liferay.portal.kernel.log.LogFactoryUtil;
35 import com.liferay.portal.kernel.util.GetterUtil;
36 import com.liferay.portal.kernel.util.OrderByComparator;
37 import com.liferay.portal.kernel.util.StringPool;
38 import com.liferay.portal.kernel.util.StringUtil;
39 import com.liferay.portal.model.ModelListener;
40 import com.liferay.portal.service.persistence.BatchSessionUtil;
41 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42
43 import com.liferay.portlet.expando.NoSuchColumnException;
44 import com.liferay.portlet.expando.model.ExpandoColumn;
45 import com.liferay.portlet.expando.model.impl.ExpandoColumnImpl;
46 import com.liferay.portlet.expando.model.impl.ExpandoColumnModelImpl;
47
48 import java.util.ArrayList;
49 import java.util.Collections;
50 import java.util.Iterator;
51 import java.util.List;
52
53
59 public class ExpandoColumnPersistenceImpl extends BasePersistenceImpl
60 implements ExpandoColumnPersistence {
61 public ExpandoColumn create(long columnId) {
62 ExpandoColumn expandoColumn = new ExpandoColumnImpl();
63
64 expandoColumn.setNew(true);
65 expandoColumn.setPrimaryKey(columnId);
66
67 return expandoColumn;
68 }
69
70 public ExpandoColumn remove(long columnId)
71 throws NoSuchColumnException, SystemException {
72 Session session = null;
73
74 try {
75 session = openSession();
76
77 ExpandoColumn expandoColumn = (ExpandoColumn)session.get(ExpandoColumnImpl.class,
78 new Long(columnId));
79
80 if (expandoColumn == null) {
81 if (_log.isWarnEnabled()) {
82 _log.warn("No ExpandoColumn exists with the primary key " +
83 columnId);
84 }
85
86 throw new NoSuchColumnException(
87 "No ExpandoColumn exists with the primary key " + columnId);
88 }
89
90 return remove(expandoColumn);
91 }
92 catch (NoSuchColumnException nsee) {
93 throw nsee;
94 }
95 catch (Exception e) {
96 throw processException(e);
97 }
98 finally {
99 closeSession(session);
100 }
101 }
102
103 public ExpandoColumn remove(ExpandoColumn expandoColumn)
104 throws SystemException {
105 for (ModelListener listener : listeners) {
106 listener.onBeforeRemove(expandoColumn);
107 }
108
109 expandoColumn = removeImpl(expandoColumn);
110
111 for (ModelListener listener : listeners) {
112 listener.onAfterRemove(expandoColumn);
113 }
114
115 return expandoColumn;
116 }
117
118 protected ExpandoColumn removeImpl(ExpandoColumn expandoColumn)
119 throws SystemException {
120 Session session = null;
121
122 try {
123 session = openSession();
124
125 if (BatchSessionUtil.isEnabled()) {
126 Object staleObject = session.get(ExpandoColumnImpl.class,
127 expandoColumn.getPrimaryKeyObj());
128
129 if (staleObject != null) {
130 session.evict(staleObject);
131 }
132 }
133
134 session.delete(expandoColumn);
135
136 session.flush();
137
138 return expandoColumn;
139 }
140 catch (Exception e) {
141 throw processException(e);
142 }
143 finally {
144 closeSession(session);
145
146 FinderCacheUtil.clearCache(ExpandoColumn.class.getName());
147 }
148 }
149
150
153 public ExpandoColumn update(ExpandoColumn expandoColumn)
154 throws SystemException {
155 if (_log.isWarnEnabled()) {
156 _log.warn(
157 "Using the deprecated update(ExpandoColumn expandoColumn) method. Use update(ExpandoColumn expandoColumn, boolean merge) instead.");
158 }
159
160 return update(expandoColumn, false);
161 }
162
163
176 public ExpandoColumn update(ExpandoColumn expandoColumn, boolean merge)
177 throws SystemException {
178 boolean isNew = expandoColumn.isNew();
179
180 for (ModelListener listener : listeners) {
181 if (isNew) {
182 listener.onBeforeCreate(expandoColumn);
183 }
184 else {
185 listener.onBeforeUpdate(expandoColumn);
186 }
187 }
188
189 expandoColumn = updateImpl(expandoColumn, merge);
190
191 for (ModelListener listener : listeners) {
192 if (isNew) {
193 listener.onAfterCreate(expandoColumn);
194 }
195 else {
196 listener.onAfterUpdate(expandoColumn);
197 }
198 }
199
200 return expandoColumn;
201 }
202
203 public ExpandoColumn updateImpl(
204 com.liferay.portlet.expando.model.ExpandoColumn expandoColumn,
205 boolean merge) throws SystemException {
206 Session session = null;
207
208 try {
209 session = openSession();
210
211 BatchSessionUtil.update(session, expandoColumn, merge);
212
213 expandoColumn.setNew(false);
214
215 return expandoColumn;
216 }
217 catch (Exception e) {
218 throw processException(e);
219 }
220 finally {
221 closeSession(session);
222
223 FinderCacheUtil.clearCache(ExpandoColumn.class.getName());
224 }
225 }
226
227 public ExpandoColumn findByPrimaryKey(long columnId)
228 throws NoSuchColumnException, SystemException {
229 ExpandoColumn expandoColumn = fetchByPrimaryKey(columnId);
230
231 if (expandoColumn == null) {
232 if (_log.isWarnEnabled()) {
233 _log.warn("No ExpandoColumn exists with the primary key " +
234 columnId);
235 }
236
237 throw new NoSuchColumnException(
238 "No ExpandoColumn exists with the primary key " + columnId);
239 }
240
241 return expandoColumn;
242 }
243
244 public ExpandoColumn fetchByPrimaryKey(long columnId)
245 throws SystemException {
246 Session session = null;
247
248 try {
249 session = openSession();
250
251 return (ExpandoColumn)session.get(ExpandoColumnImpl.class,
252 new Long(columnId));
253 }
254 catch (Exception e) {
255 throw processException(e);
256 }
257 finally {
258 closeSession(session);
259 }
260 }
261
262 public List<ExpandoColumn> findByTableId(long tableId)
263 throws SystemException {
264 boolean finderClassNameCacheEnabled = ExpandoColumnModelImpl.CACHE_ENABLED;
265 String finderClassName = ExpandoColumn.class.getName();
266 String finderMethodName = "findByTableId";
267 String[] finderParams = new String[] { Long.class.getName() };
268 Object[] finderArgs = new Object[] { new Long(tableId) };
269
270 Object result = null;
271
272 if (finderClassNameCacheEnabled) {
273 result = FinderCacheUtil.getResult(finderClassName,
274 finderMethodName, finderParams, finderArgs, this);
275 }
276
277 if (result == null) {
278 Session session = null;
279
280 try {
281 session = openSession();
282
283 StringBuilder query = new StringBuilder();
284
285 query.append(
286 "FROM com.liferay.portlet.expando.model.ExpandoColumn WHERE ");
287
288 query.append("tableId = ?");
289
290 query.append(" ");
291
292 query.append("ORDER BY ");
293
294 query.append("name ASC");
295
296 Query q = session.createQuery(query.toString());
297
298 QueryPos qPos = QueryPos.getInstance(q);
299
300 qPos.add(tableId);
301
302 List<ExpandoColumn> list = q.list();
303
304 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
305 finderClassName, finderMethodName, finderParams,
306 finderArgs, list);
307
308 return list;
309 }
310 catch (Exception e) {
311 throw processException(e);
312 }
313 finally {
314 closeSession(session);
315 }
316 }
317 else {
318 return (List<ExpandoColumn>)result;
319 }
320 }
321
322 public List<ExpandoColumn> findByTableId(long tableId, int start, int end)
323 throws SystemException {
324 return findByTableId(tableId, start, end, null);
325 }
326
327 public List<ExpandoColumn> findByTableId(long tableId, int start, int end,
328 OrderByComparator obc) throws SystemException {
329 boolean finderClassNameCacheEnabled = ExpandoColumnModelImpl.CACHE_ENABLED;
330 String finderClassName = ExpandoColumn.class.getName();
331 String finderMethodName = "findByTableId";
332 String[] finderParams = new String[] {
333 Long.class.getName(),
334
335 "java.lang.Integer", "java.lang.Integer",
336 "com.liferay.portal.kernel.util.OrderByComparator"
337 };
338 Object[] finderArgs = new Object[] {
339 new Long(tableId),
340
341 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
342 };
343
344 Object result = null;
345
346 if (finderClassNameCacheEnabled) {
347 result = FinderCacheUtil.getResult(finderClassName,
348 finderMethodName, finderParams, finderArgs, this);
349 }
350
351 if (result == null) {
352 Session session = null;
353
354 try {
355 session = openSession();
356
357 StringBuilder query = new StringBuilder();
358
359 query.append(
360 "FROM com.liferay.portlet.expando.model.ExpandoColumn WHERE ");
361
362 query.append("tableId = ?");
363
364 query.append(" ");
365
366 if (obc != null) {
367 query.append("ORDER BY ");
368 query.append(obc.getOrderBy());
369 }
370
371 else {
372 query.append("ORDER BY ");
373
374 query.append("name ASC");
375 }
376
377 Query q = session.createQuery(query.toString());
378
379 QueryPos qPos = QueryPos.getInstance(q);
380
381 qPos.add(tableId);
382
383 List<ExpandoColumn> list = (List<ExpandoColumn>)QueryUtil.list(q,
384 getDialect(), start, end);
385
386 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
387 finderClassName, finderMethodName, finderParams,
388 finderArgs, list);
389
390 return list;
391 }
392 catch (Exception e) {
393 throw processException(e);
394 }
395 finally {
396 closeSession(session);
397 }
398 }
399 else {
400 return (List<ExpandoColumn>)result;
401 }
402 }
403
404 public ExpandoColumn findByTableId_First(long tableId, OrderByComparator obc)
405 throws NoSuchColumnException, SystemException {
406 List<ExpandoColumn> list = findByTableId(tableId, 0, 1, obc);
407
408 if (list.size() == 0) {
409 StringBuilder msg = new StringBuilder();
410
411 msg.append("No ExpandoColumn exists with the key {");
412
413 msg.append("tableId=" + tableId);
414
415 msg.append(StringPool.CLOSE_CURLY_BRACE);
416
417 throw new NoSuchColumnException(msg.toString());
418 }
419 else {
420 return list.get(0);
421 }
422 }
423
424 public ExpandoColumn findByTableId_Last(long tableId, OrderByComparator obc)
425 throws NoSuchColumnException, SystemException {
426 int count = countByTableId(tableId);
427
428 List<ExpandoColumn> list = findByTableId(tableId, count - 1, count, obc);
429
430 if (list.size() == 0) {
431 StringBuilder msg = new StringBuilder();
432
433 msg.append("No ExpandoColumn exists with the key {");
434
435 msg.append("tableId=" + tableId);
436
437 msg.append(StringPool.CLOSE_CURLY_BRACE);
438
439 throw new NoSuchColumnException(msg.toString());
440 }
441 else {
442 return list.get(0);
443 }
444 }
445
446 public ExpandoColumn[] findByTableId_PrevAndNext(long columnId,
447 long tableId, OrderByComparator obc)
448 throws NoSuchColumnException, SystemException {
449 ExpandoColumn expandoColumn = findByPrimaryKey(columnId);
450
451 int count = countByTableId(tableId);
452
453 Session session = null;
454
455 try {
456 session = openSession();
457
458 StringBuilder query = new StringBuilder();
459
460 query.append(
461 "FROM com.liferay.portlet.expando.model.ExpandoColumn WHERE ");
462
463 query.append("tableId = ?");
464
465 query.append(" ");
466
467 if (obc != null) {
468 query.append("ORDER BY ");
469 query.append(obc.getOrderBy());
470 }
471
472 else {
473 query.append("ORDER BY ");
474
475 query.append("name ASC");
476 }
477
478 Query q = session.createQuery(query.toString());
479
480 QueryPos qPos = QueryPos.getInstance(q);
481
482 qPos.add(tableId);
483
484 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
485 expandoColumn);
486
487 ExpandoColumn[] array = new ExpandoColumnImpl[3];
488
489 array[0] = (ExpandoColumn)objArray[0];
490 array[1] = (ExpandoColumn)objArray[1];
491 array[2] = (ExpandoColumn)objArray[2];
492
493 return array;
494 }
495 catch (Exception e) {
496 throw processException(e);
497 }
498 finally {
499 closeSession(session);
500 }
501 }
502
503 public ExpandoColumn findByT_N(long tableId, String name)
504 throws NoSuchColumnException, SystemException {
505 ExpandoColumn expandoColumn = fetchByT_N(tableId, name);
506
507 if (expandoColumn == null) {
508 StringBuilder msg = new StringBuilder();
509
510 msg.append("No ExpandoColumn exists with the key {");
511
512 msg.append("tableId=" + tableId);
513
514 msg.append(", ");
515 msg.append("name=" + name);
516
517 msg.append(StringPool.CLOSE_CURLY_BRACE);
518
519 if (_log.isWarnEnabled()) {
520 _log.warn(msg.toString());
521 }
522
523 throw new NoSuchColumnException(msg.toString());
524 }
525
526 return expandoColumn;
527 }
528
529 public ExpandoColumn fetchByT_N(long tableId, String name)
530 throws SystemException {
531 boolean finderClassNameCacheEnabled = ExpandoColumnModelImpl.CACHE_ENABLED;
532 String finderClassName = ExpandoColumn.class.getName();
533 String finderMethodName = "fetchByT_N";
534 String[] finderParams = new String[] {
535 Long.class.getName(), String.class.getName()
536 };
537 Object[] finderArgs = new Object[] { new Long(tableId), name };
538
539 Object result = null;
540
541 if (finderClassNameCacheEnabled) {
542 result = FinderCacheUtil.getResult(finderClassName,
543 finderMethodName, finderParams, finderArgs, this);
544 }
545
546 if (result == null) {
547 Session session = null;
548
549 try {
550 session = openSession();
551
552 StringBuilder query = new StringBuilder();
553
554 query.append(
555 "FROM com.liferay.portlet.expando.model.ExpandoColumn WHERE ");
556
557 query.append("tableId = ?");
558
559 query.append(" AND ");
560
561 if (name == null) {
562 query.append("name IS NULL");
563 }
564 else {
565 query.append("name = ?");
566 }
567
568 query.append(" ");
569
570 query.append("ORDER BY ");
571
572 query.append("name ASC");
573
574 Query q = session.createQuery(query.toString());
575
576 QueryPos qPos = QueryPos.getInstance(q);
577
578 qPos.add(tableId);
579
580 if (name != null) {
581 qPos.add(name);
582 }
583
584 List<ExpandoColumn> list = q.list();
585
586 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
587 finderClassName, finderMethodName, finderParams,
588 finderArgs, list);
589
590 if (list.size() == 0) {
591 return null;
592 }
593 else {
594 return list.get(0);
595 }
596 }
597 catch (Exception e) {
598 throw processException(e);
599 }
600 finally {
601 closeSession(session);
602 }
603 }
604 else {
605 List<ExpandoColumn> list = (List<ExpandoColumn>)result;
606
607 if (list.size() == 0) {
608 return null;
609 }
610 else {
611 return list.get(0);
612 }
613 }
614 }
615
616 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
617 throws SystemException {
618 Session session = null;
619
620 try {
621 session = openSession();
622
623 dynamicQuery.compile(session);
624
625 return dynamicQuery.list();
626 }
627 catch (Exception e) {
628 throw processException(e);
629 }
630 finally {
631 closeSession(session);
632 }
633 }
634
635 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
636 int start, int end) throws SystemException {
637 Session session = null;
638
639 try {
640 session = openSession();
641
642 dynamicQuery.setLimit(start, end);
643
644 dynamicQuery.compile(session);
645
646 return dynamicQuery.list();
647 }
648 catch (Exception e) {
649 throw processException(e);
650 }
651 finally {
652 closeSession(session);
653 }
654 }
655
656 public List<ExpandoColumn> findAll() throws SystemException {
657 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
658 }
659
660 public List<ExpandoColumn> findAll(int start, int end)
661 throws SystemException {
662 return findAll(start, end, null);
663 }
664
665 public List<ExpandoColumn> findAll(int start, int end, OrderByComparator obc)
666 throws SystemException {
667 boolean finderClassNameCacheEnabled = ExpandoColumnModelImpl.CACHE_ENABLED;
668 String finderClassName = ExpandoColumn.class.getName();
669 String finderMethodName = "findAll";
670 String[] finderParams = new String[] {
671 "java.lang.Integer", "java.lang.Integer",
672 "com.liferay.portal.kernel.util.OrderByComparator"
673 };
674 Object[] finderArgs = new Object[] {
675 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
676 };
677
678 Object result = null;
679
680 if (finderClassNameCacheEnabled) {
681 result = FinderCacheUtil.getResult(finderClassName,
682 finderMethodName, finderParams, finderArgs, this);
683 }
684
685 if (result == null) {
686 Session session = null;
687
688 try {
689 session = openSession();
690
691 StringBuilder query = new StringBuilder();
692
693 query.append(
694 "FROM com.liferay.portlet.expando.model.ExpandoColumn ");
695
696 if (obc != null) {
697 query.append("ORDER BY ");
698 query.append(obc.getOrderBy());
699 }
700
701 else {
702 query.append("ORDER BY ");
703
704 query.append("name ASC");
705 }
706
707 Query q = session.createQuery(query.toString());
708
709 List<ExpandoColumn> list = null;
710
711 if (obc == null) {
712 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
713 start, end, false);
714
715 Collections.sort(list);
716 }
717 else {
718 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
719 start, end);
720 }
721
722 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
723 finderClassName, finderMethodName, finderParams,
724 finderArgs, list);
725
726 return list;
727 }
728 catch (Exception e) {
729 throw processException(e);
730 }
731 finally {
732 closeSession(session);
733 }
734 }
735 else {
736 return (List<ExpandoColumn>)result;
737 }
738 }
739
740 public void removeByTableId(long tableId) throws SystemException {
741 for (ExpandoColumn expandoColumn : findByTableId(tableId)) {
742 remove(expandoColumn);
743 }
744 }
745
746 public void removeByT_N(long tableId, String name)
747 throws NoSuchColumnException, SystemException {
748 ExpandoColumn expandoColumn = findByT_N(tableId, name);
749
750 remove(expandoColumn);
751 }
752
753 public void removeAll() throws SystemException {
754 for (ExpandoColumn expandoColumn : findAll()) {
755 remove(expandoColumn);
756 }
757 }
758
759 public int countByTableId(long tableId) throws SystemException {
760 boolean finderClassNameCacheEnabled = ExpandoColumnModelImpl.CACHE_ENABLED;
761 String finderClassName = ExpandoColumn.class.getName();
762 String finderMethodName = "countByTableId";
763 String[] finderParams = new String[] { Long.class.getName() };
764 Object[] finderArgs = new Object[] { new Long(tableId) };
765
766 Object result = null;
767
768 if (finderClassNameCacheEnabled) {
769 result = FinderCacheUtil.getResult(finderClassName,
770 finderMethodName, finderParams, finderArgs, this);
771 }
772
773 if (result == null) {
774 Session session = null;
775
776 try {
777 session = openSession();
778
779 StringBuilder query = new StringBuilder();
780
781 query.append("SELECT COUNT(*) ");
782 query.append(
783 "FROM com.liferay.portlet.expando.model.ExpandoColumn WHERE ");
784
785 query.append("tableId = ?");
786
787 query.append(" ");
788
789 Query q = session.createQuery(query.toString());
790
791 QueryPos qPos = QueryPos.getInstance(q);
792
793 qPos.add(tableId);
794
795 Long count = null;
796
797 Iterator<Long> itr = q.list().iterator();
798
799 if (itr.hasNext()) {
800 count = itr.next();
801 }
802
803 if (count == null) {
804 count = new Long(0);
805 }
806
807 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
808 finderClassName, finderMethodName, finderParams,
809 finderArgs, count);
810
811 return count.intValue();
812 }
813 catch (Exception e) {
814 throw processException(e);
815 }
816 finally {
817 closeSession(session);
818 }
819 }
820 else {
821 return ((Long)result).intValue();
822 }
823 }
824
825 public int countByT_N(long tableId, String name) throws SystemException {
826 boolean finderClassNameCacheEnabled = ExpandoColumnModelImpl.CACHE_ENABLED;
827 String finderClassName = ExpandoColumn.class.getName();
828 String finderMethodName = "countByT_N";
829 String[] finderParams = new String[] {
830 Long.class.getName(), String.class.getName()
831 };
832 Object[] finderArgs = new Object[] { new Long(tableId), name };
833
834 Object result = null;
835
836 if (finderClassNameCacheEnabled) {
837 result = FinderCacheUtil.getResult(finderClassName,
838 finderMethodName, finderParams, finderArgs, this);
839 }
840
841 if (result == null) {
842 Session session = null;
843
844 try {
845 session = openSession();
846
847 StringBuilder query = new StringBuilder();
848
849 query.append("SELECT COUNT(*) ");
850 query.append(
851 "FROM com.liferay.portlet.expando.model.ExpandoColumn WHERE ");
852
853 query.append("tableId = ?");
854
855 query.append(" AND ");
856
857 if (name == null) {
858 query.append("name IS NULL");
859 }
860 else {
861 query.append("name = ?");
862 }
863
864 query.append(" ");
865
866 Query q = session.createQuery(query.toString());
867
868 QueryPos qPos = QueryPos.getInstance(q);
869
870 qPos.add(tableId);
871
872 if (name != null) {
873 qPos.add(name);
874 }
875
876 Long count = null;
877
878 Iterator<Long> itr = q.list().iterator();
879
880 if (itr.hasNext()) {
881 count = itr.next();
882 }
883
884 if (count == null) {
885 count = new Long(0);
886 }
887
888 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
889 finderClassName, finderMethodName, finderParams,
890 finderArgs, count);
891
892 return count.intValue();
893 }
894 catch (Exception e) {
895 throw processException(e);
896 }
897 finally {
898 closeSession(session);
899 }
900 }
901 else {
902 return ((Long)result).intValue();
903 }
904 }
905
906 public int countAll() throws SystemException {
907 boolean finderClassNameCacheEnabled = ExpandoColumnModelImpl.CACHE_ENABLED;
908 String finderClassName = ExpandoColumn.class.getName();
909 String finderMethodName = "countAll";
910 String[] finderParams = new String[] { };
911 Object[] finderArgs = new Object[] { };
912
913 Object result = null;
914
915 if (finderClassNameCacheEnabled) {
916 result = FinderCacheUtil.getResult(finderClassName,
917 finderMethodName, finderParams, finderArgs, this);
918 }
919
920 if (result == null) {
921 Session session = null;
922
923 try {
924 session = openSession();
925
926 Query q = session.createQuery(
927 "SELECT COUNT(*) FROM com.liferay.portlet.expando.model.ExpandoColumn");
928
929 Long count = null;
930
931 Iterator<Long> itr = q.list().iterator();
932
933 if (itr.hasNext()) {
934 count = itr.next();
935 }
936
937 if (count == null) {
938 count = new Long(0);
939 }
940
941 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
942 finderClassName, finderMethodName, finderParams,
943 finderArgs, count);
944
945 return count.intValue();
946 }
947 catch (Exception e) {
948 throw processException(e);
949 }
950 finally {
951 closeSession(session);
952 }
953 }
954 else {
955 return ((Long)result).intValue();
956 }
957 }
958
959 public void afterPropertiesSet() {
960 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
961 com.liferay.portal.util.PropsUtil.get(
962 "value.object.listener.com.liferay.portlet.expando.model.ExpandoColumn")));
963
964 if (listenerClassNames.length > 0) {
965 try {
966 List<ModelListener> listenersList = new ArrayList<ModelListener>();
967
968 for (String listenerClassName : listenerClassNames) {
969 listenersList.add((ModelListener)Class.forName(
970 listenerClassName).newInstance());
971 }
972
973 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
974 }
975 catch (Exception e) {
976 _log.error(e);
977 }
978 }
979 }
980
981 @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence.impl")
982 protected com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence expandoColumnPersistence;
983 @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence.impl")
984 protected com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence expandoRowPersistence;
985 @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence.impl")
986 protected com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence expandoTablePersistence;
987 @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence.impl")
988 protected com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence expandoValuePersistence;
989 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
990 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
991 private static Log _log = LogFactoryUtil.getLog(ExpandoColumnPersistenceImpl.class);
992 }