List of usage examples for java.lang Short Short
@Deprecated(since = "9") public Short(String s) throws NumberFormatException
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgRqstHandler.CFAstXMsgRqstISOLanguageDeleteByCountryIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*w ww.ja v a 2s . com*/ // Common XML Attributes String attrId = null; String attrISOCountryId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstISOLanguageDeleteByCountryIdx"); 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("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = 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$implRqstTableDeleteByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types Short natISOCountryId; natISOCountryId = new Short(Short.parseShort(attrISOCountryId)); // Delete the objects schemaObj.getISOLanguageTableObj().deleteISOLanguageByCountryIdx(natISOCountryId); String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgISOLanguageMessageFormatter.formatISOLanguageRspnDeleted() + "\n" + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); ((CFAstXMsgRqstHandler) getParser()).appendResponse(response); } 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.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstDefClassReadByBaseIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//www . j a va 2s. c o m // Common XML Attributes String attrId = null; String attrBaseId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstDefClassReadByBaseIdx"); CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj 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("BaseId")) { if (attrBaseId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrBaseId = 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$implRqstTableReadByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Short natBaseId; natBaseId = new Short(Short.parseShort(attrBaseId)); // Read the objects SortedMap<CFGenKbDefClassPKey, ICFGenKbDefClassObj> map = schemaObj.getDefClassTableObj() .readDefClassByBaseIdx(natBaseId); String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgDefClassMessageFormatter.formatDefClassRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFGenKbDefClassObj> iter = map.values().iterator(); ICFGenKbDefClassObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFGenKbXMsgDefClassMessageFormatter.formatDefClassRspnDerivedRec("\n\t\t", cur.getDefClassBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFGenKbXMsgDefClassMessageFormatter.formatDefClassRspnListCloseTag() + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:com.mb.framework.util.property.PropertyUtilExt.java
/** * Copy property values from the origin bean to the destination bean for all * cases where the property names are the same. For each property, a * conversion is attempted as necessary. All combinations of standard * JavaBeans and DynaBeans as origin and destination are supported. * Properties that exist in the origin bean, but do not exist in the * destination bean (or are read-only in the destination bean) are silently * ignored./*from w ww.ja v a 2s.c o m*/ * <p> * In addition to the method with the same name in the * <code>org.apache.commons.beanutils.PropertyUtils</code> class this method * can also copy properties of the following types: * <ul> * <li>java.lang.Integer</li> * <li>java.lang.Double</li> * <li>java.lang.Long</li> * <li>java.lang.Short</li> * <li>java.lang.Float</li> * <li>java.lang.String</li> * <li>java.lang.Boolean</li> * <li>java.sql.Date</li> * <li>java.sql.Time</li> * <li>java.sql.Timestamp</li> * <li>java.math.BigDecimal</li> * <li>a container-managed relations field.</li> * </ul> * * @param dest * Destination bean whose properties are modified * @param orig * Origin bean whose properties are retrieved * @throws IllegalAccessException * if the caller does not have access to the property accessor * method * @throws InvocationTargetException * if the property accessor method throws an exception * @throws NoSuchMethodException * if an accessor method for this propety cannot be found * @throws ClassNotFoundException * if an incorrect relations class mapping exists. * @throws InstantiationException * if an object of the mapped relations class can not be * constructed. */ public static void copyProperties(Object dest, Object orig) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, Exception { PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(orig); for (int i = 0; i < origDescriptors.length; i++) { String name = origDescriptors[i].getName(); if (PropertyUtils.getPropertyDescriptor(dest, name) != null) { Object origValue = PropertyUtils.getSimpleProperty(orig, name); String origParamType = origDescriptors[i].getPropertyType().getName(); try { // edited // if (origValue == null)throw new NullPointerException(); PropertyUtils.setSimpleProperty(dest, name, origValue); } catch (Exception e) { try { String destParamType = PropertyUtils.getPropertyType(dest, name).getName(); if (origValue instanceof String) { if (destParamType.equals("java.lang.Integer")) { Integer intValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { intValue = new Integer(sValue); } PropertyUtils.setSimpleProperty(dest, name, intValue); } else if (destParamType.equals("java.lang.Byte")) { Byte byteValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { byteValue = new Byte(sValue); } PropertyUtils.setSimpleProperty(dest, name, byteValue); } else if (destParamType.equals("java.lang.Double")) { Double doubleValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { doubleValue = new Double(sValue); } PropertyUtils.setSimpleProperty(dest, name, doubleValue); } else if (destParamType.equals("java.lang.Long")) { Long longValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { longValue = new Long(sValue); } PropertyUtils.setSimpleProperty(dest, name, longValue); } else if (destParamType.equals("java.lang.Short")) { Short shortValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { shortValue = new Short(sValue); } PropertyUtils.setSimpleProperty(dest, name, shortValue); } else if (destParamType.equals("java.lang.Float")) { Float floatValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { floatValue = new Float(sValue); } PropertyUtils.setSimpleProperty(dest, name, floatValue); } else if (destParamType.equals("java.sql.Date")) { java.sql.Date dateValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { dateValue = new java.sql.Date(DATE_FORMATTER.parse(sValue).getTime()); } PropertyUtils.setSimpleProperty(dest, name, dateValue); } else if (destParamType.equals("java.sql.Time")) { java.sql.Time dateValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { dateValue = new java.sql.Time(TIME_FORMATTER.parse(sValue).getTime()); } PropertyUtils.setSimpleProperty(dest, name, dateValue); } else if (destParamType.equals("java.sql.Timestamp")) { java.sql.Timestamp dateValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { dateValue = new java.sql.Timestamp(TIMESTAMP_FORMATTER.parse(sValue).getTime()); } PropertyUtils.setSimpleProperty(dest, name, dateValue); } else if (destParamType.equals("java.lang.Boolean")) { Boolean bValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { bValue = Boolean.valueOf(sValue); } PropertyUtils.setSimpleProperty(dest, name, bValue); } else if (destParamType.equals("java.math.BigDecimal")) { BigDecimal bdValue = null; String sValue = ((String) origValue).trim(); if (sValue.length() > 0) { bdValue = new BigDecimal(sValue); } PropertyUtils.setSimpleProperty(dest, name, bdValue); } } else if ((origValue != null) && (destParamType.equals("java.lang.String"))) { // we're transferring a business-layer value object // into a String-based Struts form bean.. if ("java.sql.Date".equals(origParamType)) { PropertyUtils.setSimpleProperty(dest, name, DATE_FORMATTER.format(origValue)); } else if ("java.sql.Timestamp".equals(origParamType)) { PropertyUtils.setSimpleProperty(dest, name, TIMESTAMP_FORMATTER.format(origValue)); } else if ("java.sql.Blob".equals(origParamType)) { // convert a Blob to a String.. Blob blob = (Blob) origValue; BufferedInputStream bin = null; try { int bytesRead; StringBuffer result = new StringBuffer(); byte[] buffer = new byte[READ_BUFFER_LENGTH]; bin = new BufferedInputStream(blob.getBinaryStream()); do { bytesRead = bin.read(buffer); if (bytesRead != -1) { result.append(new String(buffer, 0, bytesRead)); } } while (bytesRead == READ_BUFFER_LENGTH); PropertyUtils.setSimpleProperty(dest, name, result.toString()); } finally { if (bin != null) try { bin.close(); } catch (IOException ignored) { } } } else { PropertyUtils.setSimpleProperty(dest, name, origValue.toString()); } } } catch (Exception e2) { throw e2; } } } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstAccountEntryDeleteByDrCcyIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//w w w . j av a 2 s . co m // Common XML Attributes String attrId = null; String attrDebitCurrencyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstAccountEntryDeleteByDrCcyIdx"); 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("DebitCurrencyId")) { if (attrDebitCurrencyId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDebitCurrencyId = 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$implRqstTableDeleteByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types Short natDebitCurrencyId; natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId)); // Delete the objects schemaObj.getAccountEntryTableObj().deleteAccountEntryByDrCcyIdx(natDebitCurrencyId); String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgAccountEntryMessageFormatter.formatAccountEntryRspnDeleted() + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); ((CFAccXMsgRqstHandler) getParser()).appendResponse(response); } 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.CFAccXMsgRqstAccountEntryDeleteByCrCcyIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w. jav a 2 s. c o m // Common XML Attributes String attrId = null; String attrCreditCurrencyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstAccountEntryDeleteByCrCcyIdx"); 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("CreditCurrencyId")) { if (attrCreditCurrencyId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreditCurrencyId = 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$implRqstTableDeleteByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types Short natCreditCurrencyId; natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId)); // Delete the objects schemaObj.getAccountEntryTableObj().deleteAccountEntryByCrCcyIdx(natCreditCurrencyId); String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgAccountEntryMessageFormatter.formatAccountEntryRspnDeleted() + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); ((CFAccXMsgRqstHandler) getParser()).appendResponse(response); } 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.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenBindReadByScopeIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//ww w .j a va 2 s . c o m // Common XML Attributes String attrId = null; String attrScopeDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstGenBindReadByScopeIdx"); CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj 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("ScopeDefId")) { if (attrScopeDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeDefId = 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$implRqstTableReadByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Short natScopeDefId; natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); // Read the objects SortedMap<CFGenKbGenItemPKey, ICFGenKbGenBindObj> map = schemaObj.getGenBindTableObj() .readGenBindByScopeIdx(natScopeDefId); String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFGenKbGenBindObj> iter = map.values().iterator(); ICFGenKbGenBindObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t", cur.getGenItemBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListCloseTag() + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenFileReadByScopeIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w.j a v a2s.co m // Common XML Attributes String attrId = null; String attrScopeDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstGenFileReadByScopeIdx"); CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj 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("ScopeDefId")) { if (attrScopeDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeDefId = 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$implRqstTableReadByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Short natScopeDefId; natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); // Read the objects SortedMap<CFGenKbGenItemPKey, ICFGenKbGenFileObj> map = schemaObj.getGenFileTableObj() .readGenFileByScopeIdx(natScopeDefId); String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFGenKbGenFileObj> iter = map.values().iterator(); ICFGenKbGenFileObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t", cur.getGenItemBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListCloseTag() + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenItemReadByScopeIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w w w . ja va 2 s .c o m*/ // Common XML Attributes String attrId = null; String attrScopeDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstGenItemReadByScopeIdx"); CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj 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("ScopeDefId")) { if (attrScopeDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeDefId = 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$implRqstTableReadByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Short natScopeDefId; natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); // Read the objects SortedMap<CFGenKbGenItemPKey, ICFGenKbGenItemObj> map = schemaObj.getGenItemTableObj() .readGenItemByScopeIdx(natScopeDefId); String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFGenKbGenItemObj> iter = map.values().iterator(); ICFGenKbGenItemObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t", cur.getGenItemBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListCloseTag() + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenRuleReadByScopeIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w .j a v a 2 s .c o m // Common XML Attributes String attrId = null; String attrScopeDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstGenRuleReadByScopeIdx"); CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj 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("ScopeDefId")) { if (attrScopeDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeDefId = 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$implRqstTableReadByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Short natScopeDefId; natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); // Read the objects SortedMap<CFGenKbGenItemPKey, ICFGenKbGenRuleObj> map = schemaObj.getGenRuleTableObj() .readGenRuleByScopeIdx(natScopeDefId); String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFGenKbGenRuleObj> iter = map.values().iterator(); ICFGenKbGenRuleObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t", cur.getGenItemBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListCloseTag() + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenTruncReadByScopeIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* w w w. j a va 2 s . co m*/ // Common XML Attributes String attrId = null; String attrScopeDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstGenTruncReadByScopeIdx"); CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj 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("ScopeDefId")) { if (attrScopeDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeDefId = 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$implRqstTableReadByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Short natScopeDefId; natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); // Read the objects SortedMap<CFGenKbGenItemPKey, ICFGenKbGenTruncObj> map = schemaObj.getGenTruncTableObj() .readGenTruncByScopeIdx(natScopeDefId); String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFGenKbGenTruncObj> iter = map.values().iterator(); ICFGenKbGenTruncObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t", cur.getGenItemBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListCloseTag() + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }