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