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