001
014
015 package com.liferay.portal.service.persistence.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.NoSuchOrgGroupRoleException;
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.OrgGroupRole;
038 import com.liferay.portal.model.impl.OrgGroupRoleImpl;
039 import com.liferay.portal.model.impl.OrgGroupRoleModelImpl;
040 import com.liferay.portal.service.persistence.CompanyProvider;
041 import com.liferay.portal.service.persistence.OrgGroupRolePK;
042 import com.liferay.portal.service.persistence.OrgGroupRolePersistence;
043
044 import java.io.Serializable;
045
046 import java.util.Collections;
047 import java.util.HashMap;
048 import java.util.List;
049 import java.util.Map;
050 import java.util.Set;
051
052
064 @ProviderType
065 public class OrgGroupRolePersistenceImpl extends BasePersistenceImpl<OrgGroupRole>
066 implements OrgGroupRolePersistence {
067
072 public static final String FINDER_CLASS_NAME_ENTITY = OrgGroupRoleImpl.class.getName();
073 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074 ".List1";
075 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
076 ".List2";
077 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
078 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, OrgGroupRoleImpl.class,
079 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
080 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
081 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, OrgGroupRoleImpl.class,
082 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
083 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
084 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
085 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
086 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
087 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, OrgGroupRoleImpl.class,
088 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
089 new String[] {
090 Long.class.getName(),
091
092 Integer.class.getName(), Integer.class.getName(),
093 OrderByComparator.class.getName()
094 });
095 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
096 new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
097 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, OrgGroupRoleImpl.class,
098 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
099 new String[] { Long.class.getName() },
100 OrgGroupRoleModelImpl.GROUPID_COLUMN_BITMASK);
101 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
102 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
103 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
104 new String[] { Long.class.getName() });
105
106
112 @Override
113 public List<OrgGroupRole> findByGroupId(long groupId) {
114 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
115 }
116
117
129 @Override
130 public List<OrgGroupRole> findByGroupId(long groupId, int start, int end) {
131 return findByGroupId(groupId, start, end, null);
132 }
133
134
147 @Override
148 public List<OrgGroupRole> findByGroupId(long groupId, int start, int end,
149 OrderByComparator<OrgGroupRole> orderByComparator) {
150 return findByGroupId(groupId, start, end, orderByComparator, true);
151 }
152
153
167 @Override
168 public List<OrgGroupRole> findByGroupId(long groupId, int start, int end,
169 OrderByComparator<OrgGroupRole> orderByComparator,
170 boolean retrieveFromCache) {
171 boolean pagination = true;
172 FinderPath finderPath = null;
173 Object[] finderArgs = null;
174
175 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
176 (orderByComparator == null)) {
177 pagination = false;
178 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
179 finderArgs = new Object[] { groupId };
180 }
181 else {
182 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
183 finderArgs = new Object[] { groupId, start, end, orderByComparator };
184 }
185
186 List<OrgGroupRole> list = null;
187
188 if (retrieveFromCache) {
189 list = (List<OrgGroupRole>)finderCache.getResult(finderPath,
190 finderArgs, this);
191
192 if ((list != null) && !list.isEmpty()) {
193 for (OrgGroupRole orgGroupRole : list) {
194 if ((groupId != orgGroupRole.getGroupId())) {
195 list = null;
196
197 break;
198 }
199 }
200 }
201 }
202
203 if (list == null) {
204 StringBundler query = null;
205
206 if (orderByComparator != null) {
207 query = new StringBundler(3 +
208 (orderByComparator.getOrderByFields().length * 3));
209 }
210 else {
211 query = new StringBundler(3);
212 }
213
214 query.append(_SQL_SELECT_ORGGROUPROLE_WHERE);
215
216 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
217
218 if (orderByComparator != null) {
219 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
220 orderByComparator);
221 }
222 else
223 if (pagination) {
224 query.append(OrgGroupRoleModelImpl.ORDER_BY_JPQL);
225 }
226
227 String sql = query.toString();
228
229 Session session = null;
230
231 try {
232 session = openSession();
233
234 Query q = session.createQuery(sql);
235
236 QueryPos qPos = QueryPos.getInstance(q);
237
238 qPos.add(groupId);
239
240 if (!pagination) {
241 list = (List<OrgGroupRole>)QueryUtil.list(q, getDialect(),
242 start, end, false);
243
244 Collections.sort(list);
245
246 list = Collections.unmodifiableList(list);
247 }
248 else {
249 list = (List<OrgGroupRole>)QueryUtil.list(q, getDialect(),
250 start, end);
251 }
252
253 cacheResult(list);
254
255 finderCache.putResult(finderPath, finderArgs, list);
256 }
257 catch (Exception e) {
258 finderCache.removeResult(finderPath, finderArgs);
259
260 throw processException(e);
261 }
262 finally {
263 closeSession(session);
264 }
265 }
266
267 return list;
268 }
269
270
278 @Override
279 public OrgGroupRole findByGroupId_First(long groupId,
280 OrderByComparator<OrgGroupRole> orderByComparator)
281 throws NoSuchOrgGroupRoleException {
282 OrgGroupRole orgGroupRole = fetchByGroupId_First(groupId,
283 orderByComparator);
284
285 if (orgGroupRole != null) {
286 return orgGroupRole;
287 }
288
289 StringBundler msg = new StringBundler(4);
290
291 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
292
293 msg.append("groupId=");
294 msg.append(groupId);
295
296 msg.append(StringPool.CLOSE_CURLY_BRACE);
297
298 throw new NoSuchOrgGroupRoleException(msg.toString());
299 }
300
301
308 @Override
309 public OrgGroupRole fetchByGroupId_First(long groupId,
310 OrderByComparator<OrgGroupRole> orderByComparator) {
311 List<OrgGroupRole> list = findByGroupId(groupId, 0, 1, orderByComparator);
312
313 if (!list.isEmpty()) {
314 return list.get(0);
315 }
316
317 return null;
318 }
319
320
328 @Override
329 public OrgGroupRole findByGroupId_Last(long groupId,
330 OrderByComparator<OrgGroupRole> orderByComparator)
331 throws NoSuchOrgGroupRoleException {
332 OrgGroupRole orgGroupRole = fetchByGroupId_Last(groupId,
333 orderByComparator);
334
335 if (orgGroupRole != null) {
336 return orgGroupRole;
337 }
338
339 StringBundler msg = new StringBundler(4);
340
341 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
342
343 msg.append("groupId=");
344 msg.append(groupId);
345
346 msg.append(StringPool.CLOSE_CURLY_BRACE);
347
348 throw new NoSuchOrgGroupRoleException(msg.toString());
349 }
350
351
358 @Override
359 public OrgGroupRole fetchByGroupId_Last(long groupId,
360 OrderByComparator<OrgGroupRole> orderByComparator) {
361 int count = countByGroupId(groupId);
362
363 if (count == 0) {
364 return null;
365 }
366
367 List<OrgGroupRole> list = findByGroupId(groupId, count - 1, count,
368 orderByComparator);
369
370 if (!list.isEmpty()) {
371 return list.get(0);
372 }
373
374 return null;
375 }
376
377
386 @Override
387 public OrgGroupRole[] findByGroupId_PrevAndNext(
388 OrgGroupRolePK orgGroupRolePK, long groupId,
389 OrderByComparator<OrgGroupRole> orderByComparator)
390 throws NoSuchOrgGroupRoleException {
391 OrgGroupRole orgGroupRole = findByPrimaryKey(orgGroupRolePK);
392
393 Session session = null;
394
395 try {
396 session = openSession();
397
398 OrgGroupRole[] array = new OrgGroupRoleImpl[3];
399
400 array[0] = getByGroupId_PrevAndNext(session, orgGroupRole, groupId,
401 orderByComparator, true);
402
403 array[1] = orgGroupRole;
404
405 array[2] = getByGroupId_PrevAndNext(session, orgGroupRole, groupId,
406 orderByComparator, false);
407
408 return array;
409 }
410 catch (Exception e) {
411 throw processException(e);
412 }
413 finally {
414 closeSession(session);
415 }
416 }
417
418 protected OrgGroupRole getByGroupId_PrevAndNext(Session session,
419 OrgGroupRole orgGroupRole, long groupId,
420 OrderByComparator<OrgGroupRole> orderByComparator, boolean previous) {
421 StringBundler query = null;
422
423 if (orderByComparator != null) {
424 query = new StringBundler(6 +
425 (orderByComparator.getOrderByFields().length * 6));
426 }
427 else {
428 query = new StringBundler(3);
429 }
430
431 query.append(_SQL_SELECT_ORGGROUPROLE_WHERE);
432
433 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
434
435 if (orderByComparator != null) {
436 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
437
438 if (orderByConditionFields.length > 0) {
439 query.append(WHERE_AND);
440 }
441
442 for (int i = 0; i < orderByConditionFields.length; i++) {
443 query.append(_ORDER_BY_ENTITY_ALIAS);
444 query.append(orderByConditionFields[i]);
445
446 if ((i + 1) < orderByConditionFields.length) {
447 if (orderByComparator.isAscending() ^ previous) {
448 query.append(WHERE_GREATER_THAN_HAS_NEXT);
449 }
450 else {
451 query.append(WHERE_LESSER_THAN_HAS_NEXT);
452 }
453 }
454 else {
455 if (orderByComparator.isAscending() ^ previous) {
456 query.append(WHERE_GREATER_THAN);
457 }
458 else {
459 query.append(WHERE_LESSER_THAN);
460 }
461 }
462 }
463
464 query.append(ORDER_BY_CLAUSE);
465
466 String[] orderByFields = orderByComparator.getOrderByFields();
467
468 for (int i = 0; i < orderByFields.length; i++) {
469 query.append(_ORDER_BY_ENTITY_ALIAS);
470 query.append(orderByFields[i]);
471
472 if ((i + 1) < orderByFields.length) {
473 if (orderByComparator.isAscending() ^ previous) {
474 query.append(ORDER_BY_ASC_HAS_NEXT);
475 }
476 else {
477 query.append(ORDER_BY_DESC_HAS_NEXT);
478 }
479 }
480 else {
481 if (orderByComparator.isAscending() ^ previous) {
482 query.append(ORDER_BY_ASC);
483 }
484 else {
485 query.append(ORDER_BY_DESC);
486 }
487 }
488 }
489 }
490 else {
491 query.append(OrgGroupRoleModelImpl.ORDER_BY_JPQL);
492 }
493
494 String sql = query.toString();
495
496 Query q = session.createQuery(sql);
497
498 q.setFirstResult(0);
499 q.setMaxResults(2);
500
501 QueryPos qPos = QueryPos.getInstance(q);
502
503 qPos.add(groupId);
504
505 if (orderByComparator != null) {
506 Object[] values = orderByComparator.getOrderByConditionValues(orgGroupRole);
507
508 for (Object value : values) {
509 qPos.add(value);
510 }
511 }
512
513 List<OrgGroupRole> list = q.list();
514
515 if (list.size() == 2) {
516 return list.get(1);
517 }
518 else {
519 return null;
520 }
521 }
522
523
528 @Override
529 public void removeByGroupId(long groupId) {
530 for (OrgGroupRole orgGroupRole : findByGroupId(groupId,
531 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
532 remove(orgGroupRole);
533 }
534 }
535
536
542 @Override
543 public int countByGroupId(long groupId) {
544 FinderPath finderPath = FINDER_PATH_COUNT_BY_GROUPID;
545
546 Object[] finderArgs = new Object[] { groupId };
547
548 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
549
550 if (count == null) {
551 StringBundler query = new StringBundler(2);
552
553 query.append(_SQL_COUNT_ORGGROUPROLE_WHERE);
554
555 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
556
557 String sql = query.toString();
558
559 Session session = null;
560
561 try {
562 session = openSession();
563
564 Query q = session.createQuery(sql);
565
566 QueryPos qPos = QueryPos.getInstance(q);
567
568 qPos.add(groupId);
569
570 count = (Long)q.uniqueResult();
571
572 finderCache.putResult(finderPath, finderArgs, count);
573 }
574 catch (Exception e) {
575 finderCache.removeResult(finderPath, finderArgs);
576
577 throw processException(e);
578 }
579 finally {
580 closeSession(session);
581 }
582 }
583
584 return count.intValue();
585 }
586
587 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "orgGroupRole.id.groupId = ?";
588 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ROLEID = new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
589 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, OrgGroupRoleImpl.class,
590 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByRoleId",
591 new String[] {
592 Long.class.getName(),
593
594 Integer.class.getName(), Integer.class.getName(),
595 OrderByComparator.class.getName()
596 });
597 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID =
598 new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
599 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, OrgGroupRoleImpl.class,
600 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByRoleId",
601 new String[] { Long.class.getName() },
602 OrgGroupRoleModelImpl.ROLEID_COLUMN_BITMASK);
603 public static final FinderPath FINDER_PATH_COUNT_BY_ROLEID = new FinderPath(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
604 OrgGroupRoleModelImpl.FINDER_CACHE_ENABLED, Long.class,
605 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRoleId",
606 new String[] { Long.class.getName() });
607
608
614 @Override
615 public List<OrgGroupRole> findByRoleId(long roleId) {
616 return findByRoleId(roleId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
617 }
618
619
631 @Override
632 public List<OrgGroupRole> findByRoleId(long roleId, int start, int end) {
633 return findByRoleId(roleId, start, end, null);
634 }
635
636
649 @Override
650 public List<OrgGroupRole> findByRoleId(long roleId, int start, int end,
651 OrderByComparator<OrgGroupRole> orderByComparator) {
652 return findByRoleId(roleId, start, end, orderByComparator, true);
653 }
654
655
669 @Override
670 public List<OrgGroupRole> findByRoleId(long roleId, int start, int end,
671 OrderByComparator<OrgGroupRole> orderByComparator,
672 boolean retrieveFromCache) {
673 boolean pagination = true;
674 FinderPath finderPath = null;
675 Object[] finderArgs = null;
676
677 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
678 (orderByComparator == null)) {
679 pagination = false;
680 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID;
681 finderArgs = new Object[] { roleId };
682 }
683 else {
684 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ROLEID;
685 finderArgs = new Object[] { roleId, start, end, orderByComparator };
686 }
687
688 List<OrgGroupRole> list = null;
689
690 if (retrieveFromCache) {
691 list = (List<OrgGroupRole>)finderCache.getResult(finderPath,
692 finderArgs, this);
693
694 if ((list != null) && !list.isEmpty()) {
695 for (OrgGroupRole orgGroupRole : list) {
696 if ((roleId != orgGroupRole.getRoleId())) {
697 list = null;
698
699 break;
700 }
701 }
702 }
703 }
704
705 if (list == null) {
706 StringBundler query = null;
707
708 if (orderByComparator != null) {
709 query = new StringBundler(3 +
710 (orderByComparator.getOrderByFields().length * 3));
711 }
712 else {
713 query = new StringBundler(3);
714 }
715
716 query.append(_SQL_SELECT_ORGGROUPROLE_WHERE);
717
718 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
719
720 if (orderByComparator != null) {
721 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
722 orderByComparator);
723 }
724 else
725 if (pagination) {
726 query.append(OrgGroupRoleModelImpl.ORDER_BY_JPQL);
727 }
728
729 String sql = query.toString();
730
731 Session session = null;
732
733 try {
734 session = openSession();
735
736 Query q = session.createQuery(sql);
737
738 QueryPos qPos = QueryPos.getInstance(q);
739
740 qPos.add(roleId);
741
742 if (!pagination) {
743 list = (List<OrgGroupRole>)QueryUtil.list(q, getDialect(),
744 start, end, false);
745
746 Collections.sort(list);
747
748 list = Collections.unmodifiableList(list);
749 }
750 else {
751 list = (List<OrgGroupRole>)QueryUtil.list(q, getDialect(),
752 start, end);
753 }
754
755 cacheResult(list);
756
757 finderCache.putResult(finderPath, finderArgs, list);
758 }
759 catch (Exception e) {
760 finderCache.removeResult(finderPath, finderArgs);
761
762 throw processException(e);
763 }
764 finally {
765 closeSession(session);
766 }
767 }
768
769 return list;
770 }
771
772
780 @Override
781 public OrgGroupRole findByRoleId_First(long roleId,
782 OrderByComparator<OrgGroupRole> orderByComparator)
783 throws NoSuchOrgGroupRoleException {
784 OrgGroupRole orgGroupRole = fetchByRoleId_First(roleId,
785 orderByComparator);
786
787 if (orgGroupRole != null) {
788 return orgGroupRole;
789 }
790
791 StringBundler msg = new StringBundler(4);
792
793 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
794
795 msg.append("roleId=");
796 msg.append(roleId);
797
798 msg.append(StringPool.CLOSE_CURLY_BRACE);
799
800 throw new NoSuchOrgGroupRoleException(msg.toString());
801 }
802
803
810 @Override
811 public OrgGroupRole fetchByRoleId_First(long roleId,
812 OrderByComparator<OrgGroupRole> orderByComparator) {
813 List<OrgGroupRole> list = findByRoleId(roleId, 0, 1, orderByComparator);
814
815 if (!list.isEmpty()) {
816 return list.get(0);
817 }
818
819 return null;
820 }
821
822
830 @Override
831 public OrgGroupRole findByRoleId_Last(long roleId,
832 OrderByComparator<OrgGroupRole> orderByComparator)
833 throws NoSuchOrgGroupRoleException {
834 OrgGroupRole orgGroupRole = fetchByRoleId_Last(roleId, orderByComparator);
835
836 if (orgGroupRole != null) {
837 return orgGroupRole;
838 }
839
840 StringBundler msg = new StringBundler(4);
841
842 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
843
844 msg.append("roleId=");
845 msg.append(roleId);
846
847 msg.append(StringPool.CLOSE_CURLY_BRACE);
848
849 throw new NoSuchOrgGroupRoleException(msg.toString());
850 }
851
852
859 @Override
860 public OrgGroupRole fetchByRoleId_Last(long roleId,
861 OrderByComparator<OrgGroupRole> orderByComparator) {
862 int count = countByRoleId(roleId);
863
864 if (count == 0) {
865 return null;
866 }
867
868 List<OrgGroupRole> list = findByRoleId(roleId, count - 1, count,
869 orderByComparator);
870
871 if (!list.isEmpty()) {
872 return list.get(0);
873 }
874
875 return null;
876 }
877
878
887 @Override
888 public OrgGroupRole[] findByRoleId_PrevAndNext(
889 OrgGroupRolePK orgGroupRolePK, long roleId,
890 OrderByComparator<OrgGroupRole> orderByComparator)
891 throws NoSuchOrgGroupRoleException {
892 OrgGroupRole orgGroupRole = findByPrimaryKey(orgGroupRolePK);
893
894 Session session = null;
895
896 try {
897 session = openSession();
898
899 OrgGroupRole[] array = new OrgGroupRoleImpl[3];
900
901 array[0] = getByRoleId_PrevAndNext(session, orgGroupRole, roleId,
902 orderByComparator, true);
903
904 array[1] = orgGroupRole;
905
906 array[2] = getByRoleId_PrevAndNext(session, orgGroupRole, roleId,
907 orderByComparator, false);
908
909 return array;
910 }
911 catch (Exception e) {
912 throw processException(e);
913 }
914 finally {
915 closeSession(session);
916 }
917 }
918
919 protected OrgGroupRole getByRoleId_PrevAndNext(Session session,
920 OrgGroupRole orgGroupRole, long roleId,
921 OrderByComparator<OrgGroupRole> orderByComparator, boolean previous) {
922 StringBundler query = null;
923
924 if (orderByComparator != null) {
925 query = new StringBundler(6 +
926 (orderByComparator.getOrderByFields().length * 6));
927 }
928 else {
929 query = new StringBundler(3);
930 }
931
932 query.append(_SQL_SELECT_ORGGROUPROLE_WHERE);
933
934 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
935
936 if (orderByComparator != null) {
937 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
938
939 if (orderByConditionFields.length > 0) {
940 query.append(WHERE_AND);
941 }
942
943 for (int i = 0; i < orderByConditionFields.length; i++) {
944 query.append(_ORDER_BY_ENTITY_ALIAS);
945 query.append(orderByConditionFields[i]);
946
947 if ((i + 1) < orderByConditionFields.length) {
948 if (orderByComparator.isAscending() ^ previous) {
949 query.append(WHERE_GREATER_THAN_HAS_NEXT);
950 }
951 else {
952 query.append(WHERE_LESSER_THAN_HAS_NEXT);
953 }
954 }
955 else {
956 if (orderByComparator.isAscending() ^ previous) {
957 query.append(WHERE_GREATER_THAN);
958 }
959 else {
960 query.append(WHERE_LESSER_THAN);
961 }
962 }
963 }
964
965 query.append(ORDER_BY_CLAUSE);
966
967 String[] orderByFields = orderByComparator.getOrderByFields();
968
969 for (int i = 0; i < orderByFields.length; i++) {
970 query.append(_ORDER_BY_ENTITY_ALIAS);
971 query.append(orderByFields[i]);
972
973 if ((i + 1) < orderByFields.length) {
974 if (orderByComparator.isAscending() ^ previous) {
975 query.append(ORDER_BY_ASC_HAS_NEXT);
976 }
977 else {
978 query.append(ORDER_BY_DESC_HAS_NEXT);
979 }
980 }
981 else {
982 if (orderByComparator.isAscending() ^ previous) {
983 query.append(ORDER_BY_ASC);
984 }
985 else {
986 query.append(ORDER_BY_DESC);
987 }
988 }
989 }
990 }
991 else {
992 query.append(OrgGroupRoleModelImpl.ORDER_BY_JPQL);
993 }
994
995 String sql = query.toString();
996
997 Query q = session.createQuery(sql);
998
999 q.setFirstResult(0);
1000 q.setMaxResults(2);
1001
1002 QueryPos qPos = QueryPos.getInstance(q);
1003
1004 qPos.add(roleId);
1005
1006 if (orderByComparator != null) {
1007 Object[] values = orderByComparator.getOrderByConditionValues(orgGroupRole);
1008
1009 for (Object value : values) {
1010 qPos.add(value);
1011 }
1012 }
1013
1014 List<OrgGroupRole> list = q.list();
1015
1016 if (list.size() == 2) {
1017 return list.get(1);
1018 }
1019 else {
1020 return null;
1021 }
1022 }
1023
1024
1029 @Override
1030 public void removeByRoleId(long roleId) {
1031 for (OrgGroupRole orgGroupRole : findByRoleId(roleId,
1032 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1033 remove(orgGroupRole);
1034 }
1035 }
1036
1037
1043 @Override
1044 public int countByRoleId(long roleId) {
1045 FinderPath finderPath = FINDER_PATH_COUNT_BY_ROLEID;
1046
1047 Object[] finderArgs = new Object[] { roleId };
1048
1049 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
1050
1051 if (count == null) {
1052 StringBundler query = new StringBundler(2);
1053
1054 query.append(_SQL_COUNT_ORGGROUPROLE_WHERE);
1055
1056 query.append(_FINDER_COLUMN_ROLEID_ROLEID_2);
1057
1058 String sql = query.toString();
1059
1060 Session session = null;
1061
1062 try {
1063 session = openSession();
1064
1065 Query q = session.createQuery(sql);
1066
1067 QueryPos qPos = QueryPos.getInstance(q);
1068
1069 qPos.add(roleId);
1070
1071 count = (Long)q.uniqueResult();
1072
1073 finderCache.putResult(finderPath, finderArgs, count);
1074 }
1075 catch (Exception e) {
1076 finderCache.removeResult(finderPath, finderArgs);
1077
1078 throw processException(e);
1079 }
1080 finally {
1081 closeSession(session);
1082 }
1083 }
1084
1085 return count.intValue();
1086 }
1087
1088 private static final String _FINDER_COLUMN_ROLEID_ROLEID_2 = "orgGroupRole.id.roleId = ?";
1089
1090 public OrgGroupRolePersistenceImpl() {
1091 setModelClass(OrgGroupRole.class);
1092 }
1093
1094
1099 @Override
1100 public void cacheResult(OrgGroupRole orgGroupRole) {
1101 entityCache.putResult(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1102 OrgGroupRoleImpl.class, orgGroupRole.getPrimaryKey(), orgGroupRole);
1103
1104 orgGroupRole.resetOriginalValues();
1105 }
1106
1107
1112 @Override
1113 public void cacheResult(List<OrgGroupRole> orgGroupRoles) {
1114 for (OrgGroupRole orgGroupRole : orgGroupRoles) {
1115 if (entityCache.getResult(
1116 OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1117 OrgGroupRoleImpl.class, orgGroupRole.getPrimaryKey()) == null) {
1118 cacheResult(orgGroupRole);
1119 }
1120 else {
1121 orgGroupRole.resetOriginalValues();
1122 }
1123 }
1124 }
1125
1126
1133 @Override
1134 public void clearCache() {
1135 entityCache.clearCache(OrgGroupRoleImpl.class);
1136
1137 finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
1138 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1139 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1140 }
1141
1142
1149 @Override
1150 public void clearCache(OrgGroupRole orgGroupRole) {
1151 entityCache.removeResult(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1152 OrgGroupRoleImpl.class, orgGroupRole.getPrimaryKey());
1153
1154 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1155 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1156 }
1157
1158 @Override
1159 public void clearCache(List<OrgGroupRole> orgGroupRoles) {
1160 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1161 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1162
1163 for (OrgGroupRole orgGroupRole : orgGroupRoles) {
1164 entityCache.removeResult(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1165 OrgGroupRoleImpl.class, orgGroupRole.getPrimaryKey());
1166 }
1167 }
1168
1169
1175 @Override
1176 public OrgGroupRole create(OrgGroupRolePK orgGroupRolePK) {
1177 OrgGroupRole orgGroupRole = new OrgGroupRoleImpl();
1178
1179 orgGroupRole.setNew(true);
1180 orgGroupRole.setPrimaryKey(orgGroupRolePK);
1181
1182 return orgGroupRole;
1183 }
1184
1185
1192 @Override
1193 public OrgGroupRole remove(OrgGroupRolePK orgGroupRolePK)
1194 throws NoSuchOrgGroupRoleException {
1195 return remove((Serializable)orgGroupRolePK);
1196 }
1197
1198
1205 @Override
1206 public OrgGroupRole remove(Serializable primaryKey)
1207 throws NoSuchOrgGroupRoleException {
1208 Session session = null;
1209
1210 try {
1211 session = openSession();
1212
1213 OrgGroupRole orgGroupRole = (OrgGroupRole)session.get(OrgGroupRoleImpl.class,
1214 primaryKey);
1215
1216 if (orgGroupRole == null) {
1217 if (_log.isWarnEnabled()) {
1218 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1219 }
1220
1221 throw new NoSuchOrgGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1222 primaryKey);
1223 }
1224
1225 return remove(orgGroupRole);
1226 }
1227 catch (NoSuchOrgGroupRoleException nsee) {
1228 throw nsee;
1229 }
1230 catch (Exception e) {
1231 throw processException(e);
1232 }
1233 finally {
1234 closeSession(session);
1235 }
1236 }
1237
1238 @Override
1239 protected OrgGroupRole removeImpl(OrgGroupRole orgGroupRole) {
1240 orgGroupRole = toUnwrappedModel(orgGroupRole);
1241
1242 Session session = null;
1243
1244 try {
1245 session = openSession();
1246
1247 if (!session.contains(orgGroupRole)) {
1248 orgGroupRole = (OrgGroupRole)session.get(OrgGroupRoleImpl.class,
1249 orgGroupRole.getPrimaryKeyObj());
1250 }
1251
1252 if (orgGroupRole != null) {
1253 session.delete(orgGroupRole);
1254 }
1255 }
1256 catch (Exception e) {
1257 throw processException(e);
1258 }
1259 finally {
1260 closeSession(session);
1261 }
1262
1263 if (orgGroupRole != null) {
1264 clearCache(orgGroupRole);
1265 }
1266
1267 return orgGroupRole;
1268 }
1269
1270 @Override
1271 public OrgGroupRole updateImpl(OrgGroupRole orgGroupRole) {
1272 orgGroupRole = toUnwrappedModel(orgGroupRole);
1273
1274 boolean isNew = orgGroupRole.isNew();
1275
1276 OrgGroupRoleModelImpl orgGroupRoleModelImpl = (OrgGroupRoleModelImpl)orgGroupRole;
1277
1278 Session session = null;
1279
1280 try {
1281 session = openSession();
1282
1283 if (orgGroupRole.isNew()) {
1284 session.save(orgGroupRole);
1285
1286 orgGroupRole.setNew(false);
1287 }
1288 else {
1289 orgGroupRole = (OrgGroupRole)session.merge(orgGroupRole);
1290 }
1291 }
1292 catch (Exception e) {
1293 throw processException(e);
1294 }
1295 finally {
1296 closeSession(session);
1297 }
1298
1299 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1300
1301 if (isNew || !OrgGroupRoleModelImpl.COLUMN_BITMASK_ENABLED) {
1302 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1303 }
1304
1305 else {
1306 if ((orgGroupRoleModelImpl.getColumnBitmask() &
1307 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
1308 Object[] args = new Object[] {
1309 orgGroupRoleModelImpl.getOriginalGroupId()
1310 };
1311
1312 finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
1313 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
1314 args);
1315
1316 args = new Object[] { orgGroupRoleModelImpl.getGroupId() };
1317
1318 finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
1319 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
1320 args);
1321 }
1322
1323 if ((orgGroupRoleModelImpl.getColumnBitmask() &
1324 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID.getColumnBitmask()) != 0) {
1325 Object[] args = new Object[] {
1326 orgGroupRoleModelImpl.getOriginalRoleId()
1327 };
1328
1329 finderCache.removeResult(FINDER_PATH_COUNT_BY_ROLEID, args);
1330 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID,
1331 args);
1332
1333 args = new Object[] { orgGroupRoleModelImpl.getRoleId() };
1334
1335 finderCache.removeResult(FINDER_PATH_COUNT_BY_ROLEID, args);
1336 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROLEID,
1337 args);
1338 }
1339 }
1340
1341 entityCache.putResult(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1342 OrgGroupRoleImpl.class, orgGroupRole.getPrimaryKey(), orgGroupRole,
1343 false);
1344
1345 orgGroupRole.resetOriginalValues();
1346
1347 return orgGroupRole;
1348 }
1349
1350 protected OrgGroupRole toUnwrappedModel(OrgGroupRole orgGroupRole) {
1351 if (orgGroupRole instanceof OrgGroupRoleImpl) {
1352 return orgGroupRole;
1353 }
1354
1355 OrgGroupRoleImpl orgGroupRoleImpl = new OrgGroupRoleImpl();
1356
1357 orgGroupRoleImpl.setNew(orgGroupRole.isNew());
1358 orgGroupRoleImpl.setPrimaryKey(orgGroupRole.getPrimaryKey());
1359
1360 orgGroupRoleImpl.setMvccVersion(orgGroupRole.getMvccVersion());
1361 orgGroupRoleImpl.setOrganizationId(orgGroupRole.getOrganizationId());
1362 orgGroupRoleImpl.setGroupId(orgGroupRole.getGroupId());
1363 orgGroupRoleImpl.setRoleId(orgGroupRole.getRoleId());
1364 orgGroupRoleImpl.setCompanyId(orgGroupRole.getCompanyId());
1365
1366 return orgGroupRoleImpl;
1367 }
1368
1369
1376 @Override
1377 public OrgGroupRole findByPrimaryKey(Serializable primaryKey)
1378 throws NoSuchOrgGroupRoleException {
1379 OrgGroupRole orgGroupRole = fetchByPrimaryKey(primaryKey);
1380
1381 if (orgGroupRole == null) {
1382 if (_log.isWarnEnabled()) {
1383 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1384 }
1385
1386 throw new NoSuchOrgGroupRoleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1387 primaryKey);
1388 }
1389
1390 return orgGroupRole;
1391 }
1392
1393
1400 @Override
1401 public OrgGroupRole findByPrimaryKey(OrgGroupRolePK orgGroupRolePK)
1402 throws NoSuchOrgGroupRoleException {
1403 return findByPrimaryKey((Serializable)orgGroupRolePK);
1404 }
1405
1406
1412 @Override
1413 public OrgGroupRole fetchByPrimaryKey(Serializable primaryKey) {
1414 OrgGroupRole orgGroupRole = (OrgGroupRole)entityCache.getResult(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1415 OrgGroupRoleImpl.class, primaryKey);
1416
1417 if (orgGroupRole == _nullOrgGroupRole) {
1418 return null;
1419 }
1420
1421 if (orgGroupRole == null) {
1422 Session session = null;
1423
1424 try {
1425 session = openSession();
1426
1427 orgGroupRole = (OrgGroupRole)session.get(OrgGroupRoleImpl.class,
1428 primaryKey);
1429
1430 if (orgGroupRole != null) {
1431 cacheResult(orgGroupRole);
1432 }
1433 else {
1434 entityCache.putResult(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1435 OrgGroupRoleImpl.class, primaryKey, _nullOrgGroupRole);
1436 }
1437 }
1438 catch (Exception e) {
1439 entityCache.removeResult(OrgGroupRoleModelImpl.ENTITY_CACHE_ENABLED,
1440 OrgGroupRoleImpl.class, primaryKey);
1441
1442 throw processException(e);
1443 }
1444 finally {
1445 closeSession(session);
1446 }
1447 }
1448
1449 return orgGroupRole;
1450 }
1451
1452
1458 @Override
1459 public OrgGroupRole fetchByPrimaryKey(OrgGroupRolePK orgGroupRolePK) {
1460 return fetchByPrimaryKey((Serializable)orgGroupRolePK);
1461 }
1462
1463 @Override
1464 public Map<Serializable, OrgGroupRole> fetchByPrimaryKeys(
1465 Set<Serializable> primaryKeys) {
1466 if (primaryKeys.isEmpty()) {
1467 return Collections.emptyMap();
1468 }
1469
1470 Map<Serializable, OrgGroupRole> map = new HashMap<Serializable, OrgGroupRole>();
1471
1472 for (Serializable primaryKey : primaryKeys) {
1473 OrgGroupRole orgGroupRole = fetchByPrimaryKey(primaryKey);
1474
1475 if (orgGroupRole != null) {
1476 map.put(primaryKey, orgGroupRole);
1477 }
1478 }
1479
1480 return map;
1481 }
1482
1483
1488 @Override
1489 public List<OrgGroupRole> findAll() {
1490 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1491 }
1492
1493
1504 @Override
1505 public List<OrgGroupRole> findAll(int start, int end) {
1506 return findAll(start, end, null);
1507 }
1508
1509
1521 @Override
1522 public List<OrgGroupRole> findAll(int start, int end,
1523 OrderByComparator<OrgGroupRole> orderByComparator) {
1524 return findAll(start, end, orderByComparator, true);
1525 }
1526
1527
1540 @Override
1541 public List<OrgGroupRole> findAll(int start, int end,
1542 OrderByComparator<OrgGroupRole> orderByComparator,
1543 boolean retrieveFromCache) {
1544 boolean pagination = true;
1545 FinderPath finderPath = null;
1546 Object[] finderArgs = null;
1547
1548 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1549 (orderByComparator == null)) {
1550 pagination = false;
1551 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1552 finderArgs = FINDER_ARGS_EMPTY;
1553 }
1554 else {
1555 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1556 finderArgs = new Object[] { start, end, orderByComparator };
1557 }
1558
1559 List<OrgGroupRole> list = null;
1560
1561 if (retrieveFromCache) {
1562 list = (List<OrgGroupRole>)finderCache.getResult(finderPath,
1563 finderArgs, this);
1564 }
1565
1566 if (list == null) {
1567 StringBundler query = null;
1568 String sql = null;
1569
1570 if (orderByComparator != null) {
1571 query = new StringBundler(2 +
1572 (orderByComparator.getOrderByFields().length * 3));
1573
1574 query.append(_SQL_SELECT_ORGGROUPROLE);
1575
1576 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1577 orderByComparator);
1578
1579 sql = query.toString();
1580 }
1581 else {
1582 sql = _SQL_SELECT_ORGGROUPROLE;
1583
1584 if (pagination) {
1585 sql = sql.concat(OrgGroupRoleModelImpl.ORDER_BY_JPQL);
1586 }
1587 }
1588
1589 Session session = null;
1590
1591 try {
1592 session = openSession();
1593
1594 Query q = session.createQuery(sql);
1595
1596 if (!pagination) {
1597 list = (List<OrgGroupRole>)QueryUtil.list(q, getDialect(),
1598 start, end, false);
1599
1600 Collections.sort(list);
1601
1602 list = Collections.unmodifiableList(list);
1603 }
1604 else {
1605 list = (List<OrgGroupRole>)QueryUtil.list(q, getDialect(),
1606 start, end);
1607 }
1608
1609 cacheResult(list);
1610
1611 finderCache.putResult(finderPath, finderArgs, list);
1612 }
1613 catch (Exception e) {
1614 finderCache.removeResult(finderPath, finderArgs);
1615
1616 throw processException(e);
1617 }
1618 finally {
1619 closeSession(session);
1620 }
1621 }
1622
1623 return list;
1624 }
1625
1626
1630 @Override
1631 public void removeAll() {
1632 for (OrgGroupRole orgGroupRole : findAll()) {
1633 remove(orgGroupRole);
1634 }
1635 }
1636
1637
1642 @Override
1643 public int countAll() {
1644 Long count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,
1645 FINDER_ARGS_EMPTY, this);
1646
1647 if (count == null) {
1648 Session session = null;
1649
1650 try {
1651 session = openSession();
1652
1653 Query q = session.createQuery(_SQL_COUNT_ORGGROUPROLE);
1654
1655 count = (Long)q.uniqueResult();
1656
1657 finderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,
1658 count);
1659 }
1660 catch (Exception e) {
1661 finderCache.removeResult(FINDER_PATH_COUNT_ALL,
1662 FINDER_ARGS_EMPTY);
1663
1664 throw processException(e);
1665 }
1666 finally {
1667 closeSession(session);
1668 }
1669 }
1670
1671 return count.intValue();
1672 }
1673
1674 @Override
1675 protected Map<String, Integer> getTableColumnsMap() {
1676 return OrgGroupRoleModelImpl.TABLE_COLUMNS_MAP;
1677 }
1678
1679
1682 public void afterPropertiesSet() {
1683 }
1684
1685 public void destroy() {
1686 entityCache.removeCache(OrgGroupRoleImpl.class.getName());
1687 finderCache.removeCache(FINDER_CLASS_NAME_ENTITY);
1688 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1689 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1690 }
1691
1692 @BeanReference(type = CompanyProvider.class)
1693 protected CompanyProvider companyProvider;
1694 protected EntityCache entityCache = EntityCacheUtil.getEntityCache();
1695 protected FinderCache finderCache = FinderCacheUtil.getFinderCache();
1696 private static final String _SQL_SELECT_ORGGROUPROLE = "SELECT orgGroupRole FROM OrgGroupRole orgGroupRole";
1697 private static final String _SQL_SELECT_ORGGROUPROLE_WHERE = "SELECT orgGroupRole FROM OrgGroupRole orgGroupRole WHERE ";
1698 private static final String _SQL_COUNT_ORGGROUPROLE = "SELECT COUNT(orgGroupRole) FROM OrgGroupRole orgGroupRole";
1699 private static final String _SQL_COUNT_ORGGROUPROLE_WHERE = "SELECT COUNT(orgGroupRole) FROM OrgGroupRole orgGroupRole WHERE ";
1700 private static final String _ORDER_BY_ENTITY_ALIAS = "orgGroupRole.";
1701 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No OrgGroupRole exists with the primary key ";
1702 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No OrgGroupRole exists with the key {";
1703 private static final Log _log = LogFactoryUtil.getLog(OrgGroupRolePersistenceImpl.class);
1704 private static final OrgGroupRole _nullOrgGroupRole = new OrgGroupRoleImpl() {
1705 @Override
1706 public Object clone() {
1707 return this;
1708 }
1709
1710 @Override
1711 public CacheModel<OrgGroupRole> toCacheModel() {
1712 return _nullOrgGroupRoleCacheModel;
1713 }
1714 };
1715
1716 private static final CacheModel<OrgGroupRole> _nullOrgGroupRoleCacheModel = new NullCacheModel();
1717
1718 private static class NullCacheModel implements CacheModel<OrgGroupRole>,
1719 MVCCModel {
1720 @Override
1721 public long getMvccVersion() {
1722 return -1;
1723 }
1724
1725 @Override
1726 public void setMvccVersion(long mvccVersion) {
1727 }
1728
1729 @Override
1730 public OrgGroupRole toEntityModel() {
1731 return _nullOrgGroupRole;
1732 }
1733 }
1734 }