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 cacheUniqueFindersCache(PasswordPolicyRel passwordPolicyRel) {
232 if (passwordPolicyRel.isNew()) {
233 Object[] args = new Object[] {
234 Long.valueOf(passwordPolicyRel.getClassNameId()),
235 Long.valueOf(passwordPolicyRel.getClassPK())
236 };
237
238 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args,
239 Long.valueOf(1));
240 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args,
241 passwordPolicyRel);
242
243 args = new Object[] {
244 Long.valueOf(passwordPolicyRel.getPasswordPolicyId()),
245 Long.valueOf(passwordPolicyRel.getClassNameId()),
246 Long.valueOf(passwordPolicyRel.getClassPK())
247 };
248
249 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_C_C, args,
250 Long.valueOf(1));
251 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C, args,
252 passwordPolicyRel);
253 }
254 else {
255 PasswordPolicyRelModelImpl passwordPolicyRelModelImpl = (PasswordPolicyRelModelImpl)passwordPolicyRel;
256
257 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
258 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
259 Object[] args = new Object[] {
260 Long.valueOf(passwordPolicyRel.getClassNameId()),
261 Long.valueOf(passwordPolicyRel.getClassPK())
262 };
263
264 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args,
265 Long.valueOf(1));
266 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args,
267 passwordPolicyRel);
268 }
269
270 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
271 FINDER_PATH_FETCH_BY_P_C_C.getColumnBitmask()) != 0) {
272 Object[] args = new Object[] {
273 Long.valueOf(passwordPolicyRel.getPasswordPolicyId()),
274 Long.valueOf(passwordPolicyRel.getClassNameId()),
275 Long.valueOf(passwordPolicyRel.getClassPK())
276 };
277
278 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_C_C, args,
279 Long.valueOf(1));
280 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C, args,
281 passwordPolicyRel);
282 }
283 }
284 }
285
286 protected void clearUniqueFindersCache(PasswordPolicyRel passwordPolicyRel) {
287 PasswordPolicyRelModelImpl passwordPolicyRelModelImpl = (PasswordPolicyRelModelImpl)passwordPolicyRel;
288
289 Object[] args = new Object[] {
290 Long.valueOf(passwordPolicyRel.getClassNameId()),
291 Long.valueOf(passwordPolicyRel.getClassPK())
292 };
293
294 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
295 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
296
297 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
298 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
299 args = new Object[] {
300 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassNameId()),
301 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassPK())
302 };
303
304 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
305 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
306 }
307
308 args = new Object[] {
309 Long.valueOf(passwordPolicyRel.getPasswordPolicyId()),
310 Long.valueOf(passwordPolicyRel.getClassNameId()),
311 Long.valueOf(passwordPolicyRel.getClassPK())
312 };
313
314 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_C_C, args);
315 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_C_C, args);
316
317 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
318 FINDER_PATH_FETCH_BY_P_C_C.getColumnBitmask()) != 0) {
319 args = new Object[] {
320 Long.valueOf(passwordPolicyRelModelImpl.getOriginalPasswordPolicyId()),
321 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassNameId()),
322 Long.valueOf(passwordPolicyRelModelImpl.getOriginalClassPK())
323 };
324
325 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_C_C, args);
326 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_C_C, args);
327 }
328 }
329
330
336 public PasswordPolicyRel create(long passwordPolicyRelId) {
337 PasswordPolicyRel passwordPolicyRel = new PasswordPolicyRelImpl();
338
339 passwordPolicyRel.setNew(true);
340 passwordPolicyRel.setPrimaryKey(passwordPolicyRelId);
341
342 return passwordPolicyRel;
343 }
344
345
353 public PasswordPolicyRel remove(long passwordPolicyRelId)
354 throws NoSuchPasswordPolicyRelException, SystemException {
355 return remove(Long.valueOf(passwordPolicyRelId));
356 }
357
358
366 @Override
367 public PasswordPolicyRel remove(Serializable primaryKey)
368 throws NoSuchPasswordPolicyRelException, SystemException {
369 Session session = null;
370
371 try {
372 session = openSession();
373
374 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
375 primaryKey);
376
377 if (passwordPolicyRel == null) {
378 if (_log.isWarnEnabled()) {
379 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
380 }
381
382 throw new NoSuchPasswordPolicyRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
383 primaryKey);
384 }
385
386 return remove(passwordPolicyRel);
387 }
388 catch (NoSuchPasswordPolicyRelException nsee) {
389 throw nsee;
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 closeSession(session);
396 }
397 }
398
399 @Override
400 protected PasswordPolicyRel removeImpl(PasswordPolicyRel passwordPolicyRel)
401 throws SystemException {
402 passwordPolicyRel = toUnwrappedModel(passwordPolicyRel);
403
404 Session session = null;
405
406 try {
407 session = openSession();
408
409 BatchSessionUtil.delete(session, passwordPolicyRel);
410 }
411 catch (Exception e) {
412 throw processException(e);
413 }
414 finally {
415 closeSession(session);
416 }
417
418 clearCache(passwordPolicyRel);
419
420 return passwordPolicyRel;
421 }
422
423 @Override
424 public PasswordPolicyRel updateImpl(
425 com.liferay.portal.model.PasswordPolicyRel passwordPolicyRel,
426 boolean merge) throws SystemException {
427 passwordPolicyRel = toUnwrappedModel(passwordPolicyRel);
428
429 boolean isNew = passwordPolicyRel.isNew();
430
431 PasswordPolicyRelModelImpl passwordPolicyRelModelImpl = (PasswordPolicyRelModelImpl)passwordPolicyRel;
432
433 Session session = null;
434
435 try {
436 session = openSession();
437
438 BatchSessionUtil.update(session, passwordPolicyRel, merge);
439
440 passwordPolicyRel.setNew(false);
441 }
442 catch (Exception e) {
443 throw processException(e);
444 }
445 finally {
446 closeSession(session);
447 }
448
449 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
450
451 if (isNew || !PasswordPolicyRelModelImpl.COLUMN_BITMASK_ENABLED) {
452 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
453 }
454
455 else {
456 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
457 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID.getColumnBitmask()) != 0) {
458 Object[] args = new Object[] {
459 Long.valueOf(passwordPolicyRelModelImpl.getOriginalPasswordPolicyId())
460 };
461
462 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
463 args);
464 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID,
465 args);
466
467 args = new Object[] {
468 Long.valueOf(passwordPolicyRelModelImpl.getPasswordPolicyId())
469 };
470
471 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
472 args);
473 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID,
474 args);
475 }
476 }
477
478 EntityCacheUtil.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
479 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey(),
480 passwordPolicyRel);
481
482 clearUniqueFindersCache(passwordPolicyRel);
483 cacheUniqueFindersCache(passwordPolicyRel);
484
485 return passwordPolicyRel;
486 }
487
488 protected PasswordPolicyRel toUnwrappedModel(
489 PasswordPolicyRel passwordPolicyRel) {
490 if (passwordPolicyRel instanceof PasswordPolicyRelImpl) {
491 return passwordPolicyRel;
492 }
493
494 PasswordPolicyRelImpl passwordPolicyRelImpl = new PasswordPolicyRelImpl();
495
496 passwordPolicyRelImpl.setNew(passwordPolicyRel.isNew());
497 passwordPolicyRelImpl.setPrimaryKey(passwordPolicyRel.getPrimaryKey());
498
499 passwordPolicyRelImpl.setPasswordPolicyRelId(passwordPolicyRel.getPasswordPolicyRelId());
500 passwordPolicyRelImpl.setPasswordPolicyId(passwordPolicyRel.getPasswordPolicyId());
501 passwordPolicyRelImpl.setClassNameId(passwordPolicyRel.getClassNameId());
502 passwordPolicyRelImpl.setClassPK(passwordPolicyRel.getClassPK());
503
504 return passwordPolicyRelImpl;
505 }
506
507
515 @Override
516 public PasswordPolicyRel findByPrimaryKey(Serializable primaryKey)
517 throws NoSuchModelException, SystemException {
518 return findByPrimaryKey(((Long)primaryKey).longValue());
519 }
520
521
529 public PasswordPolicyRel findByPrimaryKey(long passwordPolicyRelId)
530 throws NoSuchPasswordPolicyRelException, SystemException {
531 PasswordPolicyRel passwordPolicyRel = fetchByPrimaryKey(passwordPolicyRelId);
532
533 if (passwordPolicyRel == null) {
534 if (_log.isWarnEnabled()) {
535 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
536 passwordPolicyRelId);
537 }
538
539 throw new NoSuchPasswordPolicyRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
540 passwordPolicyRelId);
541 }
542
543 return passwordPolicyRel;
544 }
545
546
553 @Override
554 public PasswordPolicyRel fetchByPrimaryKey(Serializable primaryKey)
555 throws SystemException {
556 return fetchByPrimaryKey(((Long)primaryKey).longValue());
557 }
558
559
566 public PasswordPolicyRel fetchByPrimaryKey(long passwordPolicyRelId)
567 throws SystemException {
568 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)EntityCacheUtil.getResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
569 PasswordPolicyRelImpl.class, passwordPolicyRelId);
570
571 if (passwordPolicyRel == _nullPasswordPolicyRel) {
572 return null;
573 }
574
575 if (passwordPolicyRel == null) {
576 Session session = null;
577
578 boolean hasException = false;
579
580 try {
581 session = openSession();
582
583 passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
584 Long.valueOf(passwordPolicyRelId));
585 }
586 catch (Exception e) {
587 hasException = true;
588
589 throw processException(e);
590 }
591 finally {
592 if (passwordPolicyRel != null) {
593 cacheResult(passwordPolicyRel);
594 }
595 else if (!hasException) {
596 EntityCacheUtil.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
597 PasswordPolicyRelImpl.class, passwordPolicyRelId,
598 _nullPasswordPolicyRel);
599 }
600
601 closeSession(session);
602 }
603 }
604
605 return passwordPolicyRel;
606 }
607
608
615 public List<PasswordPolicyRel> findByPasswordPolicyId(long passwordPolicyId)
616 throws SystemException {
617 return findByPasswordPolicyId(passwordPolicyId, QueryUtil.ALL_POS,
618 QueryUtil.ALL_POS, null);
619 }
620
621
634 public List<PasswordPolicyRel> findByPasswordPolicyId(
635 long passwordPolicyId, int start, int end) throws SystemException {
636 return findByPasswordPolicyId(passwordPolicyId, start, end, null);
637 }
638
639
653 public List<PasswordPolicyRel> findByPasswordPolicyId(
654 long passwordPolicyId, int start, int end,
655 OrderByComparator orderByComparator) throws SystemException {
656 FinderPath finderPath = null;
657 Object[] finderArgs = null;
658
659 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
660 (orderByComparator == null)) {
661 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID;
662 finderArgs = new Object[] { passwordPolicyId };
663 }
664 else {
665 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PASSWORDPOLICYID;
666 finderArgs = new Object[] {
667 passwordPolicyId,
668
669 start, end, orderByComparator
670 };
671 }
672
673 List<PasswordPolicyRel> list = (List<PasswordPolicyRel>)FinderCacheUtil.getResult(finderPath,
674 finderArgs, this);
675
676 if ((list != null) && !list.isEmpty()) {
677 for (PasswordPolicyRel passwordPolicyRel : list) {
678 if ((passwordPolicyId != passwordPolicyRel.getPasswordPolicyId())) {
679 list = null;
680
681 break;
682 }
683 }
684 }
685
686 if (list == null) {
687 StringBundler query = null;
688
689 if (orderByComparator != null) {
690 query = new StringBundler(3 +
691 (orderByComparator.getOrderByFields().length * 3));
692 }
693 else {
694 query = new StringBundler(2);
695 }
696
697 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
698
699 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
700
701 if (orderByComparator != null) {
702 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
703 orderByComparator);
704 }
705
706 String sql = query.toString();
707
708 Session session = null;
709
710 try {
711 session = openSession();
712
713 Query q = session.createQuery(sql);
714
715 QueryPos qPos = QueryPos.getInstance(q);
716
717 qPos.add(passwordPolicyId);
718
719 list = (List<PasswordPolicyRel>)QueryUtil.list(q, getDialect(),
720 start, end);
721 }
722 catch (Exception e) {
723 throw processException(e);
724 }
725 finally {
726 if (list == null) {
727 FinderCacheUtil.removeResult(finderPath, finderArgs);
728 }
729 else {
730 cacheResult(list);
731
732 FinderCacheUtil.putResult(finderPath, finderArgs, list);
733 }
734
735 closeSession(session);
736 }
737 }
738
739 return list;
740 }
741
742
751 public PasswordPolicyRel findByPasswordPolicyId_First(
752 long passwordPolicyId, OrderByComparator orderByComparator)
753 throws NoSuchPasswordPolicyRelException, SystemException {
754 PasswordPolicyRel passwordPolicyRel = fetchByPasswordPolicyId_First(passwordPolicyId,
755 orderByComparator);
756
757 if (passwordPolicyRel != null) {
758 return passwordPolicyRel;
759 }
760
761 StringBundler msg = new StringBundler(4);
762
763 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
764
765 msg.append("passwordPolicyId=");
766 msg.append(passwordPolicyId);
767
768 msg.append(StringPool.CLOSE_CURLY_BRACE);
769
770 throw new NoSuchPasswordPolicyRelException(msg.toString());
771 }
772
773
781 public PasswordPolicyRel fetchByPasswordPolicyId_First(
782 long passwordPolicyId, OrderByComparator orderByComparator)
783 throws SystemException {
784 List<PasswordPolicyRel> list = findByPasswordPolicyId(passwordPolicyId,
785 0, 1, orderByComparator);
786
787 if (!list.isEmpty()) {
788 return list.get(0);
789 }
790
791 return null;
792 }
793
794
803 public PasswordPolicyRel findByPasswordPolicyId_Last(
804 long passwordPolicyId, OrderByComparator orderByComparator)
805 throws NoSuchPasswordPolicyRelException, SystemException {
806 PasswordPolicyRel passwordPolicyRel = fetchByPasswordPolicyId_Last(passwordPolicyId,
807 orderByComparator);
808
809 if (passwordPolicyRel != null) {
810 return passwordPolicyRel;
811 }
812
813 StringBundler msg = new StringBundler(4);
814
815 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
816
817 msg.append("passwordPolicyId=");
818 msg.append(passwordPolicyId);
819
820 msg.append(StringPool.CLOSE_CURLY_BRACE);
821
822 throw new NoSuchPasswordPolicyRelException(msg.toString());
823 }
824
825
833 public PasswordPolicyRel fetchByPasswordPolicyId_Last(
834 long passwordPolicyId, OrderByComparator orderByComparator)
835 throws SystemException {
836 int count = countByPasswordPolicyId(passwordPolicyId);
837
838 List<PasswordPolicyRel> list = findByPasswordPolicyId(passwordPolicyId,
839 count - 1, count, orderByComparator);
840
841 if (!list.isEmpty()) {
842 return list.get(0);
843 }
844
845 return null;
846 }
847
848
858 public PasswordPolicyRel[] findByPasswordPolicyId_PrevAndNext(
859 long passwordPolicyRelId, long passwordPolicyId,
860 OrderByComparator orderByComparator)
861 throws NoSuchPasswordPolicyRelException, SystemException {
862 PasswordPolicyRel passwordPolicyRel = findByPrimaryKey(passwordPolicyRelId);
863
864 Session session = null;
865
866 try {
867 session = openSession();
868
869 PasswordPolicyRel[] array = new PasswordPolicyRelImpl[3];
870
871 array[0] = getByPasswordPolicyId_PrevAndNext(session,
872 passwordPolicyRel, passwordPolicyId, orderByComparator, true);
873
874 array[1] = passwordPolicyRel;
875
876 array[2] = getByPasswordPolicyId_PrevAndNext(session,
877 passwordPolicyRel, passwordPolicyId, orderByComparator,
878 false);
879
880 return array;
881 }
882 catch (Exception e) {
883 throw processException(e);
884 }
885 finally {
886 closeSession(session);
887 }
888 }
889
890 protected PasswordPolicyRel getByPasswordPolicyId_PrevAndNext(
891 Session session, PasswordPolicyRel passwordPolicyRel,
892 long passwordPolicyId, OrderByComparator orderByComparator,
893 boolean previous) {
894 StringBundler query = null;
895
896 if (orderByComparator != null) {
897 query = new StringBundler(6 +
898 (orderByComparator.getOrderByFields().length * 6));
899 }
900 else {
901 query = new StringBundler(3);
902 }
903
904 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
905
906 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
907
908 if (orderByComparator != null) {
909 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
910
911 if (orderByConditionFields.length > 0) {
912 query.append(WHERE_AND);
913 }
914
915 for (int i = 0; i < orderByConditionFields.length; i++) {
916 query.append(_ORDER_BY_ENTITY_ALIAS);
917 query.append(orderByConditionFields[i]);
918
919 if ((i + 1) < orderByConditionFields.length) {
920 if (orderByComparator.isAscending() ^ previous) {
921 query.append(WHERE_GREATER_THAN_HAS_NEXT);
922 }
923 else {
924 query.append(WHERE_LESSER_THAN_HAS_NEXT);
925 }
926 }
927 else {
928 if (orderByComparator.isAscending() ^ previous) {
929 query.append(WHERE_GREATER_THAN);
930 }
931 else {
932 query.append(WHERE_LESSER_THAN);
933 }
934 }
935 }
936
937 query.append(ORDER_BY_CLAUSE);
938
939 String[] orderByFields = orderByComparator.getOrderByFields();
940
941 for (int i = 0; i < orderByFields.length; i++) {
942 query.append(_ORDER_BY_ENTITY_ALIAS);
943 query.append(orderByFields[i]);
944
945 if ((i + 1) < orderByFields.length) {
946 if (orderByComparator.isAscending() ^ previous) {
947 query.append(ORDER_BY_ASC_HAS_NEXT);
948 }
949 else {
950 query.append(ORDER_BY_DESC_HAS_NEXT);
951 }
952 }
953 else {
954 if (orderByComparator.isAscending() ^ previous) {
955 query.append(ORDER_BY_ASC);
956 }
957 else {
958 query.append(ORDER_BY_DESC);
959 }
960 }
961 }
962 }
963
964 String sql = query.toString();
965
966 Query q = session.createQuery(sql);
967
968 q.setFirstResult(0);
969 q.setMaxResults(2);
970
971 QueryPos qPos = QueryPos.getInstance(q);
972
973 qPos.add(passwordPolicyId);
974
975 if (orderByComparator != null) {
976 Object[] values = orderByComparator.getOrderByConditionValues(passwordPolicyRel);
977
978 for (Object value : values) {
979 qPos.add(value);
980 }
981 }
982
983 List<PasswordPolicyRel> list = q.list();
984
985 if (list.size() == 2) {
986 return list.get(1);
987 }
988 else {
989 return null;
990 }
991 }
992
993
1002 public PasswordPolicyRel findByC_C(long classNameId, long classPK)
1003 throws NoSuchPasswordPolicyRelException, SystemException {
1004 PasswordPolicyRel passwordPolicyRel = fetchByC_C(classNameId, classPK);
1005
1006 if (passwordPolicyRel == null) {
1007 StringBundler msg = new StringBundler(6);
1008
1009 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1010
1011 msg.append("classNameId=");
1012 msg.append(classNameId);
1013
1014 msg.append(", classPK=");
1015 msg.append(classPK);
1016
1017 msg.append(StringPool.CLOSE_CURLY_BRACE);
1018
1019 if (_log.isWarnEnabled()) {
1020 _log.warn(msg.toString());
1021 }
1022
1023 throw new NoSuchPasswordPolicyRelException(msg.toString());
1024 }
1025
1026 return passwordPolicyRel;
1027 }
1028
1029
1037 public PasswordPolicyRel fetchByC_C(long classNameId, long classPK)
1038 throws SystemException {
1039 return fetchByC_C(classNameId, classPK, true);
1040 }
1041
1042
1051 public PasswordPolicyRel fetchByC_C(long classNameId, long classPK,
1052 boolean retrieveFromCache) throws SystemException {
1053 Object[] finderArgs = new Object[] { classNameId, classPK };
1054
1055 Object result = null;
1056
1057 if (retrieveFromCache) {
1058 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
1059 finderArgs, this);
1060 }
1061
1062 if (result instanceof PasswordPolicyRel) {
1063 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)result;
1064
1065 if ((classNameId != passwordPolicyRel.getClassNameId()) ||
1066 (classPK != passwordPolicyRel.getClassPK())) {
1067 result = null;
1068 }
1069 }
1070
1071 if (result == null) {
1072 StringBundler query = new StringBundler(3);
1073
1074 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
1075
1076 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1077
1078 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1079
1080 String sql = query.toString();
1081
1082 Session session = null;
1083
1084 try {
1085 session = openSession();
1086
1087 Query q = session.createQuery(sql);
1088
1089 QueryPos qPos = QueryPos.getInstance(q);
1090
1091 qPos.add(classNameId);
1092
1093 qPos.add(classPK);
1094
1095 List<PasswordPolicyRel> list = q.list();
1096
1097 result = list;
1098
1099 PasswordPolicyRel passwordPolicyRel = null;
1100
1101 if (list.isEmpty()) {
1102 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1103 finderArgs, list);
1104 }
1105 else {
1106 passwordPolicyRel = list.get(0);
1107
1108 cacheResult(passwordPolicyRel);
1109
1110 if ((passwordPolicyRel.getClassNameId() != classNameId) ||
1111 (passwordPolicyRel.getClassPK() != classPK)) {
1112 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1113 finderArgs, passwordPolicyRel);
1114 }
1115 }
1116
1117 return passwordPolicyRel;
1118 }
1119 catch (Exception e) {
1120 throw processException(e);
1121 }
1122 finally {
1123 if (result == null) {
1124 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
1125 finderArgs);
1126 }
1127
1128 closeSession(session);
1129 }
1130 }
1131 else {
1132 if (result instanceof List<?>) {
1133 return null;
1134 }
1135 else {
1136 return (PasswordPolicyRel)result;
1137 }
1138 }
1139 }
1140
1141
1151 public PasswordPolicyRel findByP_C_C(long passwordPolicyId,
1152 long classNameId, long classPK)
1153 throws NoSuchPasswordPolicyRelException, SystemException {
1154 PasswordPolicyRel passwordPolicyRel = fetchByP_C_C(passwordPolicyId,
1155 classNameId, classPK);
1156
1157 if (passwordPolicyRel == null) {
1158 StringBundler msg = new StringBundler(8);
1159
1160 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1161
1162 msg.append("passwordPolicyId=");
1163 msg.append(passwordPolicyId);
1164
1165 msg.append(", classNameId=");
1166 msg.append(classNameId);
1167
1168 msg.append(", classPK=");
1169 msg.append(classPK);
1170
1171 msg.append(StringPool.CLOSE_CURLY_BRACE);
1172
1173 if (_log.isWarnEnabled()) {
1174 _log.warn(msg.toString());
1175 }
1176
1177 throw new NoSuchPasswordPolicyRelException(msg.toString());
1178 }
1179
1180 return passwordPolicyRel;
1181 }
1182
1183
1192 public PasswordPolicyRel fetchByP_C_C(long passwordPolicyId,
1193 long classNameId, long classPK) throws SystemException {
1194 return fetchByP_C_C(passwordPolicyId, classNameId, classPK, true);
1195 }
1196
1197
1207 public PasswordPolicyRel fetchByP_C_C(long passwordPolicyId,
1208 long classNameId, long classPK, boolean retrieveFromCache)
1209 throws SystemException {
1210 Object[] finderArgs = new Object[] {
1211 passwordPolicyId, classNameId, classPK
1212 };
1213
1214 Object result = null;
1215
1216 if (retrieveFromCache) {
1217 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_P_C_C,
1218 finderArgs, this);
1219 }
1220
1221 if (result instanceof PasswordPolicyRel) {
1222 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)result;
1223
1224 if ((passwordPolicyId != passwordPolicyRel.getPasswordPolicyId()) ||
1225 (classNameId != passwordPolicyRel.getClassNameId()) ||
1226 (classPK != passwordPolicyRel.getClassPK())) {
1227 result = null;
1228 }
1229 }
1230
1231 if (result == null) {
1232 StringBundler query = new StringBundler(4);
1233
1234 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
1235
1236 query.append(_FINDER_COLUMN_P_C_C_PASSWORDPOLICYID_2);
1237
1238 query.append(_FINDER_COLUMN_P_C_C_CLASSNAMEID_2);
1239
1240 query.append(_FINDER_COLUMN_P_C_C_CLASSPK_2);
1241
1242 String sql = query.toString();
1243
1244 Session session = null;
1245
1246 try {
1247 session = openSession();
1248
1249 Query q = session.createQuery(sql);
1250
1251 QueryPos qPos = QueryPos.getInstance(q);
1252
1253 qPos.add(passwordPolicyId);
1254
1255 qPos.add(classNameId);
1256
1257 qPos.add(classPK);
1258
1259 List<PasswordPolicyRel> list = q.list();
1260
1261 result = list;
1262
1263 PasswordPolicyRel passwordPolicyRel = null;
1264
1265 if (list.isEmpty()) {
1266 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C,
1267 finderArgs, list);
1268 }
1269 else {
1270 passwordPolicyRel = list.get(0);
1271
1272 cacheResult(passwordPolicyRel);
1273
1274 if ((passwordPolicyRel.getPasswordPolicyId() != passwordPolicyId) ||
1275 (passwordPolicyRel.getClassNameId() != classNameId) ||
1276 (passwordPolicyRel.getClassPK() != classPK)) {
1277 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_C_C,
1278 finderArgs, passwordPolicyRel);
1279 }
1280 }
1281
1282 return passwordPolicyRel;
1283 }
1284 catch (Exception e) {
1285 throw processException(e);
1286 }
1287 finally {
1288 if (result == null) {
1289 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_C_C,
1290 finderArgs);
1291 }
1292
1293 closeSession(session);
1294 }
1295 }
1296 else {
1297 if (result instanceof List<?>) {
1298 return null;
1299 }
1300 else {
1301 return (PasswordPolicyRel)result;
1302 }
1303 }
1304 }
1305
1306
1312 public List<PasswordPolicyRel> findAll() throws SystemException {
1313 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1314 }
1315
1316
1328 public List<PasswordPolicyRel> findAll(int start, int end)
1329 throws SystemException {
1330 return findAll(start, end, null);
1331 }
1332
1333
1346 public List<PasswordPolicyRel> findAll(int start, int end,
1347 OrderByComparator orderByComparator) throws SystemException {
1348 FinderPath finderPath = null;
1349 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1350
1351 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1352 (orderByComparator == null)) {
1353 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1354 finderArgs = FINDER_ARGS_EMPTY;
1355 }
1356 else {
1357 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1358 finderArgs = new Object[] { start, end, orderByComparator };
1359 }
1360
1361 List<PasswordPolicyRel> list = (List<PasswordPolicyRel>)FinderCacheUtil.getResult(finderPath,
1362 finderArgs, this);
1363
1364 if (list == null) {
1365 StringBundler query = null;
1366 String sql = null;
1367
1368 if (orderByComparator != null) {
1369 query = new StringBundler(2 +
1370 (orderByComparator.getOrderByFields().length * 3));
1371
1372 query.append(_SQL_SELECT_PASSWORDPOLICYREL);
1373
1374 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1375 orderByComparator);
1376
1377 sql = query.toString();
1378 }
1379 else {
1380 sql = _SQL_SELECT_PASSWORDPOLICYREL;
1381 }
1382
1383 Session session = null;
1384
1385 try {
1386 session = openSession();
1387
1388 Query q = session.createQuery(sql);
1389
1390 if (orderByComparator == null) {
1391 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
1392 getDialect(), start, end, false);
1393
1394 Collections.sort(list);
1395 }
1396 else {
1397 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
1398 getDialect(), start, end);
1399 }
1400 }
1401 catch (Exception e) {
1402 throw processException(e);
1403 }
1404 finally {
1405 if (list == null) {
1406 FinderCacheUtil.removeResult(finderPath, finderArgs);
1407 }
1408 else {
1409 cacheResult(list);
1410
1411 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1412 }
1413
1414 closeSession(session);
1415 }
1416 }
1417
1418 return list;
1419 }
1420
1421
1427 public void removeByPasswordPolicyId(long passwordPolicyId)
1428 throws SystemException {
1429 for (PasswordPolicyRel passwordPolicyRel : findByPasswordPolicyId(
1430 passwordPolicyId)) {
1431 remove(passwordPolicyRel);
1432 }
1433 }
1434
1435
1443 public PasswordPolicyRel removeByC_C(long classNameId, long classPK)
1444 throws NoSuchPasswordPolicyRelException, SystemException {
1445 PasswordPolicyRel passwordPolicyRel = findByC_C(classNameId, classPK);
1446
1447 return remove(passwordPolicyRel);
1448 }
1449
1450
1459 public PasswordPolicyRel removeByP_C_C(long passwordPolicyId,
1460 long classNameId, long classPK)
1461 throws NoSuchPasswordPolicyRelException, SystemException {
1462 PasswordPolicyRel passwordPolicyRel = findByP_C_C(passwordPolicyId,
1463 classNameId, classPK);
1464
1465 return remove(passwordPolicyRel);
1466 }
1467
1468
1473 public void removeAll() throws SystemException {
1474 for (PasswordPolicyRel passwordPolicyRel : findAll()) {
1475 remove(passwordPolicyRel);
1476 }
1477 }
1478
1479
1486 public int countByPasswordPolicyId(long passwordPolicyId)
1487 throws SystemException {
1488 Object[] finderArgs = new Object[] { passwordPolicyId };
1489
1490 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
1491 finderArgs, this);
1492
1493 if (count == null) {
1494 StringBundler query = new StringBundler(2);
1495
1496 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
1497
1498 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
1499
1500 String sql = query.toString();
1501
1502 Session session = null;
1503
1504 try {
1505 session = openSession();
1506
1507 Query q = session.createQuery(sql);
1508
1509 QueryPos qPos = QueryPos.getInstance(q);
1510
1511 qPos.add(passwordPolicyId);
1512
1513 count = (Long)q.uniqueResult();
1514 }
1515 catch (Exception e) {
1516 throw processException(e);
1517 }
1518 finally {
1519 if (count == null) {
1520 count = Long.valueOf(0);
1521 }
1522
1523 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
1524 finderArgs, count);
1525
1526 closeSession(session);
1527 }
1528 }
1529
1530 return count.intValue();
1531 }
1532
1533
1541 public int countByC_C(long classNameId, long classPK)
1542 throws SystemException {
1543 Object[] finderArgs = new Object[] { classNameId, classPK };
1544
1545 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
1546 finderArgs, this);
1547
1548 if (count == null) {
1549 StringBundler query = new StringBundler(3);
1550
1551 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
1552
1553 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1554
1555 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1556
1557 String sql = query.toString();
1558
1559 Session session = null;
1560
1561 try {
1562 session = openSession();
1563
1564 Query q = session.createQuery(sql);
1565
1566 QueryPos qPos = QueryPos.getInstance(q);
1567
1568 qPos.add(classNameId);
1569
1570 qPos.add(classPK);
1571
1572 count = (Long)q.uniqueResult();
1573 }
1574 catch (Exception e) {
1575 throw processException(e);
1576 }
1577 finally {
1578 if (count == null) {
1579 count = Long.valueOf(0);
1580 }
1581
1582 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
1583 count);
1584
1585 closeSession(session);
1586 }
1587 }
1588
1589 return count.intValue();
1590 }
1591
1592
1601 public int countByP_C_C(long passwordPolicyId, long classNameId,
1602 long classPK) throws SystemException {
1603 Object[] finderArgs = new Object[] {
1604 passwordPolicyId, classNameId, classPK
1605 };
1606
1607 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_C_C,
1608 finderArgs, this);
1609
1610 if (count == null) {
1611 StringBundler query = new StringBundler(4);
1612
1613 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
1614
1615 query.append(_FINDER_COLUMN_P_C_C_PASSWORDPOLICYID_2);
1616
1617 query.append(_FINDER_COLUMN_P_C_C_CLASSNAMEID_2);
1618
1619 query.append(_FINDER_COLUMN_P_C_C_CLASSPK_2);
1620
1621 String sql = query.toString();
1622
1623 Session session = null;
1624
1625 try {
1626 session = openSession();
1627
1628 Query q = session.createQuery(sql);
1629
1630 QueryPos qPos = QueryPos.getInstance(q);
1631
1632 qPos.add(passwordPolicyId);
1633
1634 qPos.add(classNameId);
1635
1636 qPos.add(classPK);
1637
1638 count = (Long)q.uniqueResult();
1639 }
1640 catch (Exception e) {
1641 throw processException(e);
1642 }
1643 finally {
1644 if (count == null) {
1645 count = Long.valueOf(0);
1646 }
1647
1648 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_C_C,
1649 finderArgs, count);
1650
1651 closeSession(session);
1652 }
1653 }
1654
1655 return count.intValue();
1656 }
1657
1658
1664 public int countAll() throws SystemException {
1665 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1666 FINDER_ARGS_EMPTY, this);
1667
1668 if (count == null) {
1669 Session session = null;
1670
1671 try {
1672 session = openSession();
1673
1674 Query q = session.createQuery(_SQL_COUNT_PASSWORDPOLICYREL);
1675
1676 count = (Long)q.uniqueResult();
1677 }
1678 catch (Exception e) {
1679 throw processException(e);
1680 }
1681 finally {
1682 if (count == null) {
1683 count = Long.valueOf(0);
1684 }
1685
1686 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1687 FINDER_ARGS_EMPTY, count);
1688
1689 closeSession(session);
1690 }
1691 }
1692
1693 return count.intValue();
1694 }
1695
1696
1699 public void afterPropertiesSet() {
1700 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1701 com.liferay.portal.util.PropsUtil.get(
1702 "value.object.listener.com.liferay.portal.model.PasswordPolicyRel")));
1703
1704 if (listenerClassNames.length > 0) {
1705 try {
1706 List<ModelListener<PasswordPolicyRel>> listenersList = new ArrayList<ModelListener<PasswordPolicyRel>>();
1707
1708 for (String listenerClassName : listenerClassNames) {
1709 Class<?> clazz = getClass();
1710
1711 listenersList.add((ModelListener<PasswordPolicyRel>)InstanceFactory.newInstance(
1712 clazz.getClassLoader(), listenerClassName));
1713 }
1714
1715 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1716 }
1717 catch (Exception e) {
1718 _log.error(e);
1719 }
1720 }
1721 }
1722
1723 public void destroy() {
1724 EntityCacheUtil.removeCache(PasswordPolicyRelImpl.class.getName());
1725 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1726 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1727 }
1728
1729 @BeanReference(type = AccountPersistence.class)
1730 protected AccountPersistence accountPersistence;
1731 @BeanReference(type = AddressPersistence.class)
1732 protected AddressPersistence addressPersistence;
1733 @BeanReference(type = BrowserTrackerPersistence.class)
1734 protected BrowserTrackerPersistence browserTrackerPersistence;
1735 @BeanReference(type = ClassNamePersistence.class)
1736 protected ClassNamePersistence classNamePersistence;
1737 @BeanReference(type = ClusterGroupPersistence.class)
1738 protected ClusterGroupPersistence clusterGroupPersistence;
1739 @BeanReference(type = CompanyPersistence.class)
1740 protected CompanyPersistence companyPersistence;
1741 @BeanReference(type = ContactPersistence.class)
1742 protected ContactPersistence contactPersistence;
1743 @BeanReference(type = CountryPersistence.class)
1744 protected CountryPersistence countryPersistence;
1745 @BeanReference(type = EmailAddressPersistence.class)
1746 protected EmailAddressPersistence emailAddressPersistence;
1747 @BeanReference(type = GroupPersistence.class)
1748 protected GroupPersistence groupPersistence;
1749 @BeanReference(type = ImagePersistence.class)
1750 protected ImagePersistence imagePersistence;
1751 @BeanReference(type = LayoutPersistence.class)
1752 protected LayoutPersistence layoutPersistence;
1753 @BeanReference(type = LayoutBranchPersistence.class)
1754 protected LayoutBranchPersistence layoutBranchPersistence;
1755 @BeanReference(type = LayoutPrototypePersistence.class)
1756 protected LayoutPrototypePersistence layoutPrototypePersistence;
1757 @BeanReference(type = LayoutRevisionPersistence.class)
1758 protected LayoutRevisionPersistence layoutRevisionPersistence;
1759 @BeanReference(type = LayoutSetPersistence.class)
1760 protected LayoutSetPersistence layoutSetPersistence;
1761 @BeanReference(type = LayoutSetBranchPersistence.class)
1762 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1763 @BeanReference(type = LayoutSetPrototypePersistence.class)
1764 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1765 @BeanReference(type = ListTypePersistence.class)
1766 protected ListTypePersistence listTypePersistence;
1767 @BeanReference(type = LockPersistence.class)
1768 protected LockPersistence lockPersistence;
1769 @BeanReference(type = MembershipRequestPersistence.class)
1770 protected MembershipRequestPersistence membershipRequestPersistence;
1771 @BeanReference(type = OrganizationPersistence.class)
1772 protected OrganizationPersistence organizationPersistence;
1773 @BeanReference(type = OrgGroupPermissionPersistence.class)
1774 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1775 @BeanReference(type = OrgGroupRolePersistence.class)
1776 protected OrgGroupRolePersistence orgGroupRolePersistence;
1777 @BeanReference(type = OrgLaborPersistence.class)
1778 protected OrgLaborPersistence orgLaborPersistence;
1779 @BeanReference(type = PasswordPolicyPersistence.class)
1780 protected PasswordPolicyPersistence passwordPolicyPersistence;
1781 @BeanReference(type = PasswordPolicyRelPersistence.class)
1782 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1783 @BeanReference(type = PasswordTrackerPersistence.class)
1784 protected PasswordTrackerPersistence passwordTrackerPersistence;
1785 @BeanReference(type = PermissionPersistence.class)
1786 protected PermissionPersistence permissionPersistence;
1787 @BeanReference(type = PhonePersistence.class)
1788 protected PhonePersistence phonePersistence;
1789 @BeanReference(type = PluginSettingPersistence.class)
1790 protected PluginSettingPersistence pluginSettingPersistence;
1791 @BeanReference(type = PortalPreferencesPersistence.class)
1792 protected PortalPreferencesPersistence portalPreferencesPersistence;
1793 @BeanReference(type = PortletPersistence.class)
1794 protected PortletPersistence portletPersistence;
1795 @BeanReference(type = PortletItemPersistence.class)
1796 protected PortletItemPersistence portletItemPersistence;
1797 @BeanReference(type = PortletPreferencesPersistence.class)
1798 protected PortletPreferencesPersistence portletPreferencesPersistence;
1799 @BeanReference(type = RegionPersistence.class)
1800 protected RegionPersistence regionPersistence;
1801 @BeanReference(type = ReleasePersistence.class)
1802 protected ReleasePersistence releasePersistence;
1803 @BeanReference(type = RepositoryPersistence.class)
1804 protected RepositoryPersistence repositoryPersistence;
1805 @BeanReference(type = RepositoryEntryPersistence.class)
1806 protected RepositoryEntryPersistence repositoryEntryPersistence;
1807 @BeanReference(type = ResourcePersistence.class)
1808 protected ResourcePersistence resourcePersistence;
1809 @BeanReference(type = ResourceActionPersistence.class)
1810 protected ResourceActionPersistence resourceActionPersistence;
1811 @BeanReference(type = ResourceBlockPersistence.class)
1812 protected ResourceBlockPersistence resourceBlockPersistence;
1813 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1814 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1815 @BeanReference(type = ResourceCodePersistence.class)
1816 protected ResourceCodePersistence resourceCodePersistence;
1817 @BeanReference(type = ResourcePermissionPersistence.class)
1818 protected ResourcePermissionPersistence resourcePermissionPersistence;
1819 @BeanReference(type = ResourceTypePermissionPersistence.class)
1820 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1821 @BeanReference(type = RolePersistence.class)
1822 protected RolePersistence rolePersistence;
1823 @BeanReference(type = ServiceComponentPersistence.class)
1824 protected ServiceComponentPersistence serviceComponentPersistence;
1825 @BeanReference(type = ShardPersistence.class)
1826 protected ShardPersistence shardPersistence;
1827 @BeanReference(type = SubscriptionPersistence.class)
1828 protected SubscriptionPersistence subscriptionPersistence;
1829 @BeanReference(type = TeamPersistence.class)
1830 protected TeamPersistence teamPersistence;
1831 @BeanReference(type = TicketPersistence.class)
1832 protected TicketPersistence ticketPersistence;
1833 @BeanReference(type = UserPersistence.class)
1834 protected UserPersistence userPersistence;
1835 @BeanReference(type = UserGroupPersistence.class)
1836 protected UserGroupPersistence userGroupPersistence;
1837 @BeanReference(type = UserGroupGroupRolePersistence.class)
1838 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1839 @BeanReference(type = UserGroupRolePersistence.class)
1840 protected UserGroupRolePersistence userGroupRolePersistence;
1841 @BeanReference(type = UserIdMapperPersistence.class)
1842 protected UserIdMapperPersistence userIdMapperPersistence;
1843 @BeanReference(type = UserNotificationEventPersistence.class)
1844 protected UserNotificationEventPersistence userNotificationEventPersistence;
1845 @BeanReference(type = UserTrackerPersistence.class)
1846 protected UserTrackerPersistence userTrackerPersistence;
1847 @BeanReference(type = UserTrackerPathPersistence.class)
1848 protected UserTrackerPathPersistence userTrackerPathPersistence;
1849 @BeanReference(type = VirtualHostPersistence.class)
1850 protected VirtualHostPersistence virtualHostPersistence;
1851 @BeanReference(type = WebDAVPropsPersistence.class)
1852 protected WebDAVPropsPersistence webDAVPropsPersistence;
1853 @BeanReference(type = WebsitePersistence.class)
1854 protected WebsitePersistence websitePersistence;
1855 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1856 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1857 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1858 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1859 private static final String _SQL_SELECT_PASSWORDPOLICYREL = "SELECT passwordPolicyRel FROM PasswordPolicyRel passwordPolicyRel";
1860 private static final String _SQL_SELECT_PASSWORDPOLICYREL_WHERE = "SELECT passwordPolicyRel FROM PasswordPolicyRel passwordPolicyRel WHERE ";
1861 private static final String _SQL_COUNT_PASSWORDPOLICYREL = "SELECT COUNT(passwordPolicyRel) FROM PasswordPolicyRel passwordPolicyRel";
1862 private static final String _SQL_COUNT_PASSWORDPOLICYREL_WHERE = "SELECT COUNT(passwordPolicyRel) FROM PasswordPolicyRel passwordPolicyRel WHERE ";
1863 private static final String _FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2 =
1864 "passwordPolicyRel.passwordPolicyId = ?";
1865 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "passwordPolicyRel.classNameId = ? AND ";
1866 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "passwordPolicyRel.classPK = ?";
1867 private static final String _FINDER_COLUMN_P_C_C_PASSWORDPOLICYID_2 = "passwordPolicyRel.passwordPolicyId = ? AND ";
1868 private static final String _FINDER_COLUMN_P_C_C_CLASSNAMEID_2 = "passwordPolicyRel.classNameId = ? AND ";
1869 private static final String _FINDER_COLUMN_P_C_C_CLASSPK_2 = "passwordPolicyRel.classPK = ?";
1870 private static final String _ORDER_BY_ENTITY_ALIAS = "passwordPolicyRel.";
1871 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordPolicyRel exists with the primary key ";
1872 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordPolicyRel exists with the key {";
1873 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1874 private static Log _log = LogFactoryUtil.getLog(PasswordPolicyRelPersistenceImpl.class);
1875 private static PasswordPolicyRel _nullPasswordPolicyRel = new PasswordPolicyRelImpl() {
1876 @Override
1877 public Object clone() {
1878 return this;
1879 }
1880
1881 @Override
1882 public CacheModel<PasswordPolicyRel> toCacheModel() {
1883 return _nullPasswordPolicyRelCacheModel;
1884 }
1885 };
1886
1887 private static CacheModel<PasswordPolicyRel> _nullPasswordPolicyRelCacheModel =
1888 new CacheModel<PasswordPolicyRel>() {
1889 public PasswordPolicyRel toEntityModel() {
1890 return _nullPasswordPolicyRel;
1891 }
1892 };
1893 }