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 ListIterator<ICFLibAnyObj> enumerateDetails(MssCFGenContext genContext) { final String S_ProcName = "CFBamMssCFIterateISOCountryLanguage.enumerateDetails() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext"); } ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext.getGenDef()"); } List<ICFLibAnyObj> list = new LinkedList<ICFLibAnyObj>(); if (genDef instanceof ICFBamISOCountryObj) { Iterator<ICFSecurityISOCountryLanguageObj> elements = ((ICFBamISOCountryObj) genDef).getOptionalComponentsLanguage().iterator(); while (elements.hasNext()) { list.add(elements.next()); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "genContext.getGenDef()", genDef, "ICFBamISOCountryObj"); } return (list.listIterator()); }
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 setJavaFXDataCollection(Collection<ICFBamFloatTypeObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value; observableListOfFloatType = FXCollections.observableArrayList(); if (javafxDataCollection != null) { Iterator<ICFBamFloatTypeObj> iter = javafxDataCollection.iterator(); while (iter.hasNext()) { observableListOfFloatType.add(iter.next()); } observableListOfFloatType.sort(compareFloatTypeByQualName); } if (dataTable != null) { dataTable.setItems(observableListOfFloatType); // Hack from stackoverflow to fix JavaFX TableView refresh issue ((TableColumn) dataTable.getColumns().get(0)).setVisible(false); ((TableColumn) dataTable.getColumns().get(0)).setVisible(true); } }
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 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 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 void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTZTimeTypeReadAll"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Read the objects and prepare the response XML List<ICFBamTZTimeTypeObj> list = schemaObj.getTZTimeTypeTableObj().readAllTZTimeType(true); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgTZTimeTypeMessageFormatter.formatTZTimeTypeRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFBamTZTimeTypeObj> iter = list.iterator(); ICFBamTZTimeTypeObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFBamXMsgTZTimeTypeMessageFormatter.formatTZTimeTypeRspnDerivedRec( "\n\t\t", cur.getTZTimeTypeBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFBamXMsgTZTimeTypeMessageFormatter.formatTZTimeTypeRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTenantId = null; String attrScopeId = null; String attrPrevId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstNmTokenTypeReadByContPrevIdx"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); long natScopeId; natScopeId = Long.parseLong(attrScopeId); Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } // Read the objects List<ICFBamNmTokenTypeObj> list = schemaObj .getNmTokenTypeTableObj() .readNmTokenTypeByContPrevIdx(natTenantId, natScopeId, natPrevId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFBamNmTokenTypeObj> iter = list.iterator(); ICFBamNmTokenTypeObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFBamXMsgValueMessageFormatter.formatValueRspnDerivedRec("\n\t\t", cur.getValueBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public CFInternetRealProjectBuff[] readDerivedByTenantIdx( CFSecurityAuthorization Authorization, long argTenantId) { final String S_ProcName = "readDerivedByTenantIdx"; String rqst = CFBamXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFBamXMsgRealProjectMessageFormatter.formatRealProjectRqstReadByTenantIdx( "\n\t\t\t", argTenantId) + "\n" + CFBamXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); try { schema.getCFTipClientHandler().issueAppRequest(rqst); } catch (BadPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught BadPaddingException - " + e.getMessage(), e); } catch (IllegalBlockSizeException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught IllegalBlockSizeException - " + e.getMessage(), e); } catch (InvalidKeyException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidKeyException - " + e.getMessage(), e); } catch (NoSuchAlgorithmException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchAlgorithmException - " + e.getMessage(), e); } catch (InvalidAlgorithmParameterException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidAlgorithmParameterException - " + e.getMessage(), e); } catch (NoSuchPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchPaddingException - " + e.getMessage(), e); } ICFTipResponseHandler responseHandler = schema.getCFTipClientHandler().getResponseHandler(); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedListObj = responseHandler.getListOfObjects(); @SuppressWarnings("unchecked") List<ICFInternetDomainBaseObj> sortedList = (List<ICFInternetDomainBaseObj>) sortedListObj; CFInternetRealProjectBuff arr[]; if (sortedList != null) { int sz = sortedList.size(); arr = new CFInternetRealProjectBuff[sz]; Iterator<ICFInternetDomainBaseObj> iter = sortedList.iterator(); ICFInternetRealProjectObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFInternetRealProjectObj) iter.next(); arr[idx] = cur.getRealProjectBuff(); } } else { arr = new CFInternetRealProjectBuff[0]; } return (arr); }
/** * The core evaluation of ColumnInOwnerRelation is also to determine if an index definition is in * an owner relation. * * <p>WORKING: Yes, I know. This should be a business method instead of copying the code in * ICFBamIndexObj and MSIsaGenBindColumnInOwnerRelation. * * @param genDef to be considered * @return True if the column participates in an owner relation. */ public Boolean isColumnInOwnerRelation() { ICFLibAnyObj focusDef; ICFBamTableObj tableDef; final String S_ProcName = "isColumnInOwnerRelation() "; if (this instanceof ICFBamAtomObj) { ICFBamAtomObj atomDef = (ICFBamAtomObj) this; ICFLibAnyObj atomScopeDef = atomDef.getObjScope(); tableDef = (ICFBamTableObj) atomScopeDef; focusDef = this; } else if (this instanceof ICFBamTableColObj) { ICFBamTableColObj tableColDef = (ICFBamTableColObj) this; ICFLibAnyObj tableColScopeDef = tableColDef.getObjScope(); tableDef = (ICFBamTableObj) tableColScopeDef; focusDef = this; } else if (this instanceof ICFBamIndexColObj) { ICFBamIndexColObj indexColDef = (ICFBamIndexColObj) this; focusDef = indexColDef.getRequiredLookupColumn(); if (focusDef instanceof ICFBamAtomObj) { tableDef = (ICFBamTableObj) ((ICFBamAtomObj) focusDef).getObjScope(); } else if (focusDef instanceof ICFBamTableColObj) { tableDef = (ICFBamTableObj) ((ICFBamTableColObj) focusDef).getObjScope(); } else { throw new RuntimeException( S_ProcName + "genContext.getGenDef().getColumnDef() for a ICFBamIndexColObj did not return a ICFBamAtomObj" + " nor a ICFBamTableColObj"); } } else if (this instanceof ICFBamRelationColObj) { ICFBamRelationColObj relColDef = (ICFBamRelationColObj) this; ICFLibAnyObj columnDef = relColDef.getRequiredLookupFromCol(); if (columnDef instanceof ICFBamAtomObj) { focusDef = columnDef; tableDef = (ICFBamTableObj) columnDef.getObjScope(); } else if (columnDef instanceof ICFBamTableColObj) { focusDef = columnDef; tableDef = (ICFBamTableObj) columnDef.getObjScope(); } else { throw new RuntimeException( S_ProcName + "genContext.getGenDef().getFromColumnDef() for a ICFBamIndexColObj did not return a ICFBamAtomObj" + " nor a ICFBamTableColObj"); } } else { throw new RuntimeException( S_ProcName + "genContext.getGenDef() did not return a ICFBamAtomObj, ICFBamTableColObj, nor ICFBamIndexColObj instance"); } List<ICFBamRelationObj> ownerRelations = tableDef.getContainerOwnerRelations(); if ((ownerRelations == null) || ((ownerRelations != null) && (ownerRelations.size() == 0))) { return (false); } ListIterator<ICFBamRelationObj> ownerEnumerator = ownerRelations.listIterator(); ICFBamRelationObj ownerRelation; ICFBamRelationColObj ownerRelationCol; Iterator<ICFBamRelationColObj> ownerRelationCols; while (ownerEnumerator.hasNext()) { ownerRelation = ownerEnumerator.next(); ownerRelationCols = ownerRelation.getOptionalComponentsColumns().iterator(); while (ownerRelationCols.hasNext()) { ownerRelationCol = ownerRelationCols.next(); if (ownerRelationCol.getRequiredLookupFromCol() == focusDef) { return (true); } } } return (false); }
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); }