public ICFSecurityTSecGroupMemberObj readTSecGroupMemberByUUserIdx( long TenantId, int TSecGroupId, UUID SecUserId, boolean forceRead) { if (indexByUUserIdx == null) { indexByUUserIdx = new HashMap<CFSecurityTSecGroupMemberByUUserIdxKey, ICFSecurityTSecGroupMemberObj>(); } CFSecurityTSecGroupMemberByUUserIdxKey key = ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTSecGroupId(TSecGroupId); key.setRequiredSecUserId(SecUserId); ICFSecurityTSecGroupMemberObj obj = null; if ((!forceRead) && indexByUUserIdx.containsKey(key)) { obj = indexByUUserIdx.get(key); } else { CFSecurityTSecGroupMemberBuff buff = ((ICFCrmSchema) schema.getBackingStore()) .getTableTSecGroupMember() .readDerivedByUUserIdx(schema.getAuthorization(), TenantId, TSecGroupId, SecUserId); if (buff != null) { obj = schema.getTSecGroupMemberTableObj().newInstance(); obj.setPKey( ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey()); obj.setBuff(buff); obj = (ICFSecurityTSecGroupMemberObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUUserIdx.put(key, null); } } return (obj); }
public ICFSecurityTSecGroupMemberObj readTSecGroupMember( CFSecurityTSecGroupMemberPKey pkey, boolean forceRead) { ICFSecurityTSecGroupMemberObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFSecurityTSecGroupMemberBuff readBuff = ((ICFCrmSchema) schema.getBackingStore()) .getTableTSecGroupMember() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredTenantId(), pkey.getRequiredTSecGroupMemberId()); if (readBuff != null) { obj = schema.getTSecGroupMemberTableObj().newInstance(); obj.setPKey( ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey()); obj.setBuff(readBuff); obj = (ICFSecurityTSecGroupMemberObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public ICFSecurityTSecGroupMemberObj lockTSecGroupMember(CFSecurityTSecGroupMemberPKey pkey) { ICFSecurityTSecGroupMemberObj locked = null; CFSecurityTSecGroupMemberBuff lockBuff = ((ICFCrmSchema) schema.getBackingStore()) .getTableTSecGroupMember() .lockDerived(schema.getAuthorization(), pkey); if (lockBuff != null) { locked = schema.getTSecGroupMemberTableObj().newInstance(); locked.setPKey( ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey()); locked.setBuff(lockBuff); locked = (ICFSecurityTSecGroupMemberObj) locked.realize(); } else { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "lockTSecGroupMember", pkey); } return (locked); }
public List<ICFSecurityTSecGroupMemberObj> readTSecGroupMemberByUserIdx( UUID SecUserId, boolean forceRead) { final String S_ProcName = "readTSecGroupMemberByUserIdx"; CFSecurityTSecGroupMemberByUserIdxKey key = ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> dict; if (indexByUserIdx == null) { indexByUserIdx = new HashMap< CFSecurityTSecGroupMemberByUserIdxKey, Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj>>(); } if ((!forceRead) && indexByUserIdx.containsKey(key)) { dict = indexByUserIdx.get(key); } else { dict = new HashMap<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj>(); // Allow other threads to dirty-read while we're loading indexByUserIdx.put(key, dict); ICFSecurityTSecGroupMemberObj obj; CFSecurityTSecGroupMemberBuff[] buffList = ((ICFCrmSchema) schema.getBackingStore()) .getTableTSecGroupMember() .readDerivedByUserIdx(schema.getAuthorization(), SecUserId); CFSecurityTSecGroupMemberBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = schema.getTSecGroupMemberTableObj().newInstance(); obj.setPKey( ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey()); obj.setBuff(buff); ICFSecurityTSecGroupMemberObj realized = (ICFSecurityTSecGroupMemberObj) obj.realize(); } } Comparator<ICFSecurityTSecGroupMemberObj> cmp = new Comparator<ICFSecurityTSecGroupMemberObj>() { public int compare(ICFSecurityTSecGroupMemberObj lhs, ICFSecurityTSecGroupMemberObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecurityTSecGroupMemberPKey lhsPKey = lhs.getPKey(); CFSecurityTSecGroupMemberPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFSecurityTSecGroupMemberObj arr[] = new ICFSecurityTSecGroupMemberObj[len]; Iterator<ICFSecurityTSecGroupMemberObj> valIter = dict.values().iterator(); int idx = 0; while ((idx < len) && valIter.hasNext()) { arr[idx++] = valIter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len); } else if (valIter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len); } Arrays.sort(arr, cmp); ArrayList<ICFSecurityTSecGroupMemberObj> arrayList = new ArrayList<ICFSecurityTSecGroupMemberObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecurityTSecGroupMemberObj> sortedList = arrayList; return (sortedList); }