public CFSecurityServiceBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFBamRamService.readAllDerived"; CFSecurityServiceBuff[] retList = new CFSecurityServiceBuff[dictByPKey.values().size()]; Iterator<CFSecurityServiceBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); }
public void deleteUuidDefByContPrevIdx( CFSecurityAuthorization Authorization, CFBamValueByContPrevIdxKey argKey) { final String S_ProcName = "deleteUuidDefByContPrevIdx"; CFBamUuidDefBuff cur; LinkedList<CFBamUuidDefBuff> matchSet = new LinkedList<CFBamUuidDefBuff>(); Iterator<CFBamUuidDefBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFBamUuidDefBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); String subClassCode = cur.getClassCode(); if ("UIDD".equals(subClassCode)) { schema.getTableUuidDef().deleteUuidDef(Authorization, cur); } else if ("UIDC".equals(subClassCode)) { schema.getTableUuidCol().deleteUuidCol(Authorization, (CFBamUuidColBuff) cur); } else if ("UIDT".equals(subClassCode)) { schema.getTableUuidType().deleteUuidType(Authorization, (CFBamUuidTypeBuff) cur); } else if ("IGUU".equals(subClassCode)) { schema.getTableUuidGen().deleteUuidGen(Authorization, (CFBamUuidGenBuff) cur); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "subClassCode", cur, "Instance of or subclass of UuidDef must not be \"" + subClassCode + "\""); } } }
public void deleteDomainBySubDomIdx(long TenantId, long SubDomainOfId) { CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); if (indexBySubDomIdx == null) { indexBySubDomIdx = new HashMap< CFInternetDomainBySubDomIdxKey, Map<CFInternetDomainBasePKey, ICFInternetDomainObj>>(); } if (indexBySubDomIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> dict = indexBySubDomIdx.get(key); ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); Iterator<ICFInternetDomainObj> iter = dict.values().iterator(); ICFInternetDomainObj obj; List<ICFInternetDomainObj> toForget = new LinkedList<ICFInternetDomainObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexBySubDomIdx.remove(key); } else { ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); } }
public void forgetDomainBySubDomIdx(long TenantId, long SubDomainOfId) { if (indexBySubDomIdx == null) { return; } CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); if (indexBySubDomIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(key); if (mapSubDomIdx != null) { List<ICFInternetDomainObj> toForget = new LinkedList<ICFInternetDomainObj>(); ICFInternetDomainObj cur = null; Iterator<ICFInternetDomainObj> iter = mapSubDomIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexBySubDomIdx.remove(key); } }
public CFSecurityCursor openServiceCursorByTypeIdx( CFSecurityAuthorization Authorization, int ServiceTypeId) { CFSecurityCursor cursor; CFSecurityServiceByTypeIdxKey key = schema.getFactoryService().newTypeIdxKey(); key.setRequiredServiceTypeId(ServiceTypeId); if (dictByTypeIdx.containsKey(key)) { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx = dictByTypeIdx.get(key); cursor = new CFBamRamServiceCursor(Authorization, schema, subdictTypeIdx.values()); } else { cursor = new CFBamRamServiceCursor(Authorization, schema, new ArrayList<CFSecurityServiceBuff>()); } return (cursor); }
public CFSecurityCursor openServiceCursorByHostIdx( CFSecurityAuthorization Authorization, long ClusterId, long HostNodeId) { CFSecurityCursor cursor; CFSecurityServiceByHostIdxKey key = schema.getFactoryService().newHostIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredHostNodeId(HostNodeId); if (dictByHostIdx.containsKey(key)) { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictHostIdx = dictByHostIdx.get(key); cursor = new CFBamRamServiceCursor(Authorization, schema, subdictHostIdx.values()); } else { cursor = new CFBamRamServiceCursor(Authorization, schema, new ArrayList<CFSecurityServiceBuff>()); } return (cursor); }
public void deleteServiceByUHostPortIdx( CFSecurityAuthorization Authorization, CFSecurityServiceByUHostPortIdxKey argKey) { CFSecurityServiceBuff cur; LinkedList<CFSecurityServiceBuff> matchSet = new LinkedList<CFSecurityServiceBuff>(); Iterator<CFSecurityServiceBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFSecurityServiceBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteService(Authorization, cur); } }
public CFSecurityServiceBuff[] readDerivedByTypeIdx( CFSecurityAuthorization Authorization, int ServiceTypeId) { final String S_ProcName = "CFBamRamService.readDerivedByTypeIdx"; CFSecurityServiceByTypeIdxKey key = schema.getFactoryService().newTypeIdxKey(); key.setRequiredServiceTypeId(ServiceTypeId); CFSecurityServiceBuff[] recArray; if (dictByTypeIdx.containsKey(key)) { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx = dictByTypeIdx.get(key); recArray = new CFSecurityServiceBuff[subdictTypeIdx.size()]; Iterator<CFSecurityServiceBuff> iter = subdictTypeIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx = new HashMap<CFSecurityServicePKey, CFSecurityServiceBuff>(); dictByTypeIdx.put(key, subdictTypeIdx); recArray = new CFSecurityServiceBuff[0]; } return (recArray); }
public CFSecurityCursor openServiceCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFBamRamServiceCursor(Authorization, schema, dictByPKey.values()); return (cursor); }
public List<ICFInternetDomainObj> readDomainBySubDomIdx( long TenantId, long SubDomainOfId, boolean forceRead) { final String S_ProcName = "readDomainBySubDomIdx"; CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> dict; if (indexBySubDomIdx == null) { indexBySubDomIdx = new HashMap< CFInternetDomainBySubDomIdxKey, Map<CFInternetDomainBasePKey, ICFInternetDomainObj>>(); } if ((!forceRead) && indexBySubDomIdx.containsKey(key)) { dict = indexBySubDomIdx.get(key); } else { dict = new HashMap<CFInternetDomainBasePKey, ICFInternetDomainObj>(); // Allow other threads to dirty-read while we're loading indexBySubDomIdx.put(key, dict); ICFInternetDomainObj obj; CFInternetDomainBuff[] buffList = ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .readDerivedBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); CFInternetDomainBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey()); obj.setBuff(buff); ICFInternetDomainObj realized = (ICFInternetDomainObj) obj.realize(); } } Comparator<ICFInternetDomainObj> cmp = new Comparator<ICFInternetDomainObj>() { public int compare(ICFInternetDomainObj lhs, ICFInternetDomainObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFInternetDomainBasePKey lhsPKey = lhs.getPKey(); CFInternetDomainBasePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFInternetDomainObj arr[] = new ICFInternetDomainObj[len]; Iterator<ICFInternetDomainObj> 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<ICFInternetDomainObj> arrayList = new ArrayList<ICFInternetDomainObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFInternetDomainObj> sortedList = arrayList; return (sortedList); }
public List<ICFInternetDomainObj> readAllDomain(boolean forceRead) { final String S_ProcName = "readAllDomain"; if ((allDomain == null) || forceRead) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> map = new HashMap<CFInternetDomainBasePKey, ICFInternetDomainObj>(); allDomain = map; CFInternetDomainBuff[] buffList = ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .readAllDerived(schema.getAuthorization()); CFInternetDomainBuff buff; ICFInternetDomainObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey()); obj.setBuff(buff); ICFInternetDomainObj realized = (ICFInternetDomainObj) obj.realize(); } } Comparator<ICFInternetDomainObj> cmp = new Comparator<ICFInternetDomainObj>() { public int compare(ICFInternetDomainObj lhs, ICFInternetDomainObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFInternetDomainBasePKey lhsPKey = lhs.getPKey(); CFInternetDomainBasePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allDomain.size(); ICFInternetDomainObj arr[] = new ICFInternetDomainObj[len]; Iterator<ICFInternetDomainObj> valIter = allDomain.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<ICFInternetDomainObj> arrayList = new ArrayList<ICFInternetDomainObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFInternetDomainObj> sortedList = arrayList; return (sortedList); }