public List<ICFCrmMemoObj> readAllMemo(boolean forceRead) { final String S_ProcName = "readAllMemo"; if ((allMemo == null) || forceRead) { Map<CFCrmMemoPKey, ICFCrmMemoObj> map = new HashMap<CFCrmMemoPKey, ICFCrmMemoObj>(); allMemo = map; CFCrmMemoBuff[] buffList = ((ICFAccSchema) schema.getBackingStore()) .getTableMemo() .readAllDerived(schema.getAuthorization()); CFCrmMemoBuff buff; ICFCrmMemoObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newPKey()); obj.setBuff(buff); ICFCrmMemoObj realized = (ICFCrmMemoObj) obj.realize(); } } Comparator<ICFCrmMemoObj> cmp = new Comparator<ICFCrmMemoObj>() { public int compare(ICFCrmMemoObj lhs, ICFCrmMemoObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFCrmMemoPKey lhsPKey = lhs.getPKey(); CFCrmMemoPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allMemo.size(); ICFCrmMemoObj arr[] = new ICFCrmMemoObj[len]; Iterator<ICFCrmMemoObj> valIter = allMemo.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<ICFCrmMemoObj> arrayList = new ArrayList<ICFCrmMemoObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFCrmMemoObj> sortedList = arrayList; return (sortedList); }
public CFDbTestNumberDefBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFDbTestRamNumberDef.readAllBuff"; CFDbTestNumberDefBuff buff; ArrayList<CFDbTestNumberDefBuff> filteredList = new ArrayList<CFDbTestNumberDefBuff>(); CFDbTestNumberDefBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("NUMD")) { filteredList.add(buff); } } return (filteredList.toArray(new CFDbTestNumberDefBuff[0])); }
public CFDbTestNumberDefBuff[] readBuffByNextIdx( CFSecurityAuthorization Authorization, Long NextTenantId, Long NextId) { final String S_ProcName = "CFDbTestRamValue.readBuffByNextIdx() "; CFDbTestNumberDefBuff buff; ArrayList<CFDbTestNumberDefBuff> filteredList = new ArrayList<CFDbTestNumberDefBuff>(); CFDbTestNumberDefBuff[] buffList = readDerivedByNextIdx(Authorization, NextTenantId, NextId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VALU")) { filteredList.add((CFDbTestNumberDefBuff) buff); } } return (filteredList.toArray(new CFDbTestNumberDefBuff[0])); }
public CFSecurityHostNodeBuff[] readBuffByClusterIdx( CFSecurityAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAccRamHostNode.readBuffByClusterIdx() "; CFSecurityHostNodeBuff buff; ArrayList<CFSecurityHostNodeBuff> filteredList = new ArrayList<CFSecurityHostNodeBuff>(); CFSecurityHostNodeBuff[] buffList = readDerivedByClusterIdx(Authorization, ClusterId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("HSND")) { filteredList.add((CFSecurityHostNodeBuff) buff); } } return (filteredList.toArray(new CFSecurityHostNodeBuff[0])); }
public CFDbTestNumberDefBuff[] readDerivedByNextIdx( CFSecurityAuthorization Authorization, Long NextTenantId, Long NextId) { final String S_ProcName = "CFDbTestRamValue.readDerivedByNextIdx"; CFDbTestValueBuff buffList[] = schema.getTableValue().readDerivedByNextIdx(Authorization, NextTenantId, NextId); if (buffList == null) { return (null); } else { CFDbTestValueBuff buff; ArrayList<CFDbTestNumberDefBuff> filteredList = new ArrayList<CFDbTestNumberDefBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFDbTestNumberDefBuff)) { filteredList.add((CFDbTestNumberDefBuff) buff); } } return (filteredList.toArray(new CFDbTestNumberDefBuff[0])); } }
public CFSecuritySecGroupFormBuff[] readBuffByAppIdx( CFSecurityAuthorization Authorization, long ClusterId, int SecAppId) { final String S_ProcName = "CFInternetRamSecGroupForm.readBuffByAppIdx() "; CFSecuritySecGroupFormBuff buff; ArrayList<CFSecuritySecGroupFormBuff> filteredList = new ArrayList<CFSecuritySecGroupFormBuff>(); CFSecuritySecGroupFormBuff[] buffList = readDerivedByAppIdx(Authorization, ClusterId, SecAppId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SGFM")) { filteredList.add((CFSecuritySecGroupFormBuff) buff); } } return (filteredList.toArray(new CFSecuritySecGroupFormBuff[0])); }
public List<ICFCrmMemoObj> readMemoByMemoContactIdx( long TenantId, long ContactId, boolean forceRead) { final String S_ProcName = "readMemoByMemoContactIdx"; CFCrmMemoByMemoContactIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newMemoContactIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContactId(ContactId); Map<CFCrmMemoPKey, ICFCrmMemoObj> dict; if (indexByMemoContactIdx == null) { indexByMemoContactIdx = new HashMap<CFCrmMemoByMemoContactIdxKey, Map<CFCrmMemoPKey, ICFCrmMemoObj>>(); } if ((!forceRead) && indexByMemoContactIdx.containsKey(key)) { dict = indexByMemoContactIdx.get(key); } else { dict = new HashMap<CFCrmMemoPKey, ICFCrmMemoObj>(); // Allow other threads to dirty-read while we're loading indexByMemoContactIdx.put(key, dict); ICFCrmMemoObj obj; CFCrmMemoBuff[] buffList = ((ICFAccSchema) schema.getBackingStore()) .getTableMemo() .readDerivedByMemoContactIdx(schema.getAuthorization(), TenantId, ContactId); CFCrmMemoBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = schema.getMemoTableObj().newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newPKey()); obj.setBuff(buff); ICFCrmMemoObj realized = (ICFCrmMemoObj) obj.realize(); } } Comparator<ICFCrmMemoObj> cmp = new Comparator<ICFCrmMemoObj>() { public int compare(ICFCrmMemoObj lhs, ICFCrmMemoObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFCrmMemoPKey lhsPKey = lhs.getPKey(); CFCrmMemoPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFCrmMemoObj arr[] = new ICFCrmMemoObj[len]; Iterator<ICFCrmMemoObj> 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<ICFCrmMemoObj> arrayList = new ArrayList<ICFCrmMemoObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFCrmMemoObj> sortedList = arrayList; return (sortedList); }