List of usage examples for java.util SortedMap values
Collection<V> values();
From source file:net.sourceforge.subsonic.dao.PlaylistDao.java
public List<Playlist> getReadablePlaylistsForUser(String username) { List<Playlist> result1 = getWritablePlaylistsForUser(username); List<Playlist> result2 = query("select " + COLUMNS + " from playlist where is_public", rowMapper); List<Playlist> result3 = query("select " + prefix(COLUMNS, "playlist") + " from playlist, playlist_user where " + "playlist.id = playlist_user.playlist_id and " + "playlist.username != ? and " + "playlist_user.username = ?", rowMapper, username, username); // Put in sorted map to avoid duplicates. SortedMap<Integer, Playlist> map = new TreeMap<Integer, Playlist>(); for (Playlist playlist : result1) { map.put(playlist.getId(), playlist); }//w w w. ja v a2s . c o m for (Playlist playlist : result2) { map.put(playlist.getId(), playlist); } for (Playlist playlist : result3) { map.put(playlist.getId(), playlist); } return new ArrayList<Playlist>(map.values()); }
From source file:de.blizzy.documentr.page.CherryPicker.java
@Override public SortedMap<String, List<CommitCherryPickResult>> cherryPick(String projectName, String branchName, String path, List<String> commits, Set<String> targetBranches, Set<CommitCherryPickConflictResolve> conflictResolves, boolean dryRun, User user, Locale locale) throws IOException { Assert.hasLength(projectName);/*from w w w .ja v a 2 s . c o m*/ Assert.hasLength(path); Assert.notEmpty(commits); Assert.notEmpty(targetBranches); Assert.notNull(conflictResolves); Assert.notNull(user); // always do a dry run first and return early if it fails if (!dryRun) { SortedMap<String, List<CommitCherryPickResult>> results = cherryPick(projectName, branchName, path, commits, targetBranches, conflictResolves, true, user, locale); for (List<CommitCherryPickResult> branchResults : results.values()) { for (CommitCherryPickResult result : branchResults) { if (result.getStatus() != CommitCherryPickResult.Status.OK) { return results; } } } } try { SortedMap<String, List<CommitCherryPickResult>> results = Maps.newTreeMap(); for (String targetBranch : targetBranches) { List<CommitCherryPickResult> branchResults = cherryPick(projectName, branchName, path, commits, targetBranch, conflictResolves, dryRun, user, locale); results.put(targetBranch, branchResults); } return results; } catch (GitAPIException e) { throw new IOException(e); } }
From source file:com.aurel.track.exchange.excel.ExcelFieldMatchAction.java
/** * Render the field match: first time and after a sheet change *///ww w. jav a 2s.c om @Override public String execute() { File fileOnDisk = new File(excelMappingsDirectory, fileName); workbook = ExcelFieldMatchBL.loadWorkbook(excelMappingsDirectory, fileName); if (workbook == null) { JSONUtility.encodeJSON(servletResponse, JSONUtility.encodeJSONFailure(getText("admin.actions.importExcel.err.noWorkbook")), false); fileOnDisk.delete(); return null; } if (selectedSheet == null) { //first rendering (not submit because of sheet change) selectedSheet = Integer.valueOf(0); } //get the previous field mappings Map<String, Integer> columNameToFieldIDMap = null; Set<Integer> lastSavedIdentifierFieldIDIsSet = null; try { FileInputStream fis = new FileInputStream(new File(excelMappingsDirectory, mappingFileName)); ObjectInputStream objectInputStream = new ObjectInputStream(fis); columNameToFieldIDMap = (Map<String, Integer>) objectInputStream.readObject(); lastSavedIdentifierFieldIDIsSet = (Set<Integer>) objectInputStream.readObject(); objectInputStream.close(); } catch (FileNotFoundException e) { LOGGER.info("Creating the input stream for mapping failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } catch (IOException e) { LOGGER.warn("Saving the mapping failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } catch (ClassNotFoundException e) { LOGGER.warn("Class not found for the mapping " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } //get the column index to header names from the excel sheet SortedMap<Integer, String> columnIndexToColumNameMap = ExcelFieldMatchBL.getFirstRowHeaders(workbook, selectedSheet); SortedSet<String> excelColumnNames = new TreeSet<String>(); excelColumnNames.addAll(columnIndexToColumNameMap.values()); //prepare the best field matching if (columNameToFieldIDMap == null) { columNameToFieldIDMap = new HashMap<String, Integer>(); } ExcelFieldMatchBL.prepareBestMatchByLabel(excelColumnNames, columNameToFieldIDMap, locale); columnIndexToFieldIDMap = ExcelFieldMatchBL.getColumnIndexToFieldIDMap(columNameToFieldIDMap, columnIndexToColumNameMap); columnIndexIsIdentifierMap = new HashMap<Integer, Boolean>(); //the saved identifier columns if (lastSavedIdentifierFieldIDIsSet != null && !lastSavedIdentifierFieldIDIsSet.isEmpty()) { for (Integer columnIndex : columnIndexToFieldIDMap.keySet()) { Integer fieldID = columnIndexToFieldIDMap.get(columnIndex); columnIndexIsIdentifierMap.put(columnIndex, new Boolean(lastSavedIdentifierFieldIDIsSet.contains(fieldID))); } } //if issueNo is present it is always identifier (first time it should be preselected and any time when mapped also preselected) if (columnIndexToFieldIDMap.values().contains(SystemFields.INTEGER_ISSUENO)) { for (Integer columnIndex : columnIndexToFieldIDMap.keySet()) { Integer fieldID = columnIndexToFieldIDMap.get(columnIndex); if (SystemFields.INTEGER_ISSUENO.equals(fieldID)) { columnIndexIsIdentifierMap.put(columnIndex, new Boolean(true)); } } } List<IntegerStringBean> sheetNames = ExcelFieldMatchBL.loadSheetNames(workbook); List<IntegerStringBean> matchableFieldsList = ExcelFieldMatchBL.getFieldConfigs(personID, locale); Map<Integer, String> columnIndexNumericToLetter = ExcelFieldMatchBL.getFirstRowNumericToLetter(workbook, selectedSheet); Set<Integer> possibleIdentifiersSet = ExcelFieldMatchBL.getPossibleIdentifierFields(); Set<Integer> mandatoryIdentifiersSet = ExcelFieldMatchBL.getMandatoryIdentifierFields(); JSONUtility.encodeJSON(servletResponse, ExcelImportJSON.getExcelFieldMatcherJSON(fileName, selectedSheet, sheetNames, matchableFieldsList, columnIndexToColumNameMap, columnIndexNumericToLetter, columnIndexToFieldIDMap, columnIndexIsIdentifierMap, possibleIdentifiersSet, mandatoryIdentifiersSet), false); return null; }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRqstHandler.CFCrmXMsgRqstMemoReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* ww w .j a va2 s. 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("RqstMemoReadAll"); CFCrmXMsgRqstHandler xmsgRqstHandler = (CFCrmXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj 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<CFCrmMemoPKey, ICFCrmMemoObj> map = schemaObj.getMemoTableObj().readAllMemo(true); String responseOpening = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgMemoMessageFormatter.formatMemoRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFCrmMemoObj> iter = map.values().iterator(); ICFCrmMemoObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFCrmXMsgMemoMessageFormatter.formatMemoRspnDerivedRec("\n\t\t", cur.getMemoBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFCrmXMsgMemoMessageFormatter.formatMemoRspnListCloseTag() + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamISOCurrencyTable.java
public GenKbISOCurrencyBuff[] readDerivedByCcyCdIdx(GenKbAuthorization Authorization, String ISOCode) { final String S_ProcName = "GenKbRamISOCurrency.readDerivedByCcyCdIdx() "; GenKbISOCurrencyByCcyCdIdxKey key = schema.getFactoryISOCurrency().newCcyCdIdxKey(); key.setRequiredISOCode(ISOCode);// w w w . ja v a 2s . c o m GenKbISOCurrencyBuff[] recArray; if (dictByCcyCdIdx.containsKey(key)) { SortedMap<GenKbISOCurrencyPKey, GenKbISOCurrencyBuff> subdictCcyCdIdx = dictByCcyCdIdx.get(key); recArray = new GenKbISOCurrencyBuff[subdictCcyCdIdx.size()]; Iterator<GenKbISOCurrencyBuff> iter = subdictCcyCdIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new GenKbISOCurrencyBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRqstHandler.CFCrmXMsgRqstPhoneReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from ww w. j a v 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("RqstPhoneReadAll"); CFCrmXMsgRqstHandler xmsgRqstHandler = (CFCrmXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj 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<CFCrmPhonePKey, ICFCrmPhoneObj> map = schemaObj.getPhoneTableObj().readAllPhone(true); String responseOpening = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgPhoneMessageFormatter.formatPhoneRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFCrmPhoneObj> iter = map.values().iterator(); ICFCrmPhoneObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFCrmXMsgPhoneMessageFormatter.formatPhoneRspnDerivedRec("\n\t\t", cur.getPhoneBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFCrmXMsgPhoneMessageFormatter.formatPhoneRspnListCloseTag() + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstTagReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from ww w .ja va 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("RqstTagReadAll"); 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<CFAccTagPKey, ICFAccTagObj> map = schemaObj.getTagTableObj().readAllTag(true); String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgTagMessageFormatter.formatTagRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAccTagObj> iter = map.values().iterator(); ICFAccTagObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAccXMsgTagMessageFormatter.formatTagRspnDerivedRec("\n\t\t", cur.getTagBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAccXMsgTagMessageFormatter.formatTagRspnListCloseTag() + 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.CFAccXMsgRqstTldReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//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("RqstTldReadAll"); 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<CFAccTldPKey, ICFAccTldObj> map = schemaObj.getTldTableObj().readAllTld(true); String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgTldMessageFormatter.formatTldRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAccTldObj> iter = map.values().iterator(); ICFAccTldObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAccXMsgTldMessageFormatter.formatTldRspnDerivedRec("\n\t\t", cur.getTldBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAccXMsgTldMessageFormatter.formatTldRspnListCloseTag() + 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.CFAstXMsgRqstTldReadAllHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* w w w . j a v a 2s . c om*/ // 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("RqstTldReadAll"); 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<CFAstTldPKey, ICFAstTldObj> map = schemaObj.getTldTableObj().readAllTld(true); String responseOpening = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgTldMessageFormatter.formatTldRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFAstTldObj> iter = map.values().iterator(); ICFAstTldObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAstXMsgTldMessageFormatter.formatTldRspnDerivedRec("\n\t\t", cur.getTldBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAstXMsgTldMessageFormatter.formatTldRspnListCloseTag() + 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:org.sakaiproject.metaobj.utils.ioc.ApplicationContextFactory.java
public String[] getConfigLocations(Properties props) throws IOException { SortedMap configFiles = new TreeMap(); for (Enumeration e = props.keys(); e.hasMoreElements();) { Integer key = new Integer((String) e.nextElement()); String curFile = props.getProperty(key.toString()); curFile = (!curFile.startsWith("/")) ? "/" + curFile : curFile; configFiles.put(key, curFile);/* w w w .ja va 2 s. c o m*/ logger.info("registering '" + curFile + "' in position " + key + " as spring bean definition file"); } return convertToArray(configFiles.values()); }