001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchPasswordPolicyRelException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.model.PasswordPolicyRel;
040 import com.liferay.portal.model.impl.PasswordPolicyRelImpl;
041 import com.liferay.portal.model.impl.PasswordPolicyRelModelImpl;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import java.io.Serializable;
045
046 import java.util.ArrayList;
047 import java.util.Collections;
048 import java.util.List;
049
050
062 public class PasswordPolicyRelPersistenceImpl extends BasePersistenceImpl<PasswordPolicyRel>
063 implements PasswordPolicyRelPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = PasswordPolicyRelImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PASSWORDPOLICYID =
075 new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
076 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
077 PasswordPolicyRelImpl.class,
078 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByPasswordPolicyId",
079 new String[] {
080 Long.class.getName(),
081
082 "java.lang.Integer", "java.lang.Integer",
083 "com.liferay.portal.kernel.util.OrderByComparator"
084 });
085 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID =
086 new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
087 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
088 PasswordPolicyRelImpl.class,
089 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
090 "findByPasswordPolicyId", new String[] { Long.class.getName() },
091 PasswordPolicyRelModelImpl.PASSWORDPOLICYID_COLUMN_BITMASK);
092 public static final FinderPath FINDER_PATH_COUNT_BY_PASSWORDPOLICYID = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
093 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED, Long.class,
094 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
095 "countByPasswordPolicyId", new String[] { Long.class.getName() });
096 public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
097 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
098 PasswordPolicyRelImpl.class, FINDER_CLASS_NAME_ENTITY,
099 "fetchByC_C",
100 new String[] { Long.class.getName(), Long.class.getName() },
101 PasswordPolicyRelModelImpl.CLASSNAMEID_COLUMN_BITMASK |
102 PasswordPolicyRelModelImpl.CLASSPK_COLUMN_BITMASK);
103 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
104 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED, Long.class,
105 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
106 new String[] { Long.class.getName(), Long.class.getName() });
107 public static final FinderPath FINDER_PATH_FETCH_BY_P_C_C = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
108 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
109 PasswordPolicyRelImpl.class, FINDER_CLASS_NAME_ENTITY,
110 "fetchByP_C_C",
111 new String[] {
112 Long.class.getName(), Long.class.getName(), Long.class.getName()
113 },
114 PasswordPolicyRelModelImpl.PASSWORDPOLICYID_COLUMN_BITMASK |
115 PasswordPolicyRelModelImpl.CLASSNAMEID_COLUMN_BITMASK |
116 PasswordPolicyRelModelImpl.CLASSPK_COLUMN_BITMASK);
117 public static final FinderPath FINDER_PATH_COUNT_BY_P_C_C = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
118 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED, Long.class,
119 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByP_C_C",
120 new String[] {
121 Long.class.getName(), Long.class.getName(), Long.class.getName()
122 });
123 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
124 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
125 PasswordPolicyRelImpl.class,
126 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
127 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
128 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
129 PasswordPolicyRelImpl.class,
130 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
131 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
132 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED, Long.class,
133 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
134
135
140 public void cacheResult(PasswordPolicyRel passwordPolicyRel) {
141 EntityCacheUtil.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
142 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey(),
143 passwordPolicyRel);
144
145 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
146 new Object[] {
147 Long.valueOf(passwordPolicyRel.getClassNameId()),
148 Long.valueOf(passwordPolicyRel.getClassPK())
149 }, passwordPolicyRel);
150
151 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C,
152 new Object[] {
153 Long.valueOf(passwordPolicyRel.getPasswordPolicyId()),
154 Long.valueOf(passwordPolicyRel.getClassNameId()),
155 Long.valueOf(passwordPolicyRel.getClassPK())
156 }, passwordPolicyRel);
157
158 passwordPolicyRel.resetOriginalValues();
159 }
160
161
166 public void cacheResult(List<PasswordPolicyRel> passwordPolicyRels) {
167 for (PasswordPolicyRel passwordPolicyRel : passwordPolicyRels) {
168 if (EntityCacheUtil.getResult(
169 PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
170 PasswordPolicyRelImpl.class,
171 passwordPolicyRel.getPrimaryKey()) == null) {
172 cacheResult(passwordPolicyRel);
173 }
174 else {
175 passwordPolicyRel.resetOriginalValues();
176 }
177 }
178 }
179
180
187 @Override
188 public void clearCache() {
189 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
190 CacheRegistryUtil.clear(PasswordPolicyRelImpl.class.getName());
191 }
192
193 EntityCacheUtil.clearCache(PasswordPolicyRelImpl.class.getName());
194
195 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
196 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
197 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
198 }
199
200
207 @Override
208 public void clearCache(PasswordPolicyRel passwordPolicyRel) {
209 EntityCacheUtil.removeResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
210 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey());
211
212 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
213 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
214
215 clearUniqueFindersCache(passwordPolicyRel);
216 }
217
218 @Override
219 public void clearCache(List<PasswordPolicyRel> passwordPolicyRels) {
220 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
221 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
222
223 for (PasswordPolicyRel passwordPolicyRel : passwordPolicyRels) {
224 EntityCacheUtil.removeResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
225 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey());
226
227 clearUniqueFindersCache(passwordPolicyRel);
228 }
229 }
230
231 protected void clearUniqueFindersCache(PasswordPolicyRel passwordPolicyRel) {
232 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
233 new Object[] {
234 Long.valueOf(passwordPolicyRel.getClassNameId()),
235 Long.valueOf(passwordPolicyRel.getClassPK())
236 });
237
238 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_C_C,
239 new Object[] {
240 Long.valueOf(passwordPolicyRel.getPasswordPolicyId()),
241 Long.valueOf(passwordPolicyRel.getClassNameId()),
242 Long.valueOf(passwordPolicyRel.getClassPK())
243 });
244 }
245
246
252 public PasswordPolicyRel create(long passwordPolicyRelId) {
253 PasswordPolicyRel passwordPolicyRel = new PasswordPolicyRelImpl();
254
255 passwordPolicyRel.setNew(true);
256 passwordPolicyRel.setPrimaryKey(passwordPolicyRelId);
257
258 return passwordPolicyRel;
259 }
260
261
269 public PasswordPolicyRel remove(long passwordPolicyRelId)
270 throws NoSuchPasswordPolicyRelException, SystemException {
271 return remove(Long.valueOf(passwordPolicyRelId));
272 }
273
274
282 @Override
283 public PasswordPolicyRel remove(Serializable primaryKey)
284 throws NoSuchPasswordPolicyRelException, SystemException {
285 Session session = null;
286
287 try {
288 session = openSession();
289
290 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
291 primaryKey);
292
293 if (passwordPolicyRel == null) {
294 if (_log.isWarnEnabled()) {
295 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
296 }
297
298 throw new NoSuchPasswordPolicyRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
299 primaryKey);
300 }
301
302 return remove(passwordPolicyRel);
303 }
304 catch (NoSuchPasswordPolicyRelException nsee) {
305 throw nsee;
306 }
307 catch (Exception e) {
308 throw processException(e);
309 }
310 finally {
311 closeSession(session);
312 }
313 }
314
315 @Override
316 protected PasswordPolicyRel removeImpl(PasswordPolicyRel passwordPolicyRel)
317 throws SystemException {
318 passwordPolicyRel = toUnwrappedModel(passwordPolicyRel);
319
320 Session session = null;
321
322 try {
323 session = openSession();
324
325 if (passwordPolicyRel.isCachedModel()) {
326 passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
327 passwordPolicyRel.getPrimaryKeyObj());
328 }
329
330 session.delete(passwordPolicyRel);
331 }
332 catch (Exception e) {
333 throw processException(e);
334 }
335 finally {
336 closeSession(session);
337 }
338
339 clearCache(passwordPolicyRel);
340
341 return passwordPolicyRel;
342 }
343
344 @Override
345 public PasswordPolicyRel updateImpl(
346 com.liferay.portal.model.PasswordPolicyRel passwordPolicyRel)
347 throws SystemException {
348 passwordPolicyRel = toUnwrappedModel(passwordPolicyRel);
349
350 boolean isNew = passwordPolicyRel.isNew();
351
352 PasswordPolicyRelModelImpl passwordPolicyRelModelImpl = (PasswordPolicyRelModelImpl)passwordPolicyRel;
353
354 Session session = null;
355
356 try {
357 session = openSession();
358
359 if (passwordPolicyRel.isNew()) {
360 session.save(passwordPolicyRel);
361
362 passwordPolicyRel.setNew(false);
363 }
364 else {
365 session.merge(passwordPolicyRel);
366 }
367 }
368 catch (Exception e) {
369 throw processException(e);
370 }
371 finally {
372 closeSession(session);
373 }
374
375 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
376
377 if (isNew || !PasswordPolicyRelModelImpl.COLUMN_BITMASK_ENABLED) {
378 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
379 }
380
381 else {
382 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
383 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID.getColumnBitmask()) != 0) {
384 Object[] args = new Object[] {
385 Long.valueOf(passwordPolicyRelModelImpl.getOriginalPasswordPolicyId())
386 };
387
388 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
389 args);
390 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID,
391 args);
392
393 args = new Object[] {
394 Long.valueOf(passwordPolicyRelModelImpl.getPasswordPolicyId())
395 };
396
397 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
398 args);
399 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID,
400 args);
401 }
402 }
403
404 EntityCacheUtil.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
405 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey(),
406 passwordPolicyRel);
407
408 if (isNew) {
409 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
410 new Object[] {
411 Long.valueOf(passwordPolicyRel.getClassNameId()),
412 Long.valueOf(passwordPolicyRel.getClassPK())
413 }, passwordPolicyRel);
414
415 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C,
416 new Object[] {
417 Long.valueOf(passwordPolicyRel.getPasswordPolicyId()),
418 Long.valueOf(passwordPolicyRel.getClassNameId()),
419 Long.valueOf(passwordPolicyRel.getClassPK())
420 }, passwordPolicyRel);
421 }
422 else {
423 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
424 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
425 Object[] args = new Object[] {
426 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassNameId()),
427 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassPK())
428 };
429
430 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
431
432 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
433
434 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
435 new Object[] {
436 Long.valueOf(passwordPolicyRel.getClassNameId()),
437 Long.valueOf(passwordPolicyRel.getClassPK())
438 }, passwordPolicyRel);
439 }
440
441 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
442 FINDER_PATH_FETCH_BY_P_C_C.getColumnBitmask()) != 0) {
443 Object[] args = new Object[] {
444 Long.valueOf(passwordPolicyRelModelImpl.getOriginalPasswordPolicyId()),
445 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassNameId()),
446 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassPK())
447 };
448
449 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_C_C, args);
450
451 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_C_C, args);
452
453 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C,
454 new Object[] {
455 Long.valueOf(passwordPolicyRel.getPasswordPolicyId()),
456 Long.valueOf(passwordPolicyRel.getClassNameId()),
457 Long.valueOf(passwordPolicyRel.getClassPK())
458 }, passwordPolicyRel);
459 }
460 }
461
462 return passwordPolicyRel;
463 }
464
465 protected PasswordPolicyRel toUnwrappedModel(
466 PasswordPolicyRel passwordPolicyRel) {
467 if (passwordPolicyRel instanceof PasswordPolicyRelImpl) {
468 return passwordPolicyRel;
469 }
470
471 PasswordPolicyRelImpl passwordPolicyRelImpl = new PasswordPolicyRelImpl();
472
473 passwordPolicyRelImpl.setNew(passwordPolicyRel.isNew());
474 passwordPolicyRelImpl.setPrimaryKey(passwordPolicyRel.getPrimaryKey());
475
476 passwordPolicyRelImpl.setPasswordPolicyRelId(passwordPolicyRel.getPasswordPolicyRelId());
477 passwordPolicyRelImpl.setPasswordPolicyId(passwordPolicyRel.getPasswordPolicyId());
478 passwordPolicyRelImpl.setClassNameId(passwordPolicyRel.getClassNameId());
479 passwordPolicyRelImpl.setClassPK(passwordPolicyRel.getClassPK());
480
481 return passwordPolicyRelImpl;
482 }
483
484
492 @Override
493 public PasswordPolicyRel findByPrimaryKey(Serializable primaryKey)
494 throws NoSuchModelException, SystemException {
495 return findByPrimaryKey(((Long)primaryKey).longValue());
496 }
497
498
506 public PasswordPolicyRel findByPrimaryKey(long passwordPolicyRelId)
507 throws NoSuchPasswordPolicyRelException, SystemException {
508 PasswordPolicyRel passwordPolicyRel = fetchByPrimaryKey(passwordPolicyRelId);
509
510 if (passwordPolicyRel == null) {
511 if (_log.isWarnEnabled()) {
512 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
513 passwordPolicyRelId);
514 }
515
516 throw new NoSuchPasswordPolicyRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
517 passwordPolicyRelId);
518 }
519
520 return passwordPolicyRel;
521 }
522
523
530 @Override
531 public PasswordPolicyRel fetchByPrimaryKey(Serializable primaryKey)
532 throws SystemException {
533 return fetchByPrimaryKey(((Long)primaryKey).longValue());
534 }
535
536
543 public PasswordPolicyRel fetchByPrimaryKey(long passwordPolicyRelId)
544 throws SystemException {
545 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)EntityCacheUtil.getResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
546 PasswordPolicyRelImpl.class, passwordPolicyRelId);
547
548 if (passwordPolicyRel == _nullPasswordPolicyRel) {
549 return null;
550 }
551
552 if (passwordPolicyRel == null) {
553 Session session = null;
554
555 boolean hasException = false;
556
557 try {
558 session = openSession();
559
560 passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
561 Long.valueOf(passwordPolicyRelId));
562 }
563 catch (Exception e) {
564 hasException = true;
565
566 throw processException(e);
567 }
568 finally {
569 if (passwordPolicyRel != null) {
570 cacheResult(passwordPolicyRel);
571 }
572 else if (!hasException) {
573 EntityCacheUtil.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
574 PasswordPolicyRelImpl.class, passwordPolicyRelId,
575 _nullPasswordPolicyRel);
576 }
577
578 closeSession(session);
579 }
580 }
581
582 return passwordPolicyRel;
583 }
584
585
592 public List<PasswordPolicyRel> findByPasswordPolicyId(long passwordPolicyId)
593 throws SystemException {
594 return findByPasswordPolicyId(passwordPolicyId, QueryUtil.ALL_POS,
595 QueryUtil.ALL_POS, null);
596 }
597
598
611 public List<PasswordPolicyRel> findByPasswordPolicyId(
612 long passwordPolicyId, int start, int end) throws SystemException {
613 return findByPasswordPolicyId(passwordPolicyId, start, end, null);
614 }
615
616
630 public List<PasswordPolicyRel> findByPasswordPolicyId(
631 long passwordPolicyId, int start, int end,
632 OrderByComparator orderByComparator) throws SystemException {
633 FinderPath finderPath = null;
634 Object[] finderArgs = null;
635
636 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
637 (orderByComparator == null)) {
638 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID;
639 finderArgs = new Object[] { passwordPolicyId };
640 }
641 else {
642 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PASSWORDPOLICYID;
643 finderArgs = new Object[] {
644 passwordPolicyId,
645
646 start, end, orderByComparator
647 };
648 }
649
650 List<PasswordPolicyRel> list = (List<PasswordPolicyRel>)FinderCacheUtil.getResult(finderPath,
651 finderArgs, this);
652
653 if ((list != null) && !list.isEmpty()) {
654 for (PasswordPolicyRel passwordPolicyRel : list) {
655 if ((passwordPolicyId != passwordPolicyRel.getPasswordPolicyId())) {
656 list = null;
657
658 break;
659 }
660 }
661 }
662
663 if (list == null) {
664 StringBundler query = null;
665
666 if (orderByComparator != null) {
667 query = new StringBundler(3 +
668 (orderByComparator.getOrderByFields().length * 3));
669 }
670 else {
671 query = new StringBundler(2);
672 }
673
674 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
675
676 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
677
678 if (orderByComparator != null) {
679 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
680 orderByComparator);
681 }
682
683 String sql = query.toString();
684
685 Session session = null;
686
687 try {
688 session = openSession();
689
690 Query q = session.createQuery(sql);
691
692 QueryPos qPos = QueryPos.getInstance(q);
693
694 qPos.add(passwordPolicyId);
695
696 list = (List<PasswordPolicyRel>)QueryUtil.list(q, getDialect(),
697 start, end);
698 }
699 catch (Exception e) {
700 throw processException(e);
701 }
702 finally {
703 if (list == null) {
704 FinderCacheUtil.removeResult(finderPath, finderArgs);
705 }
706 else {
707 cacheResult(list);
708
709 FinderCacheUtil.putResult(finderPath, finderArgs, list);
710 }
711
712 closeSession(session);
713 }
714 }
715
716 return list;
717 }
718
719
728 public PasswordPolicyRel findByPasswordPolicyId_First(
729 long passwordPolicyId, OrderByComparator orderByComparator)
730 throws NoSuchPasswordPolicyRelException, SystemException {
731 PasswordPolicyRel passwordPolicyRel = fetchByPasswordPolicyId_First(passwordPolicyId,
732 orderByComparator);
733
734 if (passwordPolicyRel != null) {
735 return passwordPolicyRel;
736 }
737
738 StringBundler msg = new StringBundler(4);
739
740 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
741
742 msg.append("passwordPolicyId=");
743 msg.append(passwordPolicyId);
744
745 msg.append(StringPool.CLOSE_CURLY_BRACE);
746
747 throw new NoSuchPasswordPolicyRelException(msg.toString());
748 }
749
750
758 public PasswordPolicyRel fetchByPasswordPolicyId_First(
759 long passwordPolicyId, OrderByComparator orderByComparator)
760 throws SystemException {
761 List<PasswordPolicyRel> list = findByPasswordPolicyId(passwordPolicyId,
762 0, 1, orderByComparator);
763
764 if (!list.isEmpty()) {
765 return list.get(0);
766 }
767
768 return null;
769 }
770
771
780 public PasswordPolicyRel findByPasswordPolicyId_Last(
781 long passwordPolicyId, OrderByComparator orderByComparator)
782 throws NoSuchPasswordPolicyRelException, SystemException {
783 PasswordPolicyRel passwordPolicyRel = fetchByPasswordPolicyId_Last(passwordPolicyId,
784 orderByComparator);
785
786 if (passwordPolicyRel != null) {
787 return passwordPolicyRel;
788 }
789
790 StringBundler msg = new StringBundler(4);
791
792 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
793
794 msg.append("passwordPolicyId=");
795 msg.append(passwordPolicyId);
796
797 msg.append(StringPool.CLOSE_CURLY_BRACE);
798
799 throw new NoSuchPasswordPolicyRelException(msg.toString());
800 }
801
802
810 public PasswordPolicyRel fetchByPasswordPolicyId_Last(
811 long passwordPolicyId, OrderByComparator orderByComparator)
812 throws SystemException {
813 int count = countByPasswordPolicyId(passwordPolicyId);
814
815 List<PasswordPolicyRel> list = findByPasswordPolicyId(passwordPolicyId,
816 count - 1, count, orderByComparator);
817
818 if (!list.isEmpty()) {
819 return list.get(0);
820 }
821
822 return null;
823 }
824
825
835 public PasswordPolicyRel[] findByPasswordPolicyId_PrevAndNext(
836 long passwordPolicyRelId, long passwordPolicyId,
837 OrderByComparator orderByComparator)
838 throws NoSuchPasswordPolicyRelException, SystemException {
839 PasswordPolicyRel passwordPolicyRel = findByPrimaryKey(passwordPolicyRelId);
840
841 Session session = null;
842
843 try {
844 session = openSession();
845
846 PasswordPolicyRel[] array = new PasswordPolicyRelImpl[3];
847
848 array[0] = getByPasswordPolicyId_PrevAndNext(session,
849 passwordPolicyRel, passwordPolicyId, orderByComparator, true);
850
851 array[1] = passwordPolicyRel;
852
853 array[2] = getByPasswordPolicyId_PrevAndNext(session,
854 passwordPolicyRel, passwordPolicyId, orderByComparator,
855 false);
856
857 return array;
858 }
859 catch (Exception e) {
860 throw processException(e);
861 }
862 finally {
863 closeSession(session);
864 }
865 }
866
867 protected PasswordPolicyRel getByPasswordPolicyId_PrevAndNext(
868 Session session, PasswordPolicyRel passwordPolicyRel,
869 long passwordPolicyId, OrderByComparator orderByComparator,
870 boolean previous) {
871 StringBundler query = null;
872
873 if (orderByComparator != null) {
874 query = new StringBundler(6 +
875 (orderByComparator.getOrderByFields().length * 6));
876 }
877 else {
878 query = new StringBundler(3);
879 }
880
881 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
882
883 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
884
885 if (orderByComparator != null) {
886 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
887
888 if (orderByConditionFields.length > 0) {
889 query.append(WHERE_AND);
890 }
891
892 for (int i = 0; i < orderByConditionFields.length; i++) {
893 query.append(_ORDER_BY_ENTITY_ALIAS);
894 query.append(orderByConditionFields[i]);
895
896 if ((i + 1) < orderByConditionFields.length) {
897 if (orderByComparator.isAscending() ^ previous) {
898 query.append(WHERE_GREATER_THAN_HAS_NEXT);
899 }
900 else {
901 query.append(WHERE_LESSER_THAN_HAS_NEXT);
902 }
903 }
904 else {
905 if (orderByComparator.isAscending() ^ previous) {
906 query.append(WHERE_GREATER_THAN);
907 }
908 else {
909 query.append(WHERE_LESSER_THAN);
910 }
911 }
912 }
913
914 query.append(ORDER_BY_CLAUSE);
915
916 String[] orderByFields = orderByComparator.getOrderByFields();
917
918 for (int i = 0; i < orderByFields.length; i++) {
919 query.append(_ORDER_BY_ENTITY_ALIAS);
920 query.append(orderByFields[i]);
921
922 if ((i + 1) < orderByFields.length) {
923 if (orderByComparator.isAscending() ^ previous) {
924 query.append(ORDER_BY_ASC_HAS_NEXT);
925 }
926 else {
927 query.append(ORDER_BY_DESC_HAS_NEXT);
928 }
929 }
930 else {
931 if (orderByComparator.isAscending() ^ previous) {
932 query.append(ORDER_BY_ASC);
933 }
934 else {
935 query.append(ORDER_BY_DESC);
936 }
937 }
938 }
939 }
940
941 String sql = query.toString();
942
943 Query q = session.createQuery(sql);
944
945 q.setFirstResult(0);
946 q.setMaxResults(2);
947
948 QueryPos qPos = QueryPos.getInstance(q);
949
950 qPos.add(passwordPolicyId);
951
952 if (orderByComparator != null) {
953 Object[] values = orderByComparator.getOrderByConditionValues(passwordPolicyRel);
954
955 for (Object value : values) {
956 qPos.add(value);
957 }
958 }
959
960 List<PasswordPolicyRel> list = q.list();
961
962 if (list.size() == 2) {
963 return list.get(1);
964 }
965 else {
966 return null;
967 }
968 }
969
970
979 public PasswordPolicyRel findByC_C(long classNameId, long classPK)
980 throws NoSuchPasswordPolicyRelException, SystemException {
981 PasswordPolicyRel passwordPolicyRel = fetchByC_C(classNameId, classPK);
982
983 if (passwordPolicyRel == null) {
984 StringBundler msg = new StringBundler(6);
985
986 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
987
988 msg.append("classNameId=");
989 msg.append(classNameId);
990
991 msg.append(", classPK=");
992 msg.append(classPK);
993
994 msg.append(StringPool.CLOSE_CURLY_BRACE);
995
996 if (_log.isWarnEnabled()) {
997 _log.warn(msg.toString());
998 }
999
1000 throw new NoSuchPasswordPolicyRelException(msg.toString());
1001 }
1002
1003 return passwordPolicyRel;
1004 }
1005
1006
1014 public PasswordPolicyRel fetchByC_C(long classNameId, long classPK)
1015 throws SystemException {
1016 return fetchByC_C(classNameId, classPK, true);
1017 }
1018
1019
1028 public PasswordPolicyRel fetchByC_C(long classNameId, long classPK,
1029 boolean retrieveFromCache) throws SystemException {
1030 Object[] finderArgs = new Object[] { classNameId, classPK };
1031
1032 Object result = null;
1033
1034 if (retrieveFromCache) {
1035 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
1036 finderArgs, this);
1037 }
1038
1039 if (result instanceof PasswordPolicyRel) {
1040 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)result;
1041
1042 if ((classNameId != passwordPolicyRel.getClassNameId()) ||
1043 (classPK != passwordPolicyRel.getClassPK())) {
1044 result = null;
1045 }
1046 }
1047
1048 if (result == null) {
1049 StringBundler query = new StringBundler(3);
1050
1051 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
1052
1053 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1054
1055 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1056
1057 String sql = query.toString();
1058
1059 Session session = null;
1060
1061 try {
1062 session = openSession();
1063
1064 Query q = session.createQuery(sql);
1065
1066 QueryPos qPos = QueryPos.getInstance(q);
1067
1068 qPos.add(classNameId);
1069
1070 qPos.add(classPK);
1071
1072 List<PasswordPolicyRel> list = q.list();
1073
1074 result = list;
1075
1076 PasswordPolicyRel passwordPolicyRel = null;
1077
1078 if (list.isEmpty()) {
1079 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1080 finderArgs, list);
1081 }
1082 else {
1083 passwordPolicyRel = list.get(0);
1084
1085 cacheResult(passwordPolicyRel);
1086
1087 if ((passwordPolicyRel.getClassNameId() != classNameId) ||
1088 (passwordPolicyRel.getClassPK() != classPK)) {
1089 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1090 finderArgs, passwordPolicyRel);
1091 }
1092 }
1093
1094 return passwordPolicyRel;
1095 }
1096 catch (Exception e) {
1097 throw processException(e);
1098 }
1099 finally {
1100 if (result == null) {
1101 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
1102 finderArgs);
1103 }
1104
1105 closeSession(session);
1106 }
1107 }
1108 else {
1109 if (result instanceof List<?>) {
1110 return null;
1111 }
1112 else {
1113 return (PasswordPolicyRel)result;
1114 }
1115 }
1116 }
1117
1118
1128 public PasswordPolicyRel findByP_C_C(long passwordPolicyId,
1129 long classNameId, long classPK)
1130 throws NoSuchPasswordPolicyRelException, SystemException {
1131 PasswordPolicyRel passwordPolicyRel = fetchByP_C_C(passwordPolicyId,
1132 classNameId, classPK);
1133
1134 if (passwordPolicyRel == null) {
1135 StringBundler msg = new StringBundler(8);
1136
1137 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1138
1139 msg.append("passwordPolicyId=");
1140 msg.append(passwordPolicyId);
1141
1142 msg.append(", classNameId=");
1143 msg.append(classNameId);
1144
1145 msg.append(", classPK=");
1146 msg.append(classPK);
1147
1148 msg.append(StringPool.CLOSE_CURLY_BRACE);
1149
1150 if (_log.isWarnEnabled()) {
1151 _log.warn(msg.toString());
1152 }
1153
1154 throw new NoSuchPasswordPolicyRelException(msg.toString());
1155 }
1156
1157 return passwordPolicyRel;
1158 }
1159
1160
1169 public PasswordPolicyRel fetchByP_C_C(long passwordPolicyId,
1170 long classNameId, long classPK) throws SystemException {
1171 return fetchByP_C_C(passwordPolicyId, classNameId, classPK, true);
1172 }
1173
1174
1184 public PasswordPolicyRel fetchByP_C_C(long passwordPolicyId,
1185 long classNameId, long classPK, boolean retrieveFromCache)
1186 throws SystemException {
1187 Object[] finderArgs = new Object[] {
1188 passwordPolicyId, classNameId, classPK
1189 };
1190
1191 Object result = null;
1192
1193 if (retrieveFromCache) {
1194 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_P_C_C,
1195 finderArgs, this);
1196 }
1197
1198 if (result instanceof PasswordPolicyRel) {
1199 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)result;
1200
1201 if ((passwordPolicyId != passwordPolicyRel.getPasswordPolicyId()) ||
1202 (classNameId != passwordPolicyRel.getClassNameId()) ||
1203 (classPK != passwordPolicyRel.getClassPK())) {
1204 result = null;
1205 }
1206 }
1207
1208 if (result == null) {
1209 StringBundler query = new StringBundler(4);
1210
1211 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
1212
1213 query.append(_FINDER_COLUMN_P_C_C_PASSWORDPOLICYID_2);
1214
1215 query.append(_FINDER_COLUMN_P_C_C_CLASSNAMEID_2);
1216
1217 query.append(_FINDER_COLUMN_P_C_C_CLASSPK_2);
1218
1219 String sql = query.toString();
1220
1221 Session session = null;
1222
1223 try {
1224 session = openSession();
1225
1226 Query q = session.createQuery(sql);
1227
1228 QueryPos qPos = QueryPos.getInstance(q);
1229
1230 qPos.add(passwordPolicyId);
1231
1232 qPos.add(classNameId);
1233
1234 qPos.add(classPK);
1235
1236 List<PasswordPolicyRel> list = q.list();
1237
1238 result = list;
1239
1240 PasswordPolicyRel passwordPolicyRel = null;
1241
1242 if (list.isEmpty()) {
1243 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C,
1244 finderArgs, list);
1245 }
1246 else {
1247 passwordPolicyRel = list.get(0);
1248
1249 cacheResult(passwordPolicyRel);
1250
1251 if ((passwordPolicyRel.getPasswordPolicyId() != passwordPolicyId) ||
1252 (passwordPolicyRel.getClassNameId() != classNameId) ||
1253 (passwordPolicyRel.getClassPK() != classPK)) {
1254 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C,
1255 finderArgs, passwordPolicyRel);
1256 }
1257 }
1258
1259 return passwordPolicyRel;
1260 }
1261 catch (Exception e) {
1262 throw processException(e);
1263 }
1264 finally {
1265 if (result == null) {
1266 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_C_C,
1267 finderArgs);
1268 }
1269
1270 closeSession(session);
1271 }
1272 }
1273 else {
1274 if (result instanceof List<?>) {
1275 return null;
1276 }
1277 else {
1278 return (PasswordPolicyRel)result;
1279 }
1280 }
1281 }
1282
1283
1289 public List<PasswordPolicyRel> findAll() throws SystemException {
1290 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1291 }
1292
1293
1305 public List<PasswordPolicyRel> findAll(int start, int end)
1306 throws SystemException {
1307 return findAll(start, end, null);
1308 }
1309
1310
1323 public List<PasswordPolicyRel> findAll(int start, int end,
1324 OrderByComparator orderByComparator) throws SystemException {
1325 FinderPath finderPath = null;
1326 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1327
1328 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1329 (orderByComparator == null)) {
1330 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1331 finderArgs = FINDER_ARGS_EMPTY;
1332 }
1333 else {
1334 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1335 finderArgs = new Object[] { start, end, orderByComparator };
1336 }
1337
1338 List<PasswordPolicyRel> list = (List<PasswordPolicyRel>)FinderCacheUtil.getResult(finderPath,
1339 finderArgs, this);
1340
1341 if (list == null) {
1342 StringBundler query = null;
1343 String sql = null;
1344
1345 if (orderByComparator != null) {
1346 query = new StringBundler(2 +
1347 (orderByComparator.getOrderByFields().length * 3));
1348
1349 query.append(_SQL_SELECT_PASSWORDPOLICYREL);
1350
1351 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1352 orderByComparator);
1353
1354 sql = query.toString();
1355 }
1356 else {
1357 sql = _SQL_SELECT_PASSWORDPOLICYREL;
1358 }
1359
1360 Session session = null;
1361
1362 try {
1363 session = openSession();
1364
1365 Query q = session.createQuery(sql);
1366
1367 if (orderByComparator == null) {
1368 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
1369 getDialect(), start, end, false);
1370
1371 Collections.sort(list);
1372 }
1373 else {
1374 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
1375 getDialect(), start, end);
1376 }
1377 }
1378 catch (Exception e) {
1379 throw processException(e);
1380 }
1381 finally {
1382 if (list == null) {
1383 FinderCacheUtil.removeResult(finderPath, finderArgs);
1384 }
1385 else {
1386 cacheResult(list);
1387
1388 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1389 }
1390
1391 closeSession(session);
1392 }
1393 }
1394
1395 return list;
1396 }
1397
1398
1404 public void removeByPasswordPolicyId(long passwordPolicyId)
1405 throws SystemException {
1406 for (PasswordPolicyRel passwordPolicyRel : findByPasswordPolicyId(
1407 passwordPolicyId)) {
1408 remove(passwordPolicyRel);
1409 }
1410 }
1411
1412
1420 public PasswordPolicyRel removeByC_C(long classNameId, long classPK)
1421 throws NoSuchPasswordPolicyRelException, SystemException {
1422 PasswordPolicyRel passwordPolicyRel = findByC_C(classNameId, classPK);
1423
1424 return remove(passwordPolicyRel);
1425 }
1426
1427
1436 public PasswordPolicyRel removeByP_C_C(long passwordPolicyId,
1437 long classNameId, long classPK)
1438 throws NoSuchPasswordPolicyRelException, SystemException {
1439 PasswordPolicyRel passwordPolicyRel = findByP_C_C(passwordPolicyId,
1440 classNameId, classPK);
1441
1442 return remove(passwordPolicyRel);
1443 }
1444
1445
1450 public void removeAll() throws SystemException {
1451 for (PasswordPolicyRel passwordPolicyRel : findAll()) {
1452 remove(passwordPolicyRel);
1453 }
1454 }
1455
1456
1463 public int countByPasswordPolicyId(long passwordPolicyId)
1464 throws SystemException {
1465 Object[] finderArgs = new Object[] { passwordPolicyId };
1466
1467 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
1468 finderArgs, this);
1469
1470 if (count == null) {
1471 StringBundler query = new StringBundler(2);
1472
1473 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
1474
1475 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
1476
1477 String sql = query.toString();
1478
1479 Session session = null;
1480
1481 try {
1482 session = openSession();
1483
1484 Query q = session.createQuery(sql);
1485
1486 QueryPos qPos = QueryPos.getInstance(q);
1487
1488 qPos.add(passwordPolicyId);
1489
1490 count = (Long)q.uniqueResult();
1491 }
1492 catch (Exception e) {
1493 throw processException(e);
1494 }
1495 finally {
1496 if (count == null) {
1497 count = Long.valueOf(0);
1498 }
1499
1500 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
1501 finderArgs, count);
1502
1503 closeSession(session);
1504 }
1505 }
1506
1507 return count.intValue();
1508 }
1509
1510
1518 public int countByC_C(long classNameId, long classPK)
1519 throws SystemException {
1520 Object[] finderArgs = new Object[] { classNameId, classPK };
1521
1522 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
1523 finderArgs, this);
1524
1525 if (count == null) {
1526 StringBundler query = new StringBundler(3);
1527
1528 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
1529
1530 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1531
1532 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1533
1534 String sql = query.toString();
1535
1536 Session session = null;
1537
1538 try {
1539 session = openSession();
1540
1541 Query q = session.createQuery(sql);
1542
1543 QueryPos qPos = QueryPos.getInstance(q);
1544
1545 qPos.add(classNameId);
1546
1547 qPos.add(classPK);
1548
1549 count = (Long)q.uniqueResult();
1550 }
1551 catch (Exception e) {
1552 throw processException(e);
1553 }
1554 finally {
1555 if (count == null) {
1556 count = Long.valueOf(0);
1557 }
1558
1559 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
1560 count);
1561
1562 closeSession(session);
1563 }
1564 }
1565
1566 return count.intValue();
1567 }
1568
1569
1578 public int countByP_C_C(long passwordPolicyId, long classNameId,
1579 long classPK) throws SystemException {
1580 Object[] finderArgs = new Object[] {
1581 passwordPolicyId, classNameId, classPK
1582 };
1583
1584 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_C_C,
1585 finderArgs, this);
1586
1587 if (count == null) {
1588 StringBundler query = new StringBundler(4);
1589
1590 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
1591
1592 query.append(_FINDER_COLUMN_P_C_C_PASSWORDPOLICYID_2);
1593
1594 query.append(_FINDER_COLUMN_P_C_C_CLASSNAMEID_2);
1595
1596 query.append(_FINDER_COLUMN_P_C_C_CLASSPK_2);
1597
1598 String sql = query.toString();
1599
1600 Session session = null;
1601
1602 try {
1603 session = openSession();
1604
1605 Query q = session.createQuery(sql);
1606
1607 QueryPos qPos = QueryPos.getInstance(q);
1608
1609 qPos.add(passwordPolicyId);
1610
1611 qPos.add(classNameId);
1612
1613 qPos.add(classPK);
1614
1615 count = (Long)q.uniqueResult();
1616 }
1617 catch (Exception e) {
1618 throw processException(e);
1619 }
1620 finally {
1621 if (count == null) {
1622 count = Long.valueOf(0);
1623 }
1624
1625 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_C_C,
1626 finderArgs, count);
1627
1628 closeSession(session);
1629 }
1630 }
1631
1632 return count.intValue();
1633 }
1634
1635
1641 public int countAll() throws SystemException {
1642 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1643 FINDER_ARGS_EMPTY, this);
1644
1645 if (count == null) {
1646 Session session = null;
1647
1648 try {
1649 session = openSession();
1650
1651 Query q = session.createQuery(_SQL_COUNT_PASSWORDPOLICYREL);
1652
1653 count = (Long)q.uniqueResult();
1654 }
1655 catch (Exception e) {
1656 throw processException(e);
1657 }
1658 finally {
1659 if (count == null) {
1660 count = Long.valueOf(0);
1661 }
1662
1663 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1664 FINDER_ARGS_EMPTY, count);
1665
1666 closeSession(session);
1667 }
1668 }
1669
1670 return count.intValue();
1671 }
1672
1673
1676 public void afterPropertiesSet() {
1677 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1678 com.liferay.portal.util.PropsUtil.get(
1679 "value.object.listener.com.liferay.portal.model.PasswordPolicyRel")));
1680
1681 if (listenerClassNames.length > 0) {
1682 try {
1683 List<ModelListener<PasswordPolicyRel>> listenersList = new ArrayList<ModelListener<PasswordPolicyRel>>();
1684
1685 for (String listenerClassName : listenerClassNames) {
1686 listenersList.add((ModelListener<PasswordPolicyRel>)InstanceFactory.newInstance(
1687 listenerClassName));
1688 }
1689
1690 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1691 }
1692 catch (Exception e) {
1693 _log.error(e);
1694 }
1695 }
1696 }
1697
1698 public void destroy() {
1699 EntityCacheUtil.removeCache(PasswordPolicyRelImpl.class.getName());
1700 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1701 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1702 }
1703
1704 @BeanReference(type = AccountPersistence.class)
1705 protected AccountPersistence accountPersistence;
1706 @BeanReference(type = AddressPersistence.class)
1707 protected AddressPersistence addressPersistence;
1708 @BeanReference(type = BrowserTrackerPersistence.class)
1709 protected BrowserTrackerPersistence browserTrackerPersistence;
1710 @BeanReference(type = ClassNamePersistence.class)
1711 protected ClassNamePersistence classNamePersistence;
1712 @BeanReference(type = ClusterGroupPersistence.class)
1713 protected ClusterGroupPersistence clusterGroupPersistence;
1714 @BeanReference(type = CompanyPersistence.class)
1715 protected CompanyPersistence companyPersistence;
1716 @BeanReference(type = ContactPersistence.class)
1717 protected ContactPersistence contactPersistence;
1718 @BeanReference(type = CountryPersistence.class)
1719 protected CountryPersistence countryPersistence;
1720 @BeanReference(type = EmailAddressPersistence.class)
1721 protected EmailAddressPersistence emailAddressPersistence;
1722 @BeanReference(type = GroupPersistence.class)
1723 protected GroupPersistence groupPersistence;
1724 @BeanReference(type = ImagePersistence.class)
1725 protected ImagePersistence imagePersistence;
1726 @BeanReference(type = LayoutPersistence.class)
1727 protected LayoutPersistence layoutPersistence;
1728 @BeanReference(type = LayoutBranchPersistence.class)
1729 protected LayoutBranchPersistence layoutBranchPersistence;
1730 @BeanReference(type = LayoutPrototypePersistence.class)
1731 protected LayoutPrototypePersistence layoutPrototypePersistence;
1732 @BeanReference(type = LayoutRevisionPersistence.class)
1733 protected LayoutRevisionPersistence layoutRevisionPersistence;
1734 @BeanReference(type = LayoutSetPersistence.class)
1735 protected LayoutSetPersistence layoutSetPersistence;
1736 @BeanReference(type = LayoutSetBranchPersistence.class)
1737 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1738 @BeanReference(type = LayoutSetPrototypePersistence.class)
1739 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1740 @BeanReference(type = ListTypePersistence.class)
1741 protected ListTypePersistence listTypePersistence;
1742 @BeanReference(type = LockPersistence.class)
1743 protected LockPersistence lockPersistence;
1744 @BeanReference(type = MembershipRequestPersistence.class)
1745 protected MembershipRequestPersistence membershipRequestPersistence;
1746 @BeanReference(type = OrganizationPersistence.class)
1747 protected OrganizationPersistence organizationPersistence;
1748 @BeanReference(type = OrgGroupRolePersistence.class)
1749 protected OrgGroupRolePersistence orgGroupRolePersistence;
1750 @BeanReference(type = OrgLaborPersistence.class)
1751 protected OrgLaborPersistence orgLaborPersistence;
1752 @BeanReference(type = PasswordPolicyPersistence.class)
1753 protected PasswordPolicyPersistence passwordPolicyPersistence;
1754 @BeanReference(type = PasswordPolicyRelPersistence.class)
1755 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1756 @BeanReference(type = PasswordTrackerPersistence.class)
1757 protected PasswordTrackerPersistence passwordTrackerPersistence;
1758 @BeanReference(type = PhonePersistence.class)
1759 protected PhonePersistence phonePersistence;
1760 @BeanReference(type = PluginSettingPersistence.class)
1761 protected PluginSettingPersistence pluginSettingPersistence;
1762 @BeanReference(type = PortalPreferencesPersistence.class)
1763 protected PortalPreferencesPersistence portalPreferencesPersistence;
1764 @BeanReference(type = PortletPersistence.class)
1765 protected PortletPersistence portletPersistence;
1766 @BeanReference(type = PortletItemPersistence.class)
1767 protected PortletItemPersistence portletItemPersistence;
1768 @BeanReference(type = PortletPreferencesPersistence.class)
1769 protected PortletPreferencesPersistence portletPreferencesPersistence;
1770 @BeanReference(type = RegionPersistence.class)
1771 protected RegionPersistence regionPersistence;
1772 @BeanReference(type = ReleasePersistence.class)
1773 protected ReleasePersistence releasePersistence;
1774 @BeanReference(type = RepositoryPersistence.class)
1775 protected RepositoryPersistence repositoryPersistence;
1776 @BeanReference(type = RepositoryEntryPersistence.class)
1777 protected RepositoryEntryPersistence repositoryEntryPersistence;
1778 @BeanReference(type = ResourceActionPersistence.class)
1779 protected ResourceActionPersistence resourceActionPersistence;
1780 @BeanReference(type = ResourceBlockPersistence.class)
1781 protected ResourceBlockPersistence resourceBlockPersistence;
1782 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1783 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1784 @BeanReference(type = ResourcePermissionPersistence.class)
1785 protected ResourcePermissionPersistence resourcePermissionPersistence;
1786 @BeanReference(type = ResourceTypePermissionPersistence.class)
1787 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1788 @BeanReference(type = RolePersistence.class)
1789 protected RolePersistence rolePersistence;
1790 @BeanReference(type = ServiceComponentPersistence.class)
1791 protected ServiceComponentPersistence serviceComponentPersistence;
1792 @BeanReference(type = ShardPersistence.class)
1793 protected ShardPersistence shardPersistence;
1794 @BeanReference(type = SubscriptionPersistence.class)
1795 protected SubscriptionPersistence subscriptionPersistence;
1796 @BeanReference(type = TeamPersistence.class)
1797 protected TeamPersistence teamPersistence;
1798 @BeanReference(type = TicketPersistence.class)
1799 protected TicketPersistence ticketPersistence;
1800 @BeanReference(type = UserPersistence.class)
1801 protected UserPersistence userPersistence;
1802 @BeanReference(type = UserGroupPersistence.class)
1803 protected UserGroupPersistence userGroupPersistence;
1804 @BeanReference(type = UserGroupGroupRolePersistence.class)
1805 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1806 @BeanReference(type = UserGroupRolePersistence.class)
1807 protected UserGroupRolePersistence userGroupRolePersistence;
1808 @BeanReference(type = UserIdMapperPersistence.class)
1809 protected UserIdMapperPersistence userIdMapperPersistence;
1810 @BeanReference(type = UserNotificationEventPersistence.class)
1811 protected UserNotificationEventPersistence userNotificationEventPersistence;
1812 @BeanReference(type = UserTrackerPersistence.class)
1813 protected UserTrackerPersistence userTrackerPersistence;
1814 @BeanReference(type = UserTrackerPathPersistence.class)
1815 protected UserTrackerPathPersistence userTrackerPathPersistence;
1816 @BeanReference(type = VirtualHostPersistence.class)
1817 protected VirtualHostPersistence virtualHostPersistence;
1818 @BeanReference(type = WebDAVPropsPersistence.class)
1819 protected WebDAVPropsPersistence webDAVPropsPersistence;
1820 @BeanReference(type = WebsitePersistence.class)
1821 protected WebsitePersistence websitePersistence;
1822 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1823 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1824 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1825 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1826 private static final String _SQL_SELECT_PASSWORDPOLICYREL = "SELECT passwordPolicyRel FROM PasswordPolicyRel passwordPolicyRel";
1827 private static final String _SQL_SELECT_PASSWORDPOLICYREL_WHERE = "SELECT passwordPolicyRel FROM PasswordPolicyRel passwordPolicyRel WHERE ";
1828 private static final String _SQL_COUNT_PASSWORDPOLICYREL = "SELECT COUNT(passwordPolicyRel) FROM PasswordPolicyRel passwordPolicyRel";
1829 private static final String _SQL_COUNT_PASSWORDPOLICYREL_WHERE = "SELECT COUNT(passwordPolicyRel) FROM PasswordPolicyRel passwordPolicyRel WHERE ";
1830 private static final String _FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2 =
1831 "passwordPolicyRel.passwordPolicyId = ?";
1832 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "passwordPolicyRel.classNameId = ? AND ";
1833 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "passwordPolicyRel.classPK = ?";
1834 private static final String _FINDER_COLUMN_P_C_C_PASSWORDPOLICYID_2 = "passwordPolicyRel.passwordPolicyId = ? AND ";
1835 private static final String _FINDER_COLUMN_P_C_C_CLASSNAMEID_2 = "passwordPolicyRel.classNameId = ? AND ";
1836 private static final String _FINDER_COLUMN_P_C_C_CLASSPK_2 = "passwordPolicyRel.classPK = ?";
1837 private static final String _ORDER_BY_ENTITY_ALIAS = "passwordPolicyRel.";
1838 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordPolicyRel exists with the primary key ";
1839 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordPolicyRel exists with the key {";
1840 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1841 private static Log _log = LogFactoryUtil.getLog(PasswordPolicyRelPersistenceImpl.class);
1842 private static PasswordPolicyRel _nullPasswordPolicyRel = new PasswordPolicyRelImpl() {
1843 @Override
1844 public Object clone() {
1845 return this;
1846 }
1847
1848 @Override
1849 public CacheModel<PasswordPolicyRel> toCacheModel() {
1850 return _nullPasswordPolicyRelCacheModel;
1851 }
1852 };
1853
1854 private static CacheModel<PasswordPolicyRel> _nullPasswordPolicyRelCacheModel =
1855 new CacheModel<PasswordPolicyRel>() {
1856 public PasswordPolicyRel toEntityModel() {
1857 return _nullPasswordPolicyRel;
1858 }
1859 };
1860 }