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