List of usage examples for java.util SortedMap values
Collection<V> values();
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgRqstHandler.CFAstXMsgRqstSecAppReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//w ww . j ava 2 s . co m // 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("RqstSecAppReadAll"); CFAstXMsgRqstHandler xmsgRqstHandler = (CFAstXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAstSchemaObj 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 SortedMap<CFAstSecAppPKey, ICFAstSecAppObj> map = schemaObj.getSecAppTableObj().readAllSecApp(true); String responseOpening = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgSecAppMessageFormatter.formatSecAppRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAstSecAppObj> iter = map.values().iterator(); ICFAstSecAppObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAstXMsgSecAppMessageFormatter.formatSecAppRspnDerivedRec("\n\t\t", cur.getSecAppBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAstXMsgSecAppMessageFormatter.formatSecAppRspnListCloseTag() + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgRqstHandler.CFAstXMsgRqstTenantReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w w w . java 2s . c o m*/ // 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("RqstTenantReadAll"); CFAstXMsgRqstHandler xmsgRqstHandler = (CFAstXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAstSchemaObj 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 SortedMap<CFAstTenantPKey, ICFAstTenantObj> map = schemaObj.getTenantTableObj().readAllTenant(true); String responseOpening = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgTenantMessageFormatter.formatTenantRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAstTenantObj> iter = map.values().iterator(); ICFAstTenantObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAstXMsgTenantMessageFormatter.formatTenantRspnDerivedRec("\n\t\t", cur.getTenantBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAstXMsgTenantMessageFormatter.formatTenantRspnListCloseTag() + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.evaluation.F1ScoreTableAggregator.java
public static void evaluatePredictionsFoldersDomain(File masterFolder, String folderContains) throws Exception { SortedMap<String, SortedMap<String, String>> featureSetsResults = new TreeMap<>(); File[] foldersFeatureSets = masterFolder.listFiles(EvalHelper.DIRECTORY_FILTER); for (File folderFeatureSet : foldersFeatureSets) { String[] split = folderFeatureSet.getName().split("_"); String featureSet = split[0]; String paramE = split[1]; String paramT = split[2]; if ("e0".equals(paramE) && "t1".equals(paramT)) { Map<String, File> foldersData = EvalHelper.listSubFoldersAndRemoveUUID(folderFeatureSet); for (Map.Entry<String, File> folderData : foldersData.entrySet()) { String data = folderData.getKey(); if (data.contains(folderContains)) { File resultSummary = new File(folderData.getValue(), "resultSummary.txt"); List<String> values = extractValues(resultSummary); String macroF1 = values.get(0); if (!featureSetsResults.containsKey(featureSet)) { featureSetsResults.put(featureSet, new TreeMap<String, String>()); }// w w w.jav a 2 s .c om String domainName = data.split("_")[2]; featureSetsResults.get(featureSet).put(domainName, macroF1); } } } } // print results int rows = featureSetsResults.values().iterator().next().size(); System.out.printf("\t"); for (String featureSet : featureSetsResults.keySet()) { System.out.printf("%s\t", featureSet); } System.out.println(); for (int i = 0; i < rows; i++) { // Set<String> keySet = featureSetsResults.values().iterator().next().keySet(); SortedMap<String, String> firstColumn = featureSetsResults.values().iterator().next(); List<String> keys = new ArrayList<>(firstColumn.keySet()); System.out.printf("%s\t", keys.get(i)); for (SortedMap<String, String> values : featureSetsResults.values()) { System.out.printf("%s\t", values.get(keys.get(i))); } System.out.println(); } }
From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashXMsgRqstHandler.CFGCashXMsgRqstPhoneReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w w w. j a va 2s. co m*/ // 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("RqstPhoneReadAll"); CFGCashXMsgRqstHandler xmsgRqstHandler = (CFGCashXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGCashSchemaObj 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 SortedMap<CFGCashPhonePKey, ICFGCashPhoneObj> map = schemaObj.getPhoneTableObj().readAllPhone(true); String responseOpening = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGCashXMsgPhoneMessageFormatter.formatPhoneRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFGCashPhoneObj> iter = map.values().iterator(); ICFGCashPhoneObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFGCashXMsgPhoneMessageFormatter.formatPhoneRspnDerivedRec("\n\t\t", cur.getPhoneBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFGCashXMsgPhoneMessageFormatter.formatPhoneRspnListCloseTag() + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGCashXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGCashXMsgRqstHandler xmsgRqstHandler = ((CFGCashXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGCashXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGCashXMsgRqstHandler xmsgRqstHandler = ((CFGCashXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstDomainReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {// www.ja v a 2 s. c o m // 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("RqstDomainReadAll"); CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj 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 SortedMap<CFAccDomainBasePKey, ICFAccDomainObj> map = schemaObj.getDomainTableObj().readAllDomain(true); String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgDomainMessageFormatter.formatDomainRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAccDomainObj> iter = map.values().iterator(); ICFAccDomainObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAccXMsgDomainMessageFormatter.formatDomainRspnDerivedRec("\n\t\t", cur.getDomainBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAccXMsgDomainMessageFormatter.formatDomainRspnListCloseTag() + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgRqstHandler.CFAstXMsgRqstDomainReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* ww w . j ava 2 s . co m*/ // 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("RqstDomainReadAll"); CFAstXMsgRqstHandler xmsgRqstHandler = (CFAstXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAstSchemaObj 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 SortedMap<CFAstDomainBasePKey, ICFAstDomainObj> map = schemaObj.getDomainTableObj().readAllDomain(true); String responseOpening = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgDomainMessageFormatter.formatDomainRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAstDomainObj> iter = map.values().iterator(); ICFAstDomainObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAstXMsgDomainMessageFormatter.formatDomainRspnDerivedRec("\n\t\t", cur.getDomainBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAstXMsgDomainMessageFormatter.formatDomainRspnListCloseTag() + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:canreg.client.gui.components.PreviewFilePanel.java
public void init(ActionListener listener) { this.listener = listener; previewPanel.setVisible(false);//w ww .j av a 2 s . c om // get the available charsets SortedMap<String, Charset> charsets = Charset.availableCharsets(); charsetsComboBox.setModel(new javax.swing.DefaultComboBoxModel(charsets.values().toArray())); // set the default mapping charsetsComboBox.setSelectedItem(CanRegClientApp.getApplication().getGlobalToolBox().getStandardCharset()); // initializeVariableMappingTab(); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstAccountReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from ww w . j av a 2s . com // 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("RqstAccountReadAll"); CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj 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 SortedMap<CFAccAccountPKey, ICFAccAccountObj> map = schemaObj.getAccountTableObj().readAllAccount(true); String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgAccountMessageFormatter.formatAccountRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAccAccountObj> iter = map.values().iterator(); ICFAccAccountObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAccXMsgAccountMessageFormatter.formatAccountRspnDerivedRec("\n\t\t", cur.getAccountBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAccXMsgAccountMessageFormatter.formatAccountRspnListCloseTag() + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstAddressReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w ww.jav a 2 s . co m*/ // 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("RqstAddressReadAll"); CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj 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 SortedMap<CFAccAddressPKey, ICFAccAddressObj> map = schemaObj.getAddressTableObj().readAllAddress(true); String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgAddressMessageFormatter.formatAddressRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAccAddressObj> iter = map.values().iterator(); ICFAccAddressObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAccXMsgAddressMessageFormatter.formatAddressRspnDerivedRec("\n\t\t", cur.getAddressBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAccXMsgAddressMessageFormatter.formatAddressRspnListCloseTag() + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstClusterReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from ww w . j a v a 2 s .c o m*/ // 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("RqstClusterReadAll"); CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj 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 SortedMap<CFAccClusterPKey, ICFAccClusterObj> map = schemaObj.getClusterTableObj().readAllCluster(true); String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgClusterMessageFormatter.formatClusterRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAccClusterObj> iter = map.values().iterator(); ICFAccClusterObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAccXMsgClusterMessageFormatter.formatClusterRspnDerivedRec("\n\t\t", cur.getClusterBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAccXMsgClusterMessageFormatter.formatClusterRspnListCloseTag() + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }