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