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