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