public void setSwingDataCollection(Collection<ICFBamServerListFuncObj> value) { final String S_ProcName = "setSwingDataCollection"; swingDataCollection = value; if (swingDataCollection == null) { arrayOfServerListFunc = new ICFBamServerListFuncObj[0]; } else { int len = value.size(); arrayOfServerListFunc = new ICFBamServerListFuncObj[len]; Iterator<ICFBamServerListFuncObj> iter = swingDataCollection.iterator(); int idx = 0; while (iter.hasNext() && (idx < len)) { arrayOfServerListFunc[idx++] = iter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator did not fully populate the array copy"); } if (iter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator had left over items when done populating array copy"); } Arrays.sort(arrayOfServerListFunc, compareServerListFuncByQualName); } PickerTableModel tblDataModel = getDataModel(); if (tblDataModel != null) { tblDataModel.fireTableDataChanged(); } }
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<ICFBamISOCountryLanguageObj> 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 void deleteClearTopDepByTenantIdx(long TenantId) { CFBamScopeByTenantIdxKey key = schema.getBackingStore().getFactoryScope().newTenantIdxKey(); key.setRequiredTenantId(TenantId); if (indexByTenantIdx == null) { indexByTenantIdx = new HashMap<CFBamScopeByTenantIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>(); } if (indexByTenantIdx.containsKey(key)) { Map<CFBamScopePKey, ICFBamClearTopDepObj> dict = indexByTenantIdx.get(key); schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByTenantIdx(schema.getAuthorization(), TenantId); Iterator<ICFBamClearTopDepObj> iter = dict.values().iterator(); ICFBamClearTopDepObj obj; List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexByTenantIdx.remove(key); } else { schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByTenantIdx(schema.getAuthorization(), TenantId); } }
public void forgetClearTopDepByContTblIdx(long TenantId, long ContTableId) { if (indexByContTblIdx == null) { return; } CFBamClearTopDepByContTblIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); if (indexByContTblIdx.containsKey(key)) { Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(key); if (mapContTblIdx != null) { List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>(); ICFBamClearTopDepObj cur = null; Iterator<ICFBamClearTopDepObj> iter = mapContTblIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByContTblIdx.remove(key); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrNextTenantId = null; String attrNextId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstInt32ColReadByNextIdx"); 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("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = 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 // 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 natNextTenantId; natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); Long natNextId; natNextId = new Long(Long.parseLong(attrNextId)); // Read the objects List<ICFBamInt32ColObj> list = schemaObj.getInt32ColTableObj().readInt32ColByNextIdx(natNextTenantId, natNextId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFBamInt32ColObj> iter = list.iterator(); ICFBamInt32ColObj 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 CFBamISOCountryBuff[] readAllDerived(CFBamAuthorization Authorization) { final String S_ProcName = "readAllDerived"; String rqst = CFBamXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFBamXMsgISOCountryMessageFormatter.formatISOCountryRqstReadAll("\n\t\t\t") + "\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(); if (sortedListObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getListOfObjects"); } @SuppressWarnings("unchecked") List<ICFBamISOCountryObj> sortedList = (List<ICFBamISOCountryObj>) sortedListObj; int sz = sortedList.size(); CFBamISOCountryBuff arr[] = new CFBamISOCountryBuff[sz]; Iterator<ICFBamISOCountryObj> iter = sortedList.iterator(); ICFBamISOCountryObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFBamISOCountryObj) iter.next(); arr[idx] = cur.getISOCountryBuff(); } return (arr); }
public List<ICFBamClearTopDepObj> readClearTopDepByContTblIdx( long TenantId, long ContTableId, boolean forceRead) { final String S_ProcName = "readClearTopDepByContTblIdx"; CFBamClearTopDepByContTblIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); Map<CFBamScopePKey, ICFBamClearTopDepObj> dict; if (indexByContTblIdx == null) { indexByContTblIdx = new HashMap<CFBamClearTopDepByContTblIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>(); } if ((!forceRead) && indexByContTblIdx.containsKey(key)) { dict = indexByContTblIdx.get(key); } else { dict = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>(); // Allow other threads to dirty-read while we're loading indexByContTblIdx.put(key, dict); ICFBamClearTopDepObj obj; CFBamClearTopDepBuff[] buffList = schema .getBackingStore() .getTableClearTopDep() .readDerivedByContTblIdx(schema.getAuthorization(), TenantId, ContTableId); CFBamClearTopDepBuff 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); }
public List<ICFBamClearTopDepObj> readAllClearTopDep(boolean forceRead) { final String S_ProcName = "readAllClearTopDep"; if ((allClearTopDep == null) || forceRead) { Map<CFBamScopePKey, ICFBamClearTopDepObj> map = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>(); allClearTopDep = map; CFBamClearTopDepBuff[] buffList = schema.getBackingStore().getTableClearTopDep().readAllDerived(schema.getAuthorization()); CFBamClearTopDepBuff buff; ICFBamClearTopDepObj obj; 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 = allClearTopDep.size(); ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len]; Iterator<ICFBamClearTopDepObj> valIter = allClearTopDep.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); }