public CFBamDelSubDep3Buff readBuffByIdIdx( CFBamAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFBamRamScope.readBuffByIdIdx() "; CFBamScopeBuff buff = readDerivedByIdIdx(Authorization, TenantId, Id); if ((buff != null) && buff.getClassCode().equals("SCOP")) { return ((CFBamDelSubDep3Buff) buff); } else { return (null); } }
public CFBamDelSubDep3Buff[] readBuffByTenantIdx( CFBamAuthorization Authorization, long TenantId) { final String S_ProcName = "CFBamRamScope.readBuffByTenantIdx() "; CFBamScopeBuff buff; ArrayList<CFBamDelSubDep3Buff> filteredList = new ArrayList<CFBamDelSubDep3Buff>(); CFBamScopeBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCOP")) { filteredList.add((CFBamDelSubDep3Buff) buff); } } return (filteredList.toArray(new CFBamDelSubDep3Buff[0])); }
public List<ICFBamClearTopDepObj> readClearTopDepByTenantIdx(long TenantId, boolean forceRead) { final String S_ProcName = "readClearTopDepByTenantIdx"; CFBamScopeByTenantIdxKey key = schema.getBackingStore().getFactoryScope().newTenantIdxKey(); key.setRequiredTenantId(TenantId); Map<CFBamScopePKey, ICFBamClearTopDepObj> dict; if (indexByTenantIdx == null) { indexByTenantIdx = new HashMap<CFBamScopeByTenantIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>(); } if ((!forceRead) && indexByTenantIdx.containsKey(key)) { dict = indexByTenantIdx.get(key); } else { dict = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>(); // Allow other threads to dirty-read while we're loading indexByTenantIdx.put(key, dict); ICFBamScopeObj obj; CFBamScopeBuff[] buffList = schema .getBackingStore() .getTableScope() .readDerivedByTenantIdx(schema.getAuthorization(), TenantId); CFBamScopeBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFBamClearTopDepObj) schema.getScopeTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey()); obj.setBuff(buff); ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize(); } } Comparator<ICFBamClearTopDepObj> cmp = new Comparator<ICFBamClearTopDepObj>() { public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFBamScopePKey lhsPKey = lhs.getPKey(); CFBamScopePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len]; Iterator<ICFBamClearTopDepObj> 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<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFBamClearTopDepObj> sortedList = arrayList; return (sortedList); }