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 "FROM com.liferay.portal.model.PasswordPolicyRel WHERE ");
468
469 query.append("classNameId = ?");
470
471 query.append(" AND ");
472
473 query.append("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, list);
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 "FROM com.liferay.portal.model.PasswordPolicyRel WHERE ");
592
593 query.append("passwordPolicyId = ?");
594
595 query.append(" AND ");
596
597 query.append("classNameId = ?");
598
599 query.append(" AND ");
600
601 query.append("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, list);
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("FROM com.liferay.portal.model.PasswordPolicyRel ");
729
730 if (obc != null) {
731 query.append("ORDER BY ");
732 query.append(obc.getOrderBy());
733 }
734
735 Query q = session.createQuery(query.toString());
736
737 if (obc == null) {
738 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
739 getDialect(), start, end, false);
740
741 Collections.sort(list);
742 }
743 else {
744 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
745 getDialect(), start, end);
746 }
747 }
748 catch (Exception e) {
749 throw processException(e);
750 }
751 finally {
752 if (list == null) {
753 list = new ArrayList<PasswordPolicyRel>();
754 }
755
756 cacheResult(list);
757
758 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
759
760 closeSession(session);
761 }
762 }
763
764 return list;
765 }
766
767 public void removeByC_C(long classNameId, long classPK)
768 throws NoSuchPasswordPolicyRelException, SystemException {
769 PasswordPolicyRel passwordPolicyRel = findByC_C(classNameId, classPK);
770
771 remove(passwordPolicyRel);
772 }
773
774 public void removeByP_C_C(long passwordPolicyId, long classNameId,
775 long classPK) throws NoSuchPasswordPolicyRelException, SystemException {
776 PasswordPolicyRel passwordPolicyRel = findByP_C_C(passwordPolicyId,
777 classNameId, classPK);
778
779 remove(passwordPolicyRel);
780 }
781
782 public void removeAll() throws SystemException {
783 for (PasswordPolicyRel passwordPolicyRel : findAll()) {
784 remove(passwordPolicyRel);
785 }
786 }
787
788 public int countByC_C(long classNameId, long classPK)
789 throws SystemException {
790 Object[] finderArgs = new Object[] {
791 new Long(classNameId), new Long(classPK)
792 };
793
794 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
795 finderArgs, this);
796
797 if (count == null) {
798 Session session = null;
799
800 try {
801 session = openSession();
802
803 StringBuilder query = new StringBuilder();
804
805 query.append("SELECT COUNT(*) ");
806 query.append(
807 "FROM com.liferay.portal.model.PasswordPolicyRel WHERE ");
808
809 query.append("classNameId = ?");
810
811 query.append(" AND ");
812
813 query.append("classPK = ?");
814
815 query.append(" ");
816
817 Query q = session.createQuery(query.toString());
818
819 QueryPos qPos = QueryPos.getInstance(q);
820
821 qPos.add(classNameId);
822
823 qPos.add(classPK);
824
825 count = (Long)q.uniqueResult();
826 }
827 catch (Exception e) {
828 throw processException(e);
829 }
830 finally {
831 if (count == null) {
832 count = Long.valueOf(0);
833 }
834
835 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
836 count);
837
838 closeSession(session);
839 }
840 }
841
842 return count.intValue();
843 }
844
845 public int countByP_C_C(long passwordPolicyId, long classNameId,
846 long classPK) throws SystemException {
847 Object[] finderArgs = new Object[] {
848 new Long(passwordPolicyId), new Long(classNameId),
849 new Long(classPK)
850 };
851
852 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_C_C,
853 finderArgs, this);
854
855 if (count == null) {
856 Session session = null;
857
858 try {
859 session = openSession();
860
861 StringBuilder query = new StringBuilder();
862
863 query.append("SELECT COUNT(*) ");
864 query.append(
865 "FROM com.liferay.portal.model.PasswordPolicyRel WHERE ");
866
867 query.append("passwordPolicyId = ?");
868
869 query.append(" AND ");
870
871 query.append("classNameId = ?");
872
873 query.append(" AND ");
874
875 query.append("classPK = ?");
876
877 query.append(" ");
878
879 Query q = session.createQuery(query.toString());
880
881 QueryPos qPos = QueryPos.getInstance(q);
882
883 qPos.add(passwordPolicyId);
884
885 qPos.add(classNameId);
886
887 qPos.add(classPK);
888
889 count = (Long)q.uniqueResult();
890 }
891 catch (Exception e) {
892 throw processException(e);
893 }
894 finally {
895 if (count == null) {
896 count = Long.valueOf(0);
897 }
898
899 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_C_C,
900 finderArgs, count);
901
902 closeSession(session);
903 }
904 }
905
906 return count.intValue();
907 }
908
909 public int countAll() throws SystemException {
910 Object[] finderArgs = new Object[0];
911
912 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
913 finderArgs, this);
914
915 if (count == null) {
916 Session session = null;
917
918 try {
919 session = openSession();
920
921 Query q = session.createQuery(
922 "SELECT COUNT(*) FROM com.liferay.portal.model.PasswordPolicyRel");
923
924 count = (Long)q.uniqueResult();
925 }
926 catch (Exception e) {
927 throw processException(e);
928 }
929 finally {
930 if (count == null) {
931 count = Long.valueOf(0);
932 }
933
934 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
935 count);
936
937 closeSession(session);
938 }
939 }
940
941 return count.intValue();
942 }
943
944 public void afterPropertiesSet() {
945 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
946 com.liferay.portal.util.PropsUtil.get(
947 "value.object.listener.com.liferay.portal.model.PasswordPolicyRel")));
948
949 if (listenerClassNames.length > 0) {
950 try {
951 List<ModelListener<PasswordPolicyRel>> listenersList = new ArrayList<ModelListener<PasswordPolicyRel>>();
952
953 for (String listenerClassName : listenerClassNames) {
954 listenersList.add((ModelListener<PasswordPolicyRel>)Class.forName(
955 listenerClassName).newInstance());
956 }
957
958 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
959 }
960 catch (Exception e) {
961 _log.error(e);
962 }
963 }
964 }
965
966 @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
967 protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
968 @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
969 protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
970 @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
971 protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
972 @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
973 protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
974 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
975 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
976 @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
977 protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
978 @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
979 protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
980 @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
981 protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
982 @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
983 protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
984 @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
985 protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
986 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
987 protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
988 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
989 protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
990 @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
991 protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
992 @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
993 protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
994 @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
995 protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
996 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
997 protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
998 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
999 protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
1000 @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
1001 protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
1002 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
1003 protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
1004 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
1005 protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1006 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
1007 protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
1008 @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
1009 protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
1010 @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
1011 protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
1012 @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
1013 protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
1014 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
1015 protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
1016 @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
1017 protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
1018 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
1019 protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
1020 @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
1021 protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
1022 @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
1023 protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
1024 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
1025 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
1026 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
1027 protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
1028 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
1029 protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
1030 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
1031 protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
1032 @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
1033 protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
1034 @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
1035 protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
1036 @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
1037 protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
1038 @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
1039 protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
1040 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
1041 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1042 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
1043 protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
1044 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
1045 protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
1046 @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
1047 protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
1048 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
1049 protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
1050 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
1051 protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
1052 @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
1053 protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
1054 @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
1055 protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
1056 private static Log _log = LogFactoryUtil.getLog(PasswordPolicyRelPersistenceImpl.class);
1057}