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