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