001
014
015 package com.liferay.portal.service.persistence.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.NoSuchPasswordPolicyRelException;
020 import com.liferay.portal.kernel.bean.BeanReference;
021 import com.liferay.portal.kernel.dao.orm.EntityCache;
022 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderCache;
024 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
025 import com.liferay.portal.kernel.dao.orm.FinderPath;
026 import com.liferay.portal.kernel.dao.orm.Query;
027 import com.liferay.portal.kernel.dao.orm.QueryPos;
028 import com.liferay.portal.kernel.dao.orm.QueryUtil;
029 import com.liferay.portal.kernel.dao.orm.Session;
030 import com.liferay.portal.kernel.log.Log;
031 import com.liferay.portal.kernel.log.LogFactoryUtil;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.model.CacheModel;
036 import com.liferay.portal.model.MVCCModel;
037 import com.liferay.portal.model.PasswordPolicyRel;
038 import com.liferay.portal.model.impl.PasswordPolicyRelImpl;
039 import com.liferay.portal.model.impl.PasswordPolicyRelModelImpl;
040 import com.liferay.portal.service.persistence.CompanyProvider;
041 import com.liferay.portal.service.persistence.PasswordPolicyRelPersistence;
042
043 import java.io.Serializable;
044
045 import java.util.Collections;
046 import java.util.HashMap;
047 import java.util.HashSet;
048 import java.util.Iterator;
049 import java.util.List;
050 import java.util.Map;
051 import java.util.Set;
052
053
065 @ProviderType
066 public class PasswordPolicyRelPersistenceImpl extends BasePersistenceImpl<PasswordPolicyRel>
067 implements PasswordPolicyRelPersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = PasswordPolicyRelImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075 ".List1";
076 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077 ".List2";
078 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
079 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
080 PasswordPolicyRelImpl.class,
081 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
082 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
083 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
084 PasswordPolicyRelImpl.class,
085 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
086 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
087 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED, Long.class,
088 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
089 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PASSWORDPOLICYID =
090 new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
091 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
092 PasswordPolicyRelImpl.class,
093 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByPasswordPolicyId",
094 new String[] {
095 Long.class.getName(),
096
097 Integer.class.getName(), Integer.class.getName(),
098 OrderByComparator.class.getName()
099 });
100 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID =
101 new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
102 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
103 PasswordPolicyRelImpl.class,
104 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
105 "findByPasswordPolicyId", new String[] { Long.class.getName() },
106 PasswordPolicyRelModelImpl.PASSWORDPOLICYID_COLUMN_BITMASK);
107 public static final FinderPath FINDER_PATH_COUNT_BY_PASSWORDPOLICYID = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
108 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED, Long.class,
109 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
110 "countByPasswordPolicyId", new String[] { Long.class.getName() });
111
112
118 @Override
119 public List<PasswordPolicyRel> findByPasswordPolicyId(long passwordPolicyId) {
120 return findByPasswordPolicyId(passwordPolicyId, QueryUtil.ALL_POS,
121 QueryUtil.ALL_POS, null);
122 }
123
124
136 @Override
137 public List<PasswordPolicyRel> findByPasswordPolicyId(
138 long passwordPolicyId, int start, int end) {
139 return findByPasswordPolicyId(passwordPolicyId, start, end, null);
140 }
141
142
155 @Override
156 public List<PasswordPolicyRel> findByPasswordPolicyId(
157 long passwordPolicyId, int start, int end,
158 OrderByComparator<PasswordPolicyRel> orderByComparator) {
159 return findByPasswordPolicyId(passwordPolicyId, start, end,
160 orderByComparator, true);
161 }
162
163
177 @Override
178 public List<PasswordPolicyRel> findByPasswordPolicyId(
179 long passwordPolicyId, int start, int end,
180 OrderByComparator<PasswordPolicyRel> orderByComparator,
181 boolean retrieveFromCache) {
182 boolean pagination = true;
183 FinderPath finderPath = null;
184 Object[] finderArgs = null;
185
186 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
187 (orderByComparator == null)) {
188 pagination = false;
189 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID;
190 finderArgs = new Object[] { passwordPolicyId };
191 }
192 else {
193 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PASSWORDPOLICYID;
194 finderArgs = new Object[] {
195 passwordPolicyId,
196
197 start, end, orderByComparator
198 };
199 }
200
201 List<PasswordPolicyRel> list = null;
202
203 if (retrieveFromCache) {
204 list = (List<PasswordPolicyRel>)finderCache.getResult(finderPath,
205 finderArgs, this);
206
207 if ((list != null) && !list.isEmpty()) {
208 for (PasswordPolicyRel passwordPolicyRel : list) {
209 if ((passwordPolicyId != passwordPolicyRel.getPasswordPolicyId())) {
210 list = null;
211
212 break;
213 }
214 }
215 }
216 }
217
218 if (list == null) {
219 StringBundler query = null;
220
221 if (orderByComparator != null) {
222 query = new StringBundler(3 +
223 (orderByComparator.getOrderByFields().length * 3));
224 }
225 else {
226 query = new StringBundler(3);
227 }
228
229 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
230
231 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
232
233 if (orderByComparator != null) {
234 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
235 orderByComparator);
236 }
237 else
238 if (pagination) {
239 query.append(PasswordPolicyRelModelImpl.ORDER_BY_JPQL);
240 }
241
242 String sql = query.toString();
243
244 Session session = null;
245
246 try {
247 session = openSession();
248
249 Query q = session.createQuery(sql);
250
251 QueryPos qPos = QueryPos.getInstance(q);
252
253 qPos.add(passwordPolicyId);
254
255 if (!pagination) {
256 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
257 getDialect(), start, end, false);
258
259 Collections.sort(list);
260
261 list = Collections.unmodifiableList(list);
262 }
263 else {
264 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
265 getDialect(), start, end);
266 }
267
268 cacheResult(list);
269
270 finderCache.putResult(finderPath, finderArgs, list);
271 }
272 catch (Exception e) {
273 finderCache.removeResult(finderPath, finderArgs);
274
275 throw processException(e);
276 }
277 finally {
278 closeSession(session);
279 }
280 }
281
282 return list;
283 }
284
285
293 @Override
294 public PasswordPolicyRel findByPasswordPolicyId_First(
295 long passwordPolicyId,
296 OrderByComparator<PasswordPolicyRel> orderByComparator)
297 throws NoSuchPasswordPolicyRelException {
298 PasswordPolicyRel passwordPolicyRel = fetchByPasswordPolicyId_First(passwordPolicyId,
299 orderByComparator);
300
301 if (passwordPolicyRel != null) {
302 return passwordPolicyRel;
303 }
304
305 StringBundler msg = new StringBundler(4);
306
307 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
308
309 msg.append("passwordPolicyId=");
310 msg.append(passwordPolicyId);
311
312 msg.append(StringPool.CLOSE_CURLY_BRACE);
313
314 throw new NoSuchPasswordPolicyRelException(msg.toString());
315 }
316
317
324 @Override
325 public PasswordPolicyRel fetchByPasswordPolicyId_First(
326 long passwordPolicyId,
327 OrderByComparator<PasswordPolicyRel> orderByComparator) {
328 List<PasswordPolicyRel> list = findByPasswordPolicyId(passwordPolicyId,
329 0, 1, orderByComparator);
330
331 if (!list.isEmpty()) {
332 return list.get(0);
333 }
334
335 return null;
336 }
337
338
346 @Override
347 public PasswordPolicyRel findByPasswordPolicyId_Last(
348 long passwordPolicyId,
349 OrderByComparator<PasswordPolicyRel> orderByComparator)
350 throws NoSuchPasswordPolicyRelException {
351 PasswordPolicyRel passwordPolicyRel = fetchByPasswordPolicyId_Last(passwordPolicyId,
352 orderByComparator);
353
354 if (passwordPolicyRel != null) {
355 return passwordPolicyRel;
356 }
357
358 StringBundler msg = new StringBundler(4);
359
360 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
361
362 msg.append("passwordPolicyId=");
363 msg.append(passwordPolicyId);
364
365 msg.append(StringPool.CLOSE_CURLY_BRACE);
366
367 throw new NoSuchPasswordPolicyRelException(msg.toString());
368 }
369
370
377 @Override
378 public PasswordPolicyRel fetchByPasswordPolicyId_Last(
379 long passwordPolicyId,
380 OrderByComparator<PasswordPolicyRel> orderByComparator) {
381 int count = countByPasswordPolicyId(passwordPolicyId);
382
383 if (count == 0) {
384 return null;
385 }
386
387 List<PasswordPolicyRel> list = findByPasswordPolicyId(passwordPolicyId,
388 count - 1, count, orderByComparator);
389
390 if (!list.isEmpty()) {
391 return list.get(0);
392 }
393
394 return null;
395 }
396
397
406 @Override
407 public PasswordPolicyRel[] findByPasswordPolicyId_PrevAndNext(
408 long passwordPolicyRelId, long passwordPolicyId,
409 OrderByComparator<PasswordPolicyRel> orderByComparator)
410 throws NoSuchPasswordPolicyRelException {
411 PasswordPolicyRel passwordPolicyRel = findByPrimaryKey(passwordPolicyRelId);
412
413 Session session = null;
414
415 try {
416 session = openSession();
417
418 PasswordPolicyRel[] array = new PasswordPolicyRelImpl[3];
419
420 array[0] = getByPasswordPolicyId_PrevAndNext(session,
421 passwordPolicyRel, passwordPolicyId, orderByComparator, true);
422
423 array[1] = passwordPolicyRel;
424
425 array[2] = getByPasswordPolicyId_PrevAndNext(session,
426 passwordPolicyRel, passwordPolicyId, orderByComparator,
427 false);
428
429 return array;
430 }
431 catch (Exception e) {
432 throw processException(e);
433 }
434 finally {
435 closeSession(session);
436 }
437 }
438
439 protected PasswordPolicyRel getByPasswordPolicyId_PrevAndNext(
440 Session session, PasswordPolicyRel passwordPolicyRel,
441 long passwordPolicyId,
442 OrderByComparator<PasswordPolicyRel> orderByComparator, boolean previous) {
443 StringBundler query = null;
444
445 if (orderByComparator != null) {
446 query = new StringBundler(6 +
447 (orderByComparator.getOrderByFields().length * 6));
448 }
449 else {
450 query = new StringBundler(3);
451 }
452
453 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
454
455 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
456
457 if (orderByComparator != null) {
458 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
459
460 if (orderByConditionFields.length > 0) {
461 query.append(WHERE_AND);
462 }
463
464 for (int i = 0; i < orderByConditionFields.length; i++) {
465 query.append(_ORDER_BY_ENTITY_ALIAS);
466 query.append(orderByConditionFields[i]);
467
468 if ((i + 1) < orderByConditionFields.length) {
469 if (orderByComparator.isAscending() ^ previous) {
470 query.append(WHERE_GREATER_THAN_HAS_NEXT);
471 }
472 else {
473 query.append(WHERE_LESSER_THAN_HAS_NEXT);
474 }
475 }
476 else {
477 if (orderByComparator.isAscending() ^ previous) {
478 query.append(WHERE_GREATER_THAN);
479 }
480 else {
481 query.append(WHERE_LESSER_THAN);
482 }
483 }
484 }
485
486 query.append(ORDER_BY_CLAUSE);
487
488 String[] orderByFields = orderByComparator.getOrderByFields();
489
490 for (int i = 0; i < orderByFields.length; i++) {
491 query.append(_ORDER_BY_ENTITY_ALIAS);
492 query.append(orderByFields[i]);
493
494 if ((i + 1) < orderByFields.length) {
495 if (orderByComparator.isAscending() ^ previous) {
496 query.append(ORDER_BY_ASC_HAS_NEXT);
497 }
498 else {
499 query.append(ORDER_BY_DESC_HAS_NEXT);
500 }
501 }
502 else {
503 if (orderByComparator.isAscending() ^ previous) {
504 query.append(ORDER_BY_ASC);
505 }
506 else {
507 query.append(ORDER_BY_DESC);
508 }
509 }
510 }
511 }
512 else {
513 query.append(PasswordPolicyRelModelImpl.ORDER_BY_JPQL);
514 }
515
516 String sql = query.toString();
517
518 Query q = session.createQuery(sql);
519
520 q.setFirstResult(0);
521 q.setMaxResults(2);
522
523 QueryPos qPos = QueryPos.getInstance(q);
524
525 qPos.add(passwordPolicyId);
526
527 if (orderByComparator != null) {
528 Object[] values = orderByComparator.getOrderByConditionValues(passwordPolicyRel);
529
530 for (Object value : values) {
531 qPos.add(value);
532 }
533 }
534
535 List<PasswordPolicyRel> list = q.list();
536
537 if (list.size() == 2) {
538 return list.get(1);
539 }
540 else {
541 return null;
542 }
543 }
544
545
550 @Override
551 public void removeByPasswordPolicyId(long passwordPolicyId) {
552 for (PasswordPolicyRel passwordPolicyRel : findByPasswordPolicyId(
553 passwordPolicyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
554 remove(passwordPolicyRel);
555 }
556 }
557
558
564 @Override
565 public int countByPasswordPolicyId(long passwordPolicyId) {
566 FinderPath finderPath = FINDER_PATH_COUNT_BY_PASSWORDPOLICYID;
567
568 Object[] finderArgs = new Object[] { passwordPolicyId };
569
570 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
571
572 if (count == null) {
573 StringBundler query = new StringBundler(2);
574
575 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
576
577 query.append(_FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2);
578
579 String sql = query.toString();
580
581 Session session = null;
582
583 try {
584 session = openSession();
585
586 Query q = session.createQuery(sql);
587
588 QueryPos qPos = QueryPos.getInstance(q);
589
590 qPos.add(passwordPolicyId);
591
592 count = (Long)q.uniqueResult();
593
594 finderCache.putResult(finderPath, finderArgs, count);
595 }
596 catch (Exception e) {
597 finderCache.removeResult(finderPath, finderArgs);
598
599 throw processException(e);
600 }
601 finally {
602 closeSession(session);
603 }
604 }
605
606 return count.intValue();
607 }
608
609 private static final String _FINDER_COLUMN_PASSWORDPOLICYID_PASSWORDPOLICYID_2 =
610 "passwordPolicyRel.passwordPolicyId = ?";
611 public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
612 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED,
613 PasswordPolicyRelImpl.class, FINDER_CLASS_NAME_ENTITY,
614 "fetchByC_C",
615 new String[] { Long.class.getName(), Long.class.getName() },
616 PasswordPolicyRelModelImpl.CLASSNAMEID_COLUMN_BITMASK |
617 PasswordPolicyRelModelImpl.CLASSPK_COLUMN_BITMASK);
618 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
619 PasswordPolicyRelModelImpl.FINDER_CACHE_ENABLED, Long.class,
620 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
621 new String[] { Long.class.getName(), Long.class.getName() });
622
623
631 @Override
632 public PasswordPolicyRel findByC_C(long classNameId, long classPK)
633 throws NoSuchPasswordPolicyRelException {
634 PasswordPolicyRel passwordPolicyRel = fetchByC_C(classNameId, classPK);
635
636 if (passwordPolicyRel == null) {
637 StringBundler msg = new StringBundler(6);
638
639 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
640
641 msg.append("classNameId=");
642 msg.append(classNameId);
643
644 msg.append(", classPK=");
645 msg.append(classPK);
646
647 msg.append(StringPool.CLOSE_CURLY_BRACE);
648
649 if (_log.isWarnEnabled()) {
650 _log.warn(msg.toString());
651 }
652
653 throw new NoSuchPasswordPolicyRelException(msg.toString());
654 }
655
656 return passwordPolicyRel;
657 }
658
659
666 @Override
667 public PasswordPolicyRel fetchByC_C(long classNameId, long classPK) {
668 return fetchByC_C(classNameId, classPK, true);
669 }
670
671
679 @Override
680 public PasswordPolicyRel fetchByC_C(long classNameId, long classPK,
681 boolean retrieveFromCache) {
682 Object[] finderArgs = new Object[] { classNameId, classPK };
683
684 Object result = null;
685
686 if (retrieveFromCache) {
687 result = finderCache.getResult(FINDER_PATH_FETCH_BY_C_C,
688 finderArgs, this);
689 }
690
691 if (result instanceof PasswordPolicyRel) {
692 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)result;
693
694 if ((classNameId != passwordPolicyRel.getClassNameId()) ||
695 (classPK != passwordPolicyRel.getClassPK())) {
696 result = null;
697 }
698 }
699
700 if (result == null) {
701 StringBundler query = new StringBundler(4);
702
703 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE);
704
705 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
706
707 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
708
709 String sql = query.toString();
710
711 Session session = null;
712
713 try {
714 session = openSession();
715
716 Query q = session.createQuery(sql);
717
718 QueryPos qPos = QueryPos.getInstance(q);
719
720 qPos.add(classNameId);
721
722 qPos.add(classPK);
723
724 List<PasswordPolicyRel> list = q.list();
725
726 if (list.isEmpty()) {
727 finderCache.putResult(FINDER_PATH_FETCH_BY_C_C, finderArgs,
728 list);
729 }
730 else {
731 PasswordPolicyRel passwordPolicyRel = list.get(0);
732
733 result = passwordPolicyRel;
734
735 cacheResult(passwordPolicyRel);
736
737 if ((passwordPolicyRel.getClassNameId() != classNameId) ||
738 (passwordPolicyRel.getClassPK() != classPK)) {
739 finderCache.putResult(FINDER_PATH_FETCH_BY_C_C,
740 finderArgs, passwordPolicyRel);
741 }
742 }
743 }
744 catch (Exception e) {
745 finderCache.removeResult(FINDER_PATH_FETCH_BY_C_C, finderArgs);
746
747 throw processException(e);
748 }
749 finally {
750 closeSession(session);
751 }
752 }
753
754 if (result instanceof List<?>) {
755 return null;
756 }
757 else {
758 return (PasswordPolicyRel)result;
759 }
760 }
761
762
769 @Override
770 public PasswordPolicyRel removeByC_C(long classNameId, long classPK)
771 throws NoSuchPasswordPolicyRelException {
772 PasswordPolicyRel passwordPolicyRel = findByC_C(classNameId, classPK);
773
774 return remove(passwordPolicyRel);
775 }
776
777
784 @Override
785 public int countByC_C(long classNameId, long classPK) {
786 FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C;
787
788 Object[] finderArgs = new Object[] { classNameId, classPK };
789
790 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
791
792 if (count == null) {
793 StringBundler query = new StringBundler(3);
794
795 query.append(_SQL_COUNT_PASSWORDPOLICYREL_WHERE);
796
797 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
798
799 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
800
801 String sql = query.toString();
802
803 Session session = null;
804
805 try {
806 session = openSession();
807
808 Query q = session.createQuery(sql);
809
810 QueryPos qPos = QueryPos.getInstance(q);
811
812 qPos.add(classNameId);
813
814 qPos.add(classPK);
815
816 count = (Long)q.uniqueResult();
817
818 finderCache.putResult(finderPath, finderArgs, count);
819 }
820 catch (Exception e) {
821 finderCache.removeResult(finderPath, finderArgs);
822
823 throw processException(e);
824 }
825 finally {
826 closeSession(session);
827 }
828 }
829
830 return count.intValue();
831 }
832
833 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "passwordPolicyRel.classNameId = ? AND ";
834 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "passwordPolicyRel.classPK = ?";
835
836 public PasswordPolicyRelPersistenceImpl() {
837 setModelClass(PasswordPolicyRel.class);
838 }
839
840
845 @Override
846 public void cacheResult(PasswordPolicyRel passwordPolicyRel) {
847 entityCache.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
848 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey(),
849 passwordPolicyRel);
850
851 finderCache.putResult(FINDER_PATH_FETCH_BY_C_C,
852 new Object[] {
853 passwordPolicyRel.getClassNameId(),
854 passwordPolicyRel.getClassPK()
855 }, passwordPolicyRel);
856
857 passwordPolicyRel.resetOriginalValues();
858 }
859
860
865 @Override
866 public void cacheResult(List<PasswordPolicyRel> passwordPolicyRels) {
867 for (PasswordPolicyRel passwordPolicyRel : passwordPolicyRels) {
868 if (entityCache.getResult(
869 PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
870 PasswordPolicyRelImpl.class,
871 passwordPolicyRel.getPrimaryKey()) == null) {
872 cacheResult(passwordPolicyRel);
873 }
874 else {
875 passwordPolicyRel.resetOriginalValues();
876 }
877 }
878 }
879
880
887 @Override
888 public void clearCache() {
889 entityCache.clearCache(PasswordPolicyRelImpl.class);
890
891 finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
892 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
893 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
894 }
895
896
903 @Override
904 public void clearCache(PasswordPolicyRel passwordPolicyRel) {
905 entityCache.removeResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
906 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey());
907
908 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
909 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
910
911 clearUniqueFindersCache((PasswordPolicyRelModelImpl)passwordPolicyRel);
912 }
913
914 @Override
915 public void clearCache(List<PasswordPolicyRel> passwordPolicyRels) {
916 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
917 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
918
919 for (PasswordPolicyRel passwordPolicyRel : passwordPolicyRels) {
920 entityCache.removeResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
921 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey());
922
923 clearUniqueFindersCache((PasswordPolicyRelModelImpl)passwordPolicyRel);
924 }
925 }
926
927 protected void cacheUniqueFindersCache(
928 PasswordPolicyRelModelImpl passwordPolicyRelModelImpl, boolean isNew) {
929 if (isNew) {
930 Object[] args = new Object[] {
931 passwordPolicyRelModelImpl.getClassNameId(),
932 passwordPolicyRelModelImpl.getClassPK()
933 };
934
935 finderCache.putResult(FINDER_PATH_COUNT_BY_C_C, args,
936 Long.valueOf(1));
937 finderCache.putResult(FINDER_PATH_FETCH_BY_C_C, args,
938 passwordPolicyRelModelImpl);
939 }
940 else {
941 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
942 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
943 Object[] args = new Object[] {
944 passwordPolicyRelModelImpl.getClassNameId(),
945 passwordPolicyRelModelImpl.getClassPK()
946 };
947
948 finderCache.putResult(FINDER_PATH_COUNT_BY_C_C, args,
949 Long.valueOf(1));
950 finderCache.putResult(FINDER_PATH_FETCH_BY_C_C, args,
951 passwordPolicyRelModelImpl);
952 }
953 }
954 }
955
956 protected void clearUniqueFindersCache(
957 PasswordPolicyRelModelImpl passwordPolicyRelModelImpl) {
958 Object[] args = new Object[] {
959 passwordPolicyRelModelImpl.getClassNameId(),
960 passwordPolicyRelModelImpl.getClassPK()
961 };
962
963 finderCache.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
964 finderCache.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
965
966 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
967 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
968 args = new Object[] {
969 passwordPolicyRelModelImpl.getOriginalClassNameId(),
970 passwordPolicyRelModelImpl.getOriginalClassPK()
971 };
972
973 finderCache.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
974 finderCache.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
975 }
976 }
977
978
984 @Override
985 public PasswordPolicyRel create(long passwordPolicyRelId) {
986 PasswordPolicyRel passwordPolicyRel = new PasswordPolicyRelImpl();
987
988 passwordPolicyRel.setNew(true);
989 passwordPolicyRel.setPrimaryKey(passwordPolicyRelId);
990
991 return passwordPolicyRel;
992 }
993
994
1001 @Override
1002 public PasswordPolicyRel remove(long passwordPolicyRelId)
1003 throws NoSuchPasswordPolicyRelException {
1004 return remove((Serializable)passwordPolicyRelId);
1005 }
1006
1007
1014 @Override
1015 public PasswordPolicyRel remove(Serializable primaryKey)
1016 throws NoSuchPasswordPolicyRelException {
1017 Session session = null;
1018
1019 try {
1020 session = openSession();
1021
1022 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
1023 primaryKey);
1024
1025 if (passwordPolicyRel == null) {
1026 if (_log.isWarnEnabled()) {
1027 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1028 }
1029
1030 throw new NoSuchPasswordPolicyRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1031 primaryKey);
1032 }
1033
1034 return remove(passwordPolicyRel);
1035 }
1036 catch (NoSuchPasswordPolicyRelException nsee) {
1037 throw nsee;
1038 }
1039 catch (Exception e) {
1040 throw processException(e);
1041 }
1042 finally {
1043 closeSession(session);
1044 }
1045 }
1046
1047 @Override
1048 protected PasswordPolicyRel removeImpl(PasswordPolicyRel passwordPolicyRel) {
1049 passwordPolicyRel = toUnwrappedModel(passwordPolicyRel);
1050
1051 Session session = null;
1052
1053 try {
1054 session = openSession();
1055
1056 if (!session.contains(passwordPolicyRel)) {
1057 passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
1058 passwordPolicyRel.getPrimaryKeyObj());
1059 }
1060
1061 if (passwordPolicyRel != null) {
1062 session.delete(passwordPolicyRel);
1063 }
1064 }
1065 catch (Exception e) {
1066 throw processException(e);
1067 }
1068 finally {
1069 closeSession(session);
1070 }
1071
1072 if (passwordPolicyRel != null) {
1073 clearCache(passwordPolicyRel);
1074 }
1075
1076 return passwordPolicyRel;
1077 }
1078
1079 @Override
1080 public PasswordPolicyRel updateImpl(PasswordPolicyRel passwordPolicyRel) {
1081 passwordPolicyRel = toUnwrappedModel(passwordPolicyRel);
1082
1083 boolean isNew = passwordPolicyRel.isNew();
1084
1085 PasswordPolicyRelModelImpl passwordPolicyRelModelImpl = (PasswordPolicyRelModelImpl)passwordPolicyRel;
1086
1087 Session session = null;
1088
1089 try {
1090 session = openSession();
1091
1092 if (passwordPolicyRel.isNew()) {
1093 session.save(passwordPolicyRel);
1094
1095 passwordPolicyRel.setNew(false);
1096 }
1097 else {
1098 passwordPolicyRel = (PasswordPolicyRel)session.merge(passwordPolicyRel);
1099 }
1100 }
1101 catch (Exception e) {
1102 throw processException(e);
1103 }
1104 finally {
1105 closeSession(session);
1106 }
1107
1108 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1109
1110 if (isNew || !PasswordPolicyRelModelImpl.COLUMN_BITMASK_ENABLED) {
1111 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1112 }
1113
1114 else {
1115 if ((passwordPolicyRelModelImpl.getColumnBitmask() &
1116 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID.getColumnBitmask()) != 0) {
1117 Object[] args = new Object[] {
1118 passwordPolicyRelModelImpl.getOriginalPasswordPolicyId()
1119 };
1120
1121 finderCache.removeResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
1122 args);
1123 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID,
1124 args);
1125
1126 args = new Object[] {
1127 passwordPolicyRelModelImpl.getPasswordPolicyId()
1128 };
1129
1130 finderCache.removeResult(FINDER_PATH_COUNT_BY_PASSWORDPOLICYID,
1131 args);
1132 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PASSWORDPOLICYID,
1133 args);
1134 }
1135 }
1136
1137 entityCache.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
1138 PasswordPolicyRelImpl.class, passwordPolicyRel.getPrimaryKey(),
1139 passwordPolicyRel, false);
1140
1141 clearUniqueFindersCache(passwordPolicyRelModelImpl);
1142 cacheUniqueFindersCache(passwordPolicyRelModelImpl, isNew);
1143
1144 passwordPolicyRel.resetOriginalValues();
1145
1146 return passwordPolicyRel;
1147 }
1148
1149 protected PasswordPolicyRel toUnwrappedModel(
1150 PasswordPolicyRel passwordPolicyRel) {
1151 if (passwordPolicyRel instanceof PasswordPolicyRelImpl) {
1152 return passwordPolicyRel;
1153 }
1154
1155 PasswordPolicyRelImpl passwordPolicyRelImpl = new PasswordPolicyRelImpl();
1156
1157 passwordPolicyRelImpl.setNew(passwordPolicyRel.isNew());
1158 passwordPolicyRelImpl.setPrimaryKey(passwordPolicyRel.getPrimaryKey());
1159
1160 passwordPolicyRelImpl.setMvccVersion(passwordPolicyRel.getMvccVersion());
1161 passwordPolicyRelImpl.setPasswordPolicyRelId(passwordPolicyRel.getPasswordPolicyRelId());
1162 passwordPolicyRelImpl.setCompanyId(passwordPolicyRel.getCompanyId());
1163 passwordPolicyRelImpl.setPasswordPolicyId(passwordPolicyRel.getPasswordPolicyId());
1164 passwordPolicyRelImpl.setClassNameId(passwordPolicyRel.getClassNameId());
1165 passwordPolicyRelImpl.setClassPK(passwordPolicyRel.getClassPK());
1166
1167 return passwordPolicyRelImpl;
1168 }
1169
1170
1177 @Override
1178 public PasswordPolicyRel findByPrimaryKey(Serializable primaryKey)
1179 throws NoSuchPasswordPolicyRelException {
1180 PasswordPolicyRel passwordPolicyRel = fetchByPrimaryKey(primaryKey);
1181
1182 if (passwordPolicyRel == null) {
1183 if (_log.isWarnEnabled()) {
1184 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1185 }
1186
1187 throw new NoSuchPasswordPolicyRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1188 primaryKey);
1189 }
1190
1191 return passwordPolicyRel;
1192 }
1193
1194
1201 @Override
1202 public PasswordPolicyRel findByPrimaryKey(long passwordPolicyRelId)
1203 throws NoSuchPasswordPolicyRelException {
1204 return findByPrimaryKey((Serializable)passwordPolicyRelId);
1205 }
1206
1207
1213 @Override
1214 public PasswordPolicyRel fetchByPrimaryKey(Serializable primaryKey) {
1215 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)entityCache.getResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
1216 PasswordPolicyRelImpl.class, primaryKey);
1217
1218 if (passwordPolicyRel == _nullPasswordPolicyRel) {
1219 return null;
1220 }
1221
1222 if (passwordPolicyRel == null) {
1223 Session session = null;
1224
1225 try {
1226 session = openSession();
1227
1228 passwordPolicyRel = (PasswordPolicyRel)session.get(PasswordPolicyRelImpl.class,
1229 primaryKey);
1230
1231 if (passwordPolicyRel != null) {
1232 cacheResult(passwordPolicyRel);
1233 }
1234 else {
1235 entityCache.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
1236 PasswordPolicyRelImpl.class, primaryKey,
1237 _nullPasswordPolicyRel);
1238 }
1239 }
1240 catch (Exception e) {
1241 entityCache.removeResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
1242 PasswordPolicyRelImpl.class, primaryKey);
1243
1244 throw processException(e);
1245 }
1246 finally {
1247 closeSession(session);
1248 }
1249 }
1250
1251 return passwordPolicyRel;
1252 }
1253
1254
1260 @Override
1261 public PasswordPolicyRel fetchByPrimaryKey(long passwordPolicyRelId) {
1262 return fetchByPrimaryKey((Serializable)passwordPolicyRelId);
1263 }
1264
1265 @Override
1266 public Map<Serializable, PasswordPolicyRel> fetchByPrimaryKeys(
1267 Set<Serializable> primaryKeys) {
1268 if (primaryKeys.isEmpty()) {
1269 return Collections.emptyMap();
1270 }
1271
1272 Map<Serializable, PasswordPolicyRel> map = new HashMap<Serializable, PasswordPolicyRel>();
1273
1274 if (primaryKeys.size() == 1) {
1275 Iterator<Serializable> iterator = primaryKeys.iterator();
1276
1277 Serializable primaryKey = iterator.next();
1278
1279 PasswordPolicyRel passwordPolicyRel = fetchByPrimaryKey(primaryKey);
1280
1281 if (passwordPolicyRel != null) {
1282 map.put(primaryKey, passwordPolicyRel);
1283 }
1284
1285 return map;
1286 }
1287
1288 Set<Serializable> uncachedPrimaryKeys = null;
1289
1290 for (Serializable primaryKey : primaryKeys) {
1291 PasswordPolicyRel passwordPolicyRel = (PasswordPolicyRel)entityCache.getResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
1292 PasswordPolicyRelImpl.class, primaryKey);
1293
1294 if (passwordPolicyRel == null) {
1295 if (uncachedPrimaryKeys == null) {
1296 uncachedPrimaryKeys = new HashSet<Serializable>();
1297 }
1298
1299 uncachedPrimaryKeys.add(primaryKey);
1300 }
1301 else {
1302 map.put(primaryKey, passwordPolicyRel);
1303 }
1304 }
1305
1306 if (uncachedPrimaryKeys == null) {
1307 return map;
1308 }
1309
1310 StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
1311 1);
1312
1313 query.append(_SQL_SELECT_PASSWORDPOLICYREL_WHERE_PKS_IN);
1314
1315 for (Serializable primaryKey : uncachedPrimaryKeys) {
1316 query.append(String.valueOf(primaryKey));
1317
1318 query.append(StringPool.COMMA);
1319 }
1320
1321 query.setIndex(query.index() - 1);
1322
1323 query.append(StringPool.CLOSE_PARENTHESIS);
1324
1325 String sql = query.toString();
1326
1327 Session session = null;
1328
1329 try {
1330 session = openSession();
1331
1332 Query q = session.createQuery(sql);
1333
1334 for (PasswordPolicyRel passwordPolicyRel : (List<PasswordPolicyRel>)q.list()) {
1335 map.put(passwordPolicyRel.getPrimaryKeyObj(), passwordPolicyRel);
1336
1337 cacheResult(passwordPolicyRel);
1338
1339 uncachedPrimaryKeys.remove(passwordPolicyRel.getPrimaryKeyObj());
1340 }
1341
1342 for (Serializable primaryKey : uncachedPrimaryKeys) {
1343 entityCache.putResult(PasswordPolicyRelModelImpl.ENTITY_CACHE_ENABLED,
1344 PasswordPolicyRelImpl.class, primaryKey,
1345 _nullPasswordPolicyRel);
1346 }
1347 }
1348 catch (Exception e) {
1349 throw processException(e);
1350 }
1351 finally {
1352 closeSession(session);
1353 }
1354
1355 return map;
1356 }
1357
1358
1363 @Override
1364 public List<PasswordPolicyRel> findAll() {
1365 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1366 }
1367
1368
1379 @Override
1380 public List<PasswordPolicyRel> findAll(int start, int end) {
1381 return findAll(start, end, null);
1382 }
1383
1384
1396 @Override
1397 public List<PasswordPolicyRel> findAll(int start, int end,
1398 OrderByComparator<PasswordPolicyRel> orderByComparator) {
1399 return findAll(start, end, orderByComparator, true);
1400 }
1401
1402
1415 @Override
1416 public List<PasswordPolicyRel> findAll(int start, int end,
1417 OrderByComparator<PasswordPolicyRel> orderByComparator,
1418 boolean retrieveFromCache) {
1419 boolean pagination = true;
1420 FinderPath finderPath = null;
1421 Object[] finderArgs = null;
1422
1423 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1424 (orderByComparator == null)) {
1425 pagination = false;
1426 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1427 finderArgs = FINDER_ARGS_EMPTY;
1428 }
1429 else {
1430 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1431 finderArgs = new Object[] { start, end, orderByComparator };
1432 }
1433
1434 List<PasswordPolicyRel> list = null;
1435
1436 if (retrieveFromCache) {
1437 list = (List<PasswordPolicyRel>)finderCache.getResult(finderPath,
1438 finderArgs, this);
1439 }
1440
1441 if (list == null) {
1442 StringBundler query = null;
1443 String sql = null;
1444
1445 if (orderByComparator != null) {
1446 query = new StringBundler(2 +
1447 (orderByComparator.getOrderByFields().length * 3));
1448
1449 query.append(_SQL_SELECT_PASSWORDPOLICYREL);
1450
1451 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1452 orderByComparator);
1453
1454 sql = query.toString();
1455 }
1456 else {
1457 sql = _SQL_SELECT_PASSWORDPOLICYREL;
1458
1459 if (pagination) {
1460 sql = sql.concat(PasswordPolicyRelModelImpl.ORDER_BY_JPQL);
1461 }
1462 }
1463
1464 Session session = null;
1465
1466 try {
1467 session = openSession();
1468
1469 Query q = session.createQuery(sql);
1470
1471 if (!pagination) {
1472 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
1473 getDialect(), start, end, false);
1474
1475 Collections.sort(list);
1476
1477 list = Collections.unmodifiableList(list);
1478 }
1479 else {
1480 list = (List<PasswordPolicyRel>)QueryUtil.list(q,
1481 getDialect(), start, end);
1482 }
1483
1484 cacheResult(list);
1485
1486 finderCache.putResult(finderPath, finderArgs, list);
1487 }
1488 catch (Exception e) {
1489 finderCache.removeResult(finderPath, finderArgs);
1490
1491 throw processException(e);
1492 }
1493 finally {
1494 closeSession(session);
1495 }
1496 }
1497
1498 return list;
1499 }
1500
1501
1505 @Override
1506 public void removeAll() {
1507 for (PasswordPolicyRel passwordPolicyRel : findAll()) {
1508 remove(passwordPolicyRel);
1509 }
1510 }
1511
1512
1517 @Override
1518 public int countAll() {
1519 Long count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,
1520 FINDER_ARGS_EMPTY, this);
1521
1522 if (count == null) {
1523 Session session = null;
1524
1525 try {
1526 session = openSession();
1527
1528 Query q = session.createQuery(_SQL_COUNT_PASSWORDPOLICYREL);
1529
1530 count = (Long)q.uniqueResult();
1531
1532 finderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,
1533 count);
1534 }
1535 catch (Exception e) {
1536 finderCache.removeResult(FINDER_PATH_COUNT_ALL,
1537 FINDER_ARGS_EMPTY);
1538
1539 throw processException(e);
1540 }
1541 finally {
1542 closeSession(session);
1543 }
1544 }
1545
1546 return count.intValue();
1547 }
1548
1549 @Override
1550 protected Map<String, Integer> getTableColumnsMap() {
1551 return PasswordPolicyRelModelImpl.TABLE_COLUMNS_MAP;
1552 }
1553
1554
1557 public void afterPropertiesSet() {
1558 }
1559
1560 public void destroy() {
1561 entityCache.removeCache(PasswordPolicyRelImpl.class.getName());
1562 finderCache.removeCache(FINDER_CLASS_NAME_ENTITY);
1563 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1564 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1565 }
1566
1567 @BeanReference(type = CompanyProvider.class)
1568 protected CompanyProvider companyProvider;
1569 protected EntityCache entityCache = EntityCacheUtil.getEntityCache();
1570 protected FinderCache finderCache = FinderCacheUtil.getFinderCache();
1571 private static final String _SQL_SELECT_PASSWORDPOLICYREL = "SELECT passwordPolicyRel FROM PasswordPolicyRel passwordPolicyRel";
1572 private static final String _SQL_SELECT_PASSWORDPOLICYREL_WHERE_PKS_IN = "SELECT passwordPolicyRel FROM PasswordPolicyRel passwordPolicyRel WHERE passwordPolicyRelId IN (";
1573 private static final String _SQL_SELECT_PASSWORDPOLICYREL_WHERE = "SELECT passwordPolicyRel FROM PasswordPolicyRel passwordPolicyRel WHERE ";
1574 private static final String _SQL_COUNT_PASSWORDPOLICYREL = "SELECT COUNT(passwordPolicyRel) FROM PasswordPolicyRel passwordPolicyRel";
1575 private static final String _SQL_COUNT_PASSWORDPOLICYREL_WHERE = "SELECT COUNT(passwordPolicyRel) FROM PasswordPolicyRel passwordPolicyRel WHERE ";
1576 private static final String _ORDER_BY_ENTITY_ALIAS = "passwordPolicyRel.";
1577 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordPolicyRel exists with the primary key ";
1578 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordPolicyRel exists with the key {";
1579 private static final Log _log = LogFactoryUtil.getLog(PasswordPolicyRelPersistenceImpl.class);
1580 private static final PasswordPolicyRel _nullPasswordPolicyRel = new PasswordPolicyRelImpl() {
1581 @Override
1582 public Object clone() {
1583 return this;
1584 }
1585
1586 @Override
1587 public CacheModel<PasswordPolicyRel> toCacheModel() {
1588 return _nullPasswordPolicyRelCacheModel;
1589 }
1590 };
1591
1592 private static final CacheModel<PasswordPolicyRel> _nullPasswordPolicyRelCacheModel =
1593 new NullCacheModel();
1594
1595 private static class NullCacheModel implements CacheModel<PasswordPolicyRel>,
1596 MVCCModel {
1597 @Override
1598 public long getMvccVersion() {
1599 return -1;
1600 }
1601
1602 @Override
1603 public void setMvccVersion(long mvccVersion) {
1604 }
1605
1606 @Override
1607 public PasswordPolicyRel toEntityModel() {
1608 return _nullPasswordPolicyRel;
1609 }
1610 }
1611 }