1
22
23 package com.liferay.portlet.wiki.service.persistence;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.bean.InitializingBean;
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.util.GetterUtil;
34 import com.liferay.portal.kernel.util.ListUtil;
35 import com.liferay.portal.kernel.util.OrderByComparator;
36 import com.liferay.portal.kernel.util.StringPool;
37 import com.liferay.portal.kernel.util.StringUtil;
38 import com.liferay.portal.kernel.util.Validator;
39 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
40 import com.liferay.portal.model.ModelListener;
41 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42
43 import com.liferay.portlet.wiki.NoSuchNodeException;
44 import com.liferay.portlet.wiki.model.WikiNode;
45 import com.liferay.portlet.wiki.model.impl.WikiNodeImpl;
46 import com.liferay.portlet.wiki.model.impl.WikiNodeModelImpl;
47
48 import org.apache.commons.logging.Log;
49 import org.apache.commons.logging.LogFactory;
50
51 import java.util.ArrayList;
52 import java.util.Collections;
53 import java.util.Iterator;
54 import java.util.List;
55
56
62 public class WikiNodePersistenceImpl extends BasePersistenceImpl
63 implements WikiNodePersistence, InitializingBean {
64 public WikiNode create(long nodeId) {
65 WikiNode wikiNode = new WikiNodeImpl();
66
67 wikiNode.setNew(true);
68 wikiNode.setPrimaryKey(nodeId);
69
70 String uuid = PortalUUIDUtil.generate();
71
72 wikiNode.setUuid(uuid);
73
74 return wikiNode;
75 }
76
77 public WikiNode remove(long nodeId)
78 throws NoSuchNodeException, SystemException {
79 Session session = null;
80
81 try {
82 session = openSession();
83
84 WikiNode wikiNode = (WikiNode)session.get(WikiNodeImpl.class,
85 new Long(nodeId));
86
87 if (wikiNode == null) {
88 if (_log.isWarnEnabled()) {
89 _log.warn("No WikiNode exists with the primary key " +
90 nodeId);
91 }
92
93 throw new NoSuchNodeException(
94 "No WikiNode exists with the primary key " + nodeId);
95 }
96
97 return remove(wikiNode);
98 }
99 catch (NoSuchNodeException nsee) {
100 throw nsee;
101 }
102 catch (Exception e) {
103 throw processException(e);
104 }
105 finally {
106 closeSession(session);
107 }
108 }
109
110 public WikiNode remove(WikiNode wikiNode) throws SystemException {
111 if (_listeners.length > 0) {
112 for (ModelListener listener : _listeners) {
113 listener.onBeforeRemove(wikiNode);
114 }
115 }
116
117 wikiNode = removeImpl(wikiNode);
118
119 if (_listeners.length > 0) {
120 for (ModelListener listener : _listeners) {
121 listener.onAfterRemove(wikiNode);
122 }
123 }
124
125 return wikiNode;
126 }
127
128 protected WikiNode removeImpl(WikiNode wikiNode) throws SystemException {
129 Session session = null;
130
131 try {
132 session = openSession();
133
134 session.delete(wikiNode);
135
136 session.flush();
137
138 return wikiNode;
139 }
140 catch (Exception e) {
141 throw processException(e);
142 }
143 finally {
144 closeSession(session);
145
146 FinderCacheUtil.clearCache(WikiNode.class.getName());
147 }
148 }
149
150
153 public WikiNode update(WikiNode wikiNode) throws SystemException {
154 if (_log.isWarnEnabled()) {
155 _log.warn(
156 "Using the deprecated update(WikiNode wikiNode) method. Use update(WikiNode wikiNode, boolean merge) instead.");
157 }
158
159 return update(wikiNode, false);
160 }
161
162
175 public WikiNode update(WikiNode wikiNode, boolean merge)
176 throws SystemException {
177 boolean isNew = wikiNode.isNew();
178
179 if (_listeners.length > 0) {
180 for (ModelListener listener : _listeners) {
181 if (isNew) {
182 listener.onBeforeCreate(wikiNode);
183 }
184 else {
185 listener.onBeforeUpdate(wikiNode);
186 }
187 }
188 }
189
190 wikiNode = updateImpl(wikiNode, merge);
191
192 if (_listeners.length > 0) {
193 for (ModelListener listener : _listeners) {
194 if (isNew) {
195 listener.onAfterCreate(wikiNode);
196 }
197 else {
198 listener.onAfterUpdate(wikiNode);
199 }
200 }
201 }
202
203 return wikiNode;
204 }
205
206 public WikiNode updateImpl(
207 com.liferay.portlet.wiki.model.WikiNode wikiNode, boolean merge)
208 throws SystemException {
209 if (Validator.isNull(wikiNode.getUuid())) {
210 String uuid = PortalUUIDUtil.generate();
211
212 wikiNode.setUuid(uuid);
213 }
214
215 Session session = null;
216
217 try {
218 session = openSession();
219
220 if (merge) {
221 session.merge(wikiNode);
222 }
223 else {
224 if (wikiNode.isNew()) {
225 session.save(wikiNode);
226 }
227 }
228
229 session.flush();
230
231 wikiNode.setNew(false);
232
233 return wikiNode;
234 }
235 catch (Exception e) {
236 throw processException(e);
237 }
238 finally {
239 closeSession(session);
240
241 FinderCacheUtil.clearCache(WikiNode.class.getName());
242 }
243 }
244
245 public WikiNode findByPrimaryKey(long nodeId)
246 throws NoSuchNodeException, SystemException {
247 WikiNode wikiNode = fetchByPrimaryKey(nodeId);
248
249 if (wikiNode == null) {
250 if (_log.isWarnEnabled()) {
251 _log.warn("No WikiNode exists with the primary key " + nodeId);
252 }
253
254 throw new NoSuchNodeException(
255 "No WikiNode exists with the primary key " + nodeId);
256 }
257
258 return wikiNode;
259 }
260
261 public WikiNode fetchByPrimaryKey(long nodeId) throws SystemException {
262 Session session = null;
263
264 try {
265 session = openSession();
266
267 return (WikiNode)session.get(WikiNodeImpl.class, new Long(nodeId));
268 }
269 catch (Exception e) {
270 throw processException(e);
271 }
272 finally {
273 closeSession(session);
274 }
275 }
276
277 public List<WikiNode> findByUuid(String uuid) throws SystemException {
278 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
279 String finderClassName = WikiNode.class.getName();
280 String finderMethodName = "findByUuid";
281 String[] finderParams = new String[] { String.class.getName() };
282 Object[] finderArgs = new Object[] { uuid };
283
284 Object result = null;
285
286 if (finderClassNameCacheEnabled) {
287 result = FinderCacheUtil.getResult(finderClassName,
288 finderMethodName, finderParams, finderArgs, this);
289 }
290
291 if (result == null) {
292 Session session = null;
293
294 try {
295 session = openSession();
296
297 StringBuilder query = new StringBuilder();
298
299 query.append(
300 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
301
302 if (uuid == null) {
303 query.append("uuid_ IS NULL");
304 }
305 else {
306 query.append("uuid_ = ?");
307 }
308
309 query.append(" ");
310
311 query.append("ORDER BY ");
312
313 query.append("name ASC");
314
315 Query q = session.createQuery(query.toString());
316
317 QueryPos qPos = QueryPos.getInstance(q);
318
319 if (uuid != null) {
320 qPos.add(uuid);
321 }
322
323 List<WikiNode> list = q.list();
324
325 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
326 finderClassName, finderMethodName, finderParams,
327 finderArgs, list);
328
329 return list;
330 }
331 catch (Exception e) {
332 throw processException(e);
333 }
334 finally {
335 closeSession(session);
336 }
337 }
338 else {
339 return (List<WikiNode>)result;
340 }
341 }
342
343 public List<WikiNode> findByUuid(String uuid, int start, int end)
344 throws SystemException {
345 return findByUuid(uuid, start, end, null);
346 }
347
348 public List<WikiNode> findByUuid(String uuid, int start, int end,
349 OrderByComparator obc) throws SystemException {
350 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
351 String finderClassName = WikiNode.class.getName();
352 String finderMethodName = "findByUuid";
353 String[] finderParams = new String[] {
354 String.class.getName(),
355
356 "java.lang.Integer", "java.lang.Integer",
357 "com.liferay.portal.kernel.util.OrderByComparator"
358 };
359 Object[] finderArgs = new Object[] {
360 uuid,
361
362 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
363 };
364
365 Object result = null;
366
367 if (finderClassNameCacheEnabled) {
368 result = FinderCacheUtil.getResult(finderClassName,
369 finderMethodName, finderParams, finderArgs, this);
370 }
371
372 if (result == null) {
373 Session session = null;
374
375 try {
376 session = openSession();
377
378 StringBuilder query = new StringBuilder();
379
380 query.append(
381 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
382
383 if (uuid == null) {
384 query.append("uuid_ IS NULL");
385 }
386 else {
387 query.append("uuid_ = ?");
388 }
389
390 query.append(" ");
391
392 if (obc != null) {
393 query.append("ORDER BY ");
394 query.append(obc.getOrderBy());
395 }
396
397 else {
398 query.append("ORDER BY ");
399
400 query.append("name ASC");
401 }
402
403 Query q = session.createQuery(query.toString());
404
405 QueryPos qPos = QueryPos.getInstance(q);
406
407 if (uuid != null) {
408 qPos.add(uuid);
409 }
410
411 List<WikiNode> list = (List<WikiNode>)QueryUtil.list(q,
412 getDialect(), start, end);
413
414 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
415 finderClassName, finderMethodName, finderParams,
416 finderArgs, list);
417
418 return list;
419 }
420 catch (Exception e) {
421 throw processException(e);
422 }
423 finally {
424 closeSession(session);
425 }
426 }
427 else {
428 return (List<WikiNode>)result;
429 }
430 }
431
432 public WikiNode findByUuid_First(String uuid, OrderByComparator obc)
433 throws NoSuchNodeException, SystemException {
434 List<WikiNode> list = findByUuid(uuid, 0, 1, obc);
435
436 if (list.size() == 0) {
437 StringBuilder msg = new StringBuilder();
438
439 msg.append("No WikiNode exists with the key {");
440
441 msg.append("uuid=" + uuid);
442
443 msg.append(StringPool.CLOSE_CURLY_BRACE);
444
445 throw new NoSuchNodeException(msg.toString());
446 }
447 else {
448 return list.get(0);
449 }
450 }
451
452 public WikiNode findByUuid_Last(String uuid, OrderByComparator obc)
453 throws NoSuchNodeException, SystemException {
454 int count = countByUuid(uuid);
455
456 List<WikiNode> list = findByUuid(uuid, count - 1, count, obc);
457
458 if (list.size() == 0) {
459 StringBuilder msg = new StringBuilder();
460
461 msg.append("No WikiNode exists with the key {");
462
463 msg.append("uuid=" + uuid);
464
465 msg.append(StringPool.CLOSE_CURLY_BRACE);
466
467 throw new NoSuchNodeException(msg.toString());
468 }
469 else {
470 return list.get(0);
471 }
472 }
473
474 public WikiNode[] findByUuid_PrevAndNext(long nodeId, String uuid,
475 OrderByComparator obc) throws NoSuchNodeException, SystemException {
476 WikiNode wikiNode = findByPrimaryKey(nodeId);
477
478 int count = countByUuid(uuid);
479
480 Session session = null;
481
482 try {
483 session = openSession();
484
485 StringBuilder query = new StringBuilder();
486
487 query.append("FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
488
489 if (uuid == null) {
490 query.append("uuid_ IS NULL");
491 }
492 else {
493 query.append("uuid_ = ?");
494 }
495
496 query.append(" ");
497
498 if (obc != null) {
499 query.append("ORDER BY ");
500 query.append(obc.getOrderBy());
501 }
502
503 else {
504 query.append("ORDER BY ");
505
506 query.append("name ASC");
507 }
508
509 Query q = session.createQuery(query.toString());
510
511 QueryPos qPos = QueryPos.getInstance(q);
512
513 if (uuid != null) {
514 qPos.add(uuid);
515 }
516
517 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiNode);
518
519 WikiNode[] array = new WikiNodeImpl[3];
520
521 array[0] = (WikiNode)objArray[0];
522 array[1] = (WikiNode)objArray[1];
523 array[2] = (WikiNode)objArray[2];
524
525 return array;
526 }
527 catch (Exception e) {
528 throw processException(e);
529 }
530 finally {
531 closeSession(session);
532 }
533 }
534
535 public WikiNode findByUUID_G(String uuid, long groupId)
536 throws NoSuchNodeException, SystemException {
537 WikiNode wikiNode = fetchByUUID_G(uuid, groupId);
538
539 if (wikiNode == null) {
540 StringBuilder msg = new StringBuilder();
541
542 msg.append("No WikiNode exists with the key {");
543
544 msg.append("uuid=" + uuid);
545
546 msg.append(", ");
547 msg.append("groupId=" + groupId);
548
549 msg.append(StringPool.CLOSE_CURLY_BRACE);
550
551 if (_log.isWarnEnabled()) {
552 _log.warn(msg.toString());
553 }
554
555 throw new NoSuchNodeException(msg.toString());
556 }
557
558 return wikiNode;
559 }
560
561 public WikiNode fetchByUUID_G(String uuid, long groupId)
562 throws SystemException {
563 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
564 String finderClassName = WikiNode.class.getName();
565 String finderMethodName = "fetchByUUID_G";
566 String[] finderParams = new String[] {
567 String.class.getName(), Long.class.getName()
568 };
569 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
570
571 Object result = null;
572
573 if (finderClassNameCacheEnabled) {
574 result = FinderCacheUtil.getResult(finderClassName,
575 finderMethodName, finderParams, finderArgs, this);
576 }
577
578 if (result == null) {
579 Session session = null;
580
581 try {
582 session = openSession();
583
584 StringBuilder query = new StringBuilder();
585
586 query.append(
587 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
588
589 if (uuid == null) {
590 query.append("uuid_ IS NULL");
591 }
592 else {
593 query.append("uuid_ = ?");
594 }
595
596 query.append(" AND ");
597
598 query.append("groupId = ?");
599
600 query.append(" ");
601
602 query.append("ORDER BY ");
603
604 query.append("name ASC");
605
606 Query q = session.createQuery(query.toString());
607
608 QueryPos qPos = QueryPos.getInstance(q);
609
610 if (uuid != null) {
611 qPos.add(uuid);
612 }
613
614 qPos.add(groupId);
615
616 List<WikiNode> list = q.list();
617
618 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
619 finderClassName, finderMethodName, finderParams,
620 finderArgs, list);
621
622 if (list.size() == 0) {
623 return null;
624 }
625 else {
626 return list.get(0);
627 }
628 }
629 catch (Exception e) {
630 throw processException(e);
631 }
632 finally {
633 closeSession(session);
634 }
635 }
636 else {
637 List<WikiNode> list = (List<WikiNode>)result;
638
639 if (list.size() == 0) {
640 return null;
641 }
642 else {
643 return list.get(0);
644 }
645 }
646 }
647
648 public List<WikiNode> findByGroupId(long groupId) throws SystemException {
649 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
650 String finderClassName = WikiNode.class.getName();
651 String finderMethodName = "findByGroupId";
652 String[] finderParams = new String[] { Long.class.getName() };
653 Object[] finderArgs = new Object[] { new Long(groupId) };
654
655 Object result = null;
656
657 if (finderClassNameCacheEnabled) {
658 result = FinderCacheUtil.getResult(finderClassName,
659 finderMethodName, finderParams, finderArgs, this);
660 }
661
662 if (result == null) {
663 Session session = null;
664
665 try {
666 session = openSession();
667
668 StringBuilder query = new StringBuilder();
669
670 query.append(
671 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
672
673 query.append("groupId = ?");
674
675 query.append(" ");
676
677 query.append("ORDER BY ");
678
679 query.append("name ASC");
680
681 Query q = session.createQuery(query.toString());
682
683 QueryPos qPos = QueryPos.getInstance(q);
684
685 qPos.add(groupId);
686
687 List<WikiNode> list = q.list();
688
689 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
690 finderClassName, finderMethodName, finderParams,
691 finderArgs, list);
692
693 return list;
694 }
695 catch (Exception e) {
696 throw processException(e);
697 }
698 finally {
699 closeSession(session);
700 }
701 }
702 else {
703 return (List<WikiNode>)result;
704 }
705 }
706
707 public List<WikiNode> findByGroupId(long groupId, int start, int end)
708 throws SystemException {
709 return findByGroupId(groupId, start, end, null);
710 }
711
712 public List<WikiNode> findByGroupId(long groupId, int start, int end,
713 OrderByComparator obc) throws SystemException {
714 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
715 String finderClassName = WikiNode.class.getName();
716 String finderMethodName = "findByGroupId";
717 String[] finderParams = new String[] {
718 Long.class.getName(),
719
720 "java.lang.Integer", "java.lang.Integer",
721 "com.liferay.portal.kernel.util.OrderByComparator"
722 };
723 Object[] finderArgs = new Object[] {
724 new Long(groupId),
725
726 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
727 };
728
729 Object result = null;
730
731 if (finderClassNameCacheEnabled) {
732 result = FinderCacheUtil.getResult(finderClassName,
733 finderMethodName, finderParams, finderArgs, this);
734 }
735
736 if (result == null) {
737 Session session = null;
738
739 try {
740 session = openSession();
741
742 StringBuilder query = new StringBuilder();
743
744 query.append(
745 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
746
747 query.append("groupId = ?");
748
749 query.append(" ");
750
751 if (obc != null) {
752 query.append("ORDER BY ");
753 query.append(obc.getOrderBy());
754 }
755
756 else {
757 query.append("ORDER BY ");
758
759 query.append("name ASC");
760 }
761
762 Query q = session.createQuery(query.toString());
763
764 QueryPos qPos = QueryPos.getInstance(q);
765
766 qPos.add(groupId);
767
768 List<WikiNode> list = (List<WikiNode>)QueryUtil.list(q,
769 getDialect(), start, end);
770
771 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
772 finderClassName, finderMethodName, finderParams,
773 finderArgs, list);
774
775 return list;
776 }
777 catch (Exception e) {
778 throw processException(e);
779 }
780 finally {
781 closeSession(session);
782 }
783 }
784 else {
785 return (List<WikiNode>)result;
786 }
787 }
788
789 public WikiNode findByGroupId_First(long groupId, OrderByComparator obc)
790 throws NoSuchNodeException, SystemException {
791 List<WikiNode> list = findByGroupId(groupId, 0, 1, obc);
792
793 if (list.size() == 0) {
794 StringBuilder msg = new StringBuilder();
795
796 msg.append("No WikiNode exists with the key {");
797
798 msg.append("groupId=" + groupId);
799
800 msg.append(StringPool.CLOSE_CURLY_BRACE);
801
802 throw new NoSuchNodeException(msg.toString());
803 }
804 else {
805 return list.get(0);
806 }
807 }
808
809 public WikiNode findByGroupId_Last(long groupId, OrderByComparator obc)
810 throws NoSuchNodeException, SystemException {
811 int count = countByGroupId(groupId);
812
813 List<WikiNode> list = findByGroupId(groupId, count - 1, count, obc);
814
815 if (list.size() == 0) {
816 StringBuilder msg = new StringBuilder();
817
818 msg.append("No WikiNode exists with the key {");
819
820 msg.append("groupId=" + groupId);
821
822 msg.append(StringPool.CLOSE_CURLY_BRACE);
823
824 throw new NoSuchNodeException(msg.toString());
825 }
826 else {
827 return list.get(0);
828 }
829 }
830
831 public WikiNode[] findByGroupId_PrevAndNext(long nodeId, long groupId,
832 OrderByComparator obc) throws NoSuchNodeException, SystemException {
833 WikiNode wikiNode = findByPrimaryKey(nodeId);
834
835 int count = countByGroupId(groupId);
836
837 Session session = null;
838
839 try {
840 session = openSession();
841
842 StringBuilder query = new StringBuilder();
843
844 query.append("FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
845
846 query.append("groupId = ?");
847
848 query.append(" ");
849
850 if (obc != null) {
851 query.append("ORDER BY ");
852 query.append(obc.getOrderBy());
853 }
854
855 else {
856 query.append("ORDER BY ");
857
858 query.append("name ASC");
859 }
860
861 Query q = session.createQuery(query.toString());
862
863 QueryPos qPos = QueryPos.getInstance(q);
864
865 qPos.add(groupId);
866
867 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiNode);
868
869 WikiNode[] array = new WikiNodeImpl[3];
870
871 array[0] = (WikiNode)objArray[0];
872 array[1] = (WikiNode)objArray[1];
873 array[2] = (WikiNode)objArray[2];
874
875 return array;
876 }
877 catch (Exception e) {
878 throw processException(e);
879 }
880 finally {
881 closeSession(session);
882 }
883 }
884
885 public List<WikiNode> findByCompanyId(long companyId)
886 throws SystemException {
887 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
888 String finderClassName = WikiNode.class.getName();
889 String finderMethodName = "findByCompanyId";
890 String[] finderParams = new String[] { Long.class.getName() };
891 Object[] finderArgs = new Object[] { new Long(companyId) };
892
893 Object result = null;
894
895 if (finderClassNameCacheEnabled) {
896 result = FinderCacheUtil.getResult(finderClassName,
897 finderMethodName, finderParams, finderArgs, this);
898 }
899
900 if (result == null) {
901 Session session = null;
902
903 try {
904 session = openSession();
905
906 StringBuilder query = new StringBuilder();
907
908 query.append(
909 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
910
911 query.append("companyId = ?");
912
913 query.append(" ");
914
915 query.append("ORDER BY ");
916
917 query.append("name ASC");
918
919 Query q = session.createQuery(query.toString());
920
921 QueryPos qPos = QueryPos.getInstance(q);
922
923 qPos.add(companyId);
924
925 List<WikiNode> list = q.list();
926
927 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
928 finderClassName, finderMethodName, finderParams,
929 finderArgs, list);
930
931 return list;
932 }
933 catch (Exception e) {
934 throw processException(e);
935 }
936 finally {
937 closeSession(session);
938 }
939 }
940 else {
941 return (List<WikiNode>)result;
942 }
943 }
944
945 public List<WikiNode> findByCompanyId(long companyId, int start, int end)
946 throws SystemException {
947 return findByCompanyId(companyId, start, end, null);
948 }
949
950 public List<WikiNode> findByCompanyId(long companyId, int start, int end,
951 OrderByComparator obc) throws SystemException {
952 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
953 String finderClassName = WikiNode.class.getName();
954 String finderMethodName = "findByCompanyId";
955 String[] finderParams = new String[] {
956 Long.class.getName(),
957
958 "java.lang.Integer", "java.lang.Integer",
959 "com.liferay.portal.kernel.util.OrderByComparator"
960 };
961 Object[] finderArgs = new Object[] {
962 new Long(companyId),
963
964 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
965 };
966
967 Object result = null;
968
969 if (finderClassNameCacheEnabled) {
970 result = FinderCacheUtil.getResult(finderClassName,
971 finderMethodName, finderParams, finderArgs, this);
972 }
973
974 if (result == null) {
975 Session session = null;
976
977 try {
978 session = openSession();
979
980 StringBuilder query = new StringBuilder();
981
982 query.append(
983 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
984
985 query.append("companyId = ?");
986
987 query.append(" ");
988
989 if (obc != null) {
990 query.append("ORDER BY ");
991 query.append(obc.getOrderBy());
992 }
993
994 else {
995 query.append("ORDER BY ");
996
997 query.append("name ASC");
998 }
999
1000 Query q = session.createQuery(query.toString());
1001
1002 QueryPos qPos = QueryPos.getInstance(q);
1003
1004 qPos.add(companyId);
1005
1006 List<WikiNode> list = (List<WikiNode>)QueryUtil.list(q,
1007 getDialect(), start, end);
1008
1009 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1010 finderClassName, finderMethodName, finderParams,
1011 finderArgs, list);
1012
1013 return list;
1014 }
1015 catch (Exception e) {
1016 throw processException(e);
1017 }
1018 finally {
1019 closeSession(session);
1020 }
1021 }
1022 else {
1023 return (List<WikiNode>)result;
1024 }
1025 }
1026
1027 public WikiNode findByCompanyId_First(long companyId, OrderByComparator obc)
1028 throws NoSuchNodeException, SystemException {
1029 List<WikiNode> list = findByCompanyId(companyId, 0, 1, obc);
1030
1031 if (list.size() == 0) {
1032 StringBuilder msg = new StringBuilder();
1033
1034 msg.append("No WikiNode exists with the key {");
1035
1036 msg.append("companyId=" + companyId);
1037
1038 msg.append(StringPool.CLOSE_CURLY_BRACE);
1039
1040 throw new NoSuchNodeException(msg.toString());
1041 }
1042 else {
1043 return list.get(0);
1044 }
1045 }
1046
1047 public WikiNode findByCompanyId_Last(long companyId, OrderByComparator obc)
1048 throws NoSuchNodeException, SystemException {
1049 int count = countByCompanyId(companyId);
1050
1051 List<WikiNode> list = findByCompanyId(companyId, count - 1, count, obc);
1052
1053 if (list.size() == 0) {
1054 StringBuilder msg = new StringBuilder();
1055
1056 msg.append("No WikiNode exists with the key {");
1057
1058 msg.append("companyId=" + companyId);
1059
1060 msg.append(StringPool.CLOSE_CURLY_BRACE);
1061
1062 throw new NoSuchNodeException(msg.toString());
1063 }
1064 else {
1065 return list.get(0);
1066 }
1067 }
1068
1069 public WikiNode[] findByCompanyId_PrevAndNext(long nodeId, long companyId,
1070 OrderByComparator obc) throws NoSuchNodeException, SystemException {
1071 WikiNode wikiNode = findByPrimaryKey(nodeId);
1072
1073 int count = countByCompanyId(companyId);
1074
1075 Session session = null;
1076
1077 try {
1078 session = openSession();
1079
1080 StringBuilder query = new StringBuilder();
1081
1082 query.append("FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
1083
1084 query.append("companyId = ?");
1085
1086 query.append(" ");
1087
1088 if (obc != null) {
1089 query.append("ORDER BY ");
1090 query.append(obc.getOrderBy());
1091 }
1092
1093 else {
1094 query.append("ORDER BY ");
1095
1096 query.append("name ASC");
1097 }
1098
1099 Query q = session.createQuery(query.toString());
1100
1101 QueryPos qPos = QueryPos.getInstance(q);
1102
1103 qPos.add(companyId);
1104
1105 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiNode);
1106
1107 WikiNode[] array = new WikiNodeImpl[3];
1108
1109 array[0] = (WikiNode)objArray[0];
1110 array[1] = (WikiNode)objArray[1];
1111 array[2] = (WikiNode)objArray[2];
1112
1113 return array;
1114 }
1115 catch (Exception e) {
1116 throw processException(e);
1117 }
1118 finally {
1119 closeSession(session);
1120 }
1121 }
1122
1123 public WikiNode findByG_N(long groupId, String name)
1124 throws NoSuchNodeException, SystemException {
1125 WikiNode wikiNode = fetchByG_N(groupId, name);
1126
1127 if (wikiNode == null) {
1128 StringBuilder msg = new StringBuilder();
1129
1130 msg.append("No WikiNode exists with the key {");
1131
1132 msg.append("groupId=" + groupId);
1133
1134 msg.append(", ");
1135 msg.append("name=" + name);
1136
1137 msg.append(StringPool.CLOSE_CURLY_BRACE);
1138
1139 if (_log.isWarnEnabled()) {
1140 _log.warn(msg.toString());
1141 }
1142
1143 throw new NoSuchNodeException(msg.toString());
1144 }
1145
1146 return wikiNode;
1147 }
1148
1149 public WikiNode fetchByG_N(long groupId, String name)
1150 throws SystemException {
1151 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1152 String finderClassName = WikiNode.class.getName();
1153 String finderMethodName = "fetchByG_N";
1154 String[] finderParams = new String[] {
1155 Long.class.getName(), String.class.getName()
1156 };
1157 Object[] finderArgs = new Object[] { new Long(groupId), name };
1158
1159 Object result = null;
1160
1161 if (finderClassNameCacheEnabled) {
1162 result = FinderCacheUtil.getResult(finderClassName,
1163 finderMethodName, finderParams, finderArgs, this);
1164 }
1165
1166 if (result == null) {
1167 Session session = null;
1168
1169 try {
1170 session = openSession();
1171
1172 StringBuilder query = new StringBuilder();
1173
1174 query.append(
1175 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
1176
1177 query.append("groupId = ?");
1178
1179 query.append(" AND ");
1180
1181 if (name == null) {
1182 query.append("name IS NULL");
1183 }
1184 else {
1185 query.append("name = ?");
1186 }
1187
1188 query.append(" ");
1189
1190 query.append("ORDER BY ");
1191
1192 query.append("name ASC");
1193
1194 Query q = session.createQuery(query.toString());
1195
1196 QueryPos qPos = QueryPos.getInstance(q);
1197
1198 qPos.add(groupId);
1199
1200 if (name != null) {
1201 qPos.add(name);
1202 }
1203
1204 List<WikiNode> list = q.list();
1205
1206 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1207 finderClassName, finderMethodName, finderParams,
1208 finderArgs, list);
1209
1210 if (list.size() == 0) {
1211 return null;
1212 }
1213 else {
1214 return list.get(0);
1215 }
1216 }
1217 catch (Exception e) {
1218 throw processException(e);
1219 }
1220 finally {
1221 closeSession(session);
1222 }
1223 }
1224 else {
1225 List<WikiNode> list = (List<WikiNode>)result;
1226
1227 if (list.size() == 0) {
1228 return null;
1229 }
1230 else {
1231 return list.get(0);
1232 }
1233 }
1234 }
1235
1236 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1237 throws SystemException {
1238 Session session = null;
1239
1240 try {
1241 session = openSession();
1242
1243 dynamicQuery.compile(session);
1244
1245 return dynamicQuery.list();
1246 }
1247 catch (Exception e) {
1248 throw processException(e);
1249 }
1250 finally {
1251 closeSession(session);
1252 }
1253 }
1254
1255 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1256 int start, int end) throws SystemException {
1257 Session session = null;
1258
1259 try {
1260 session = openSession();
1261
1262 dynamicQuery.setLimit(start, end);
1263
1264 dynamicQuery.compile(session);
1265
1266 return dynamicQuery.list();
1267 }
1268 catch (Exception e) {
1269 throw processException(e);
1270 }
1271 finally {
1272 closeSession(session);
1273 }
1274 }
1275
1276 public List<WikiNode> findAll() throws SystemException {
1277 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1278 }
1279
1280 public List<WikiNode> findAll(int start, int end) throws SystemException {
1281 return findAll(start, end, null);
1282 }
1283
1284 public List<WikiNode> findAll(int start, int end, OrderByComparator obc)
1285 throws SystemException {
1286 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1287 String finderClassName = WikiNode.class.getName();
1288 String finderMethodName = "findAll";
1289 String[] finderParams = new String[] {
1290 "java.lang.Integer", "java.lang.Integer",
1291 "com.liferay.portal.kernel.util.OrderByComparator"
1292 };
1293 Object[] finderArgs = new Object[] {
1294 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1295 };
1296
1297 Object result = null;
1298
1299 if (finderClassNameCacheEnabled) {
1300 result = FinderCacheUtil.getResult(finderClassName,
1301 finderMethodName, finderParams, finderArgs, this);
1302 }
1303
1304 if (result == null) {
1305 Session session = null;
1306
1307 try {
1308 session = openSession();
1309
1310 StringBuilder query = new StringBuilder();
1311
1312 query.append("FROM com.liferay.portlet.wiki.model.WikiNode ");
1313
1314 if (obc != null) {
1315 query.append("ORDER BY ");
1316 query.append(obc.getOrderBy());
1317 }
1318
1319 else {
1320 query.append("ORDER BY ");
1321
1322 query.append("name ASC");
1323 }
1324
1325 Query q = session.createQuery(query.toString());
1326
1327 List<WikiNode> list = (List<WikiNode>)QueryUtil.list(q,
1328 getDialect(), start, end);
1329
1330 if (obc == null) {
1331 Collections.sort(list);
1332 }
1333
1334 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1335 finderClassName, finderMethodName, finderParams,
1336 finderArgs, list);
1337
1338 return list;
1339 }
1340 catch (Exception e) {
1341 throw processException(e);
1342 }
1343 finally {
1344 closeSession(session);
1345 }
1346 }
1347 else {
1348 return (List<WikiNode>)result;
1349 }
1350 }
1351
1352 public void removeByUuid(String uuid) throws SystemException {
1353 for (WikiNode wikiNode : findByUuid(uuid)) {
1354 remove(wikiNode);
1355 }
1356 }
1357
1358 public void removeByUUID_G(String uuid, long groupId)
1359 throws NoSuchNodeException, SystemException {
1360 WikiNode wikiNode = findByUUID_G(uuid, groupId);
1361
1362 remove(wikiNode);
1363 }
1364
1365 public void removeByGroupId(long groupId) throws SystemException {
1366 for (WikiNode wikiNode : findByGroupId(groupId)) {
1367 remove(wikiNode);
1368 }
1369 }
1370
1371 public void removeByCompanyId(long companyId) throws SystemException {
1372 for (WikiNode wikiNode : findByCompanyId(companyId)) {
1373 remove(wikiNode);
1374 }
1375 }
1376
1377 public void removeByG_N(long groupId, String name)
1378 throws NoSuchNodeException, SystemException {
1379 WikiNode wikiNode = findByG_N(groupId, name);
1380
1381 remove(wikiNode);
1382 }
1383
1384 public void removeAll() throws SystemException {
1385 for (WikiNode wikiNode : findAll()) {
1386 remove(wikiNode);
1387 }
1388 }
1389
1390 public int countByUuid(String uuid) throws SystemException {
1391 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1392 String finderClassName = WikiNode.class.getName();
1393 String finderMethodName = "countByUuid";
1394 String[] finderParams = new String[] { String.class.getName() };
1395 Object[] finderArgs = new Object[] { uuid };
1396
1397 Object result = null;
1398
1399 if (finderClassNameCacheEnabled) {
1400 result = FinderCacheUtil.getResult(finderClassName,
1401 finderMethodName, finderParams, finderArgs, this);
1402 }
1403
1404 if (result == null) {
1405 Session session = null;
1406
1407 try {
1408 session = openSession();
1409
1410 StringBuilder query = new StringBuilder();
1411
1412 query.append("SELECT COUNT(*) ");
1413 query.append(
1414 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
1415
1416 if (uuid == null) {
1417 query.append("uuid_ IS NULL");
1418 }
1419 else {
1420 query.append("uuid_ = ?");
1421 }
1422
1423 query.append(" ");
1424
1425 Query q = session.createQuery(query.toString());
1426
1427 QueryPos qPos = QueryPos.getInstance(q);
1428
1429 if (uuid != null) {
1430 qPos.add(uuid);
1431 }
1432
1433 Long count = null;
1434
1435 Iterator<Long> itr = q.list().iterator();
1436
1437 if (itr.hasNext()) {
1438 count = itr.next();
1439 }
1440
1441 if (count == null) {
1442 count = new Long(0);
1443 }
1444
1445 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1446 finderClassName, finderMethodName, finderParams,
1447 finderArgs, count);
1448
1449 return count.intValue();
1450 }
1451 catch (Exception e) {
1452 throw processException(e);
1453 }
1454 finally {
1455 closeSession(session);
1456 }
1457 }
1458 else {
1459 return ((Long)result).intValue();
1460 }
1461 }
1462
1463 public int countByUUID_G(String uuid, long groupId)
1464 throws SystemException {
1465 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1466 String finderClassName = WikiNode.class.getName();
1467 String finderMethodName = "countByUUID_G";
1468 String[] finderParams = new String[] {
1469 String.class.getName(), Long.class.getName()
1470 };
1471 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
1472
1473 Object result = null;
1474
1475 if (finderClassNameCacheEnabled) {
1476 result = FinderCacheUtil.getResult(finderClassName,
1477 finderMethodName, finderParams, finderArgs, this);
1478 }
1479
1480 if (result == null) {
1481 Session session = null;
1482
1483 try {
1484 session = openSession();
1485
1486 StringBuilder query = new StringBuilder();
1487
1488 query.append("SELECT COUNT(*) ");
1489 query.append(
1490 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
1491
1492 if (uuid == null) {
1493 query.append("uuid_ IS NULL");
1494 }
1495 else {
1496 query.append("uuid_ = ?");
1497 }
1498
1499 query.append(" AND ");
1500
1501 query.append("groupId = ?");
1502
1503 query.append(" ");
1504
1505 Query q = session.createQuery(query.toString());
1506
1507 QueryPos qPos = QueryPos.getInstance(q);
1508
1509 if (uuid != null) {
1510 qPos.add(uuid);
1511 }
1512
1513 qPos.add(groupId);
1514
1515 Long count = null;
1516
1517 Iterator<Long> itr = q.list().iterator();
1518
1519 if (itr.hasNext()) {
1520 count = itr.next();
1521 }
1522
1523 if (count == null) {
1524 count = new Long(0);
1525 }
1526
1527 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1528 finderClassName, finderMethodName, finderParams,
1529 finderArgs, count);
1530
1531 return count.intValue();
1532 }
1533 catch (Exception e) {
1534 throw processException(e);
1535 }
1536 finally {
1537 closeSession(session);
1538 }
1539 }
1540 else {
1541 return ((Long)result).intValue();
1542 }
1543 }
1544
1545 public int countByGroupId(long groupId) throws SystemException {
1546 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1547 String finderClassName = WikiNode.class.getName();
1548 String finderMethodName = "countByGroupId";
1549 String[] finderParams = new String[] { Long.class.getName() };
1550 Object[] finderArgs = new Object[] { new Long(groupId) };
1551
1552 Object result = null;
1553
1554 if (finderClassNameCacheEnabled) {
1555 result = FinderCacheUtil.getResult(finderClassName,
1556 finderMethodName, finderParams, finderArgs, this);
1557 }
1558
1559 if (result == null) {
1560 Session session = null;
1561
1562 try {
1563 session = openSession();
1564
1565 StringBuilder query = new StringBuilder();
1566
1567 query.append("SELECT COUNT(*) ");
1568 query.append(
1569 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
1570
1571 query.append("groupId = ?");
1572
1573 query.append(" ");
1574
1575 Query q = session.createQuery(query.toString());
1576
1577 QueryPos qPos = QueryPos.getInstance(q);
1578
1579 qPos.add(groupId);
1580
1581 Long count = null;
1582
1583 Iterator<Long> itr = q.list().iterator();
1584
1585 if (itr.hasNext()) {
1586 count = itr.next();
1587 }
1588
1589 if (count == null) {
1590 count = new Long(0);
1591 }
1592
1593 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1594 finderClassName, finderMethodName, finderParams,
1595 finderArgs, count);
1596
1597 return count.intValue();
1598 }
1599 catch (Exception e) {
1600 throw processException(e);
1601 }
1602 finally {
1603 closeSession(session);
1604 }
1605 }
1606 else {
1607 return ((Long)result).intValue();
1608 }
1609 }
1610
1611 public int countByCompanyId(long companyId) throws SystemException {
1612 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1613 String finderClassName = WikiNode.class.getName();
1614 String finderMethodName = "countByCompanyId";
1615 String[] finderParams = new String[] { Long.class.getName() };
1616 Object[] finderArgs = new Object[] { new Long(companyId) };
1617
1618 Object result = null;
1619
1620 if (finderClassNameCacheEnabled) {
1621 result = FinderCacheUtil.getResult(finderClassName,
1622 finderMethodName, finderParams, finderArgs, this);
1623 }
1624
1625 if (result == null) {
1626 Session session = null;
1627
1628 try {
1629 session = openSession();
1630
1631 StringBuilder query = new StringBuilder();
1632
1633 query.append("SELECT COUNT(*) ");
1634 query.append(
1635 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
1636
1637 query.append("companyId = ?");
1638
1639 query.append(" ");
1640
1641 Query q = session.createQuery(query.toString());
1642
1643 QueryPos qPos = QueryPos.getInstance(q);
1644
1645 qPos.add(companyId);
1646
1647 Long count = null;
1648
1649 Iterator<Long> itr = q.list().iterator();
1650
1651 if (itr.hasNext()) {
1652 count = itr.next();
1653 }
1654
1655 if (count == null) {
1656 count = new Long(0);
1657 }
1658
1659 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1660 finderClassName, finderMethodName, finderParams,
1661 finderArgs, count);
1662
1663 return count.intValue();
1664 }
1665 catch (Exception e) {
1666 throw processException(e);
1667 }
1668 finally {
1669 closeSession(session);
1670 }
1671 }
1672 else {
1673 return ((Long)result).intValue();
1674 }
1675 }
1676
1677 public int countByG_N(long groupId, String name) throws SystemException {
1678 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1679 String finderClassName = WikiNode.class.getName();
1680 String finderMethodName = "countByG_N";
1681 String[] finderParams = new String[] {
1682 Long.class.getName(), String.class.getName()
1683 };
1684 Object[] finderArgs = new Object[] { new Long(groupId), name };
1685
1686 Object result = null;
1687
1688 if (finderClassNameCacheEnabled) {
1689 result = FinderCacheUtil.getResult(finderClassName,
1690 finderMethodName, finderParams, finderArgs, this);
1691 }
1692
1693 if (result == null) {
1694 Session session = null;
1695
1696 try {
1697 session = openSession();
1698
1699 StringBuilder query = new StringBuilder();
1700
1701 query.append("SELECT COUNT(*) ");
1702 query.append(
1703 "FROM com.liferay.portlet.wiki.model.WikiNode WHERE ");
1704
1705 query.append("groupId = ?");
1706
1707 query.append(" AND ");
1708
1709 if (name == null) {
1710 query.append("name IS NULL");
1711 }
1712 else {
1713 query.append("name = ?");
1714 }
1715
1716 query.append(" ");
1717
1718 Query q = session.createQuery(query.toString());
1719
1720 QueryPos qPos = QueryPos.getInstance(q);
1721
1722 qPos.add(groupId);
1723
1724 if (name != null) {
1725 qPos.add(name);
1726 }
1727
1728 Long count = null;
1729
1730 Iterator<Long> itr = q.list().iterator();
1731
1732 if (itr.hasNext()) {
1733 count = itr.next();
1734 }
1735
1736 if (count == null) {
1737 count = new Long(0);
1738 }
1739
1740 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1741 finderClassName, finderMethodName, finderParams,
1742 finderArgs, count);
1743
1744 return count.intValue();
1745 }
1746 catch (Exception e) {
1747 throw processException(e);
1748 }
1749 finally {
1750 closeSession(session);
1751 }
1752 }
1753 else {
1754 return ((Long)result).intValue();
1755 }
1756 }
1757
1758 public int countAll() throws SystemException {
1759 boolean finderClassNameCacheEnabled = WikiNodeModelImpl.CACHE_ENABLED;
1760 String finderClassName = WikiNode.class.getName();
1761 String finderMethodName = "countAll";
1762 String[] finderParams = new String[] { };
1763 Object[] finderArgs = new Object[] { };
1764
1765 Object result = null;
1766
1767 if (finderClassNameCacheEnabled) {
1768 result = FinderCacheUtil.getResult(finderClassName,
1769 finderMethodName, finderParams, finderArgs, this);
1770 }
1771
1772 if (result == null) {
1773 Session session = null;
1774
1775 try {
1776 session = openSession();
1777
1778 Query q = session.createQuery(
1779 "SELECT COUNT(*) FROM com.liferay.portlet.wiki.model.WikiNode");
1780
1781 Long count = null;
1782
1783 Iterator<Long> itr = q.list().iterator();
1784
1785 if (itr.hasNext()) {
1786 count = itr.next();
1787 }
1788
1789 if (count == null) {
1790 count = new Long(0);
1791 }
1792
1793 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1794 finderClassName, finderMethodName, finderParams,
1795 finderArgs, count);
1796
1797 return count.intValue();
1798 }
1799 catch (Exception e) {
1800 throw processException(e);
1801 }
1802 finally {
1803 closeSession(session);
1804 }
1805 }
1806 else {
1807 return ((Long)result).intValue();
1808 }
1809 }
1810
1811 public void registerListener(ModelListener listener) {
1812 List<ModelListener> listeners = ListUtil.fromArray(_listeners);
1813
1814 listeners.add(listener);
1815
1816 _listeners = listeners.toArray(new ModelListener[listeners.size()]);
1817 }
1818
1819 public void unregisterListener(ModelListener listener) {
1820 List<ModelListener> listeners = ListUtil.fromArray(_listeners);
1821
1822 listeners.remove(listener);
1823
1824 _listeners = listeners.toArray(new ModelListener[listeners.size()]);
1825 }
1826
1827 public void afterPropertiesSet() {
1828 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1829 com.liferay.portal.util.PropsUtil.get(
1830 "value.object.listener.com.liferay.portlet.wiki.model.WikiNode")));
1831
1832 if (listenerClassNames.length > 0) {
1833 try {
1834 List<ModelListener> listeners = new ArrayList<ModelListener>();
1835
1836 for (String listenerClassName : listenerClassNames) {
1837 listeners.add((ModelListener)Class.forName(
1838 listenerClassName).newInstance());
1839 }
1840
1841 _listeners = listeners.toArray(new ModelListener[listeners.size()]);
1842 }
1843 catch (Exception e) {
1844 _log.error(e);
1845 }
1846 }
1847 }
1848
1849 private static Log _log = LogFactory.getLog(WikiNodePersistenceImpl.class);
1850 private ModelListener[] _listeners = new ModelListener[0];
1851}