List of usage examples for java.lang Short Short
@Deprecated(since = "9") public Short(String s) throws NumberFormatException
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnNumberFormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from ww w . j a va 2 s . c o m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // NumberFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnNumberFormatterUpdated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbNumberFormatterObj obj = schemaObj.getNumberFormatterTableObj().newInstance(); CFGenKbNumberFormatterBuff dataBuff = obj.getNumberFormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbNumberFormatterObj realized = (ICFGenKbNumberFormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnStringFormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w. ja va 2 s. co m // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // StringFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnStringFormatterCreated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbStringFormatterObj obj = schemaObj.getStringFormatterTableObj().newInstance(); CFGenKbStringFormatterBuff dataBuff = obj.getStringFormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbStringFormatterObj realized = (ICFGenKbStringFormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnStringFormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {// ww w.ja v a2 s . c o m // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // StringFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnStringFormatterUpdated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbStringFormatterObj obj = schemaObj.getStringFormatterTableObj().newInstance(); CFGenKbStringFormatterBuff dataBuff = obj.getStringFormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbStringFormatterObj realized = (ICFGenKbStringFormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnTZDateFormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from ww w. j a v a 2s . c om // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // TZDateFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTZDateFormatterCreated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbTZDateFormatterObj obj = schemaObj.getTZDateFormatterTableObj().newInstance(); CFGenKbTZDateFormatterBuff dataBuff = obj.getTZDateFormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbTZDateFormatterObj realized = (ICFGenKbTZDateFormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnTZDateFormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* ww w . ja va 2 s. c o m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // TZDateFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTZDateFormatterUpdated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbTZDateFormatterObj obj = schemaObj.getTZDateFormatterTableObj().newInstance(); CFGenKbTZDateFormatterBuff dataBuff = obj.getTZDateFormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbTZDateFormatterObj realized = (ICFGenKbTZDateFormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnTZTimeFormatterCreatedHandler.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 attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // TZTimeFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTZTimeFormatterCreated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbTZTimeFormatterObj obj = schemaObj.getTZTimeFormatterTableObj().newInstance(); CFGenKbTZTimeFormatterBuff dataBuff = obj.getTZTimeFormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbTZTimeFormatterObj realized = (ICFGenKbTZTimeFormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnTZTimeFormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* www.j a v a 2 s .com*/ // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // TZTimeFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTZTimeFormatterUpdated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbTZTimeFormatterObj obj = schemaObj.getTZTimeFormatterTableObj().newInstance(); CFGenKbTZTimeFormatterBuff dataBuff = obj.getTZTimeFormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbTZTimeFormatterObj realized = (ICFGenKbTZTimeFormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnUInt16FormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w w w . j a v a 2s . c o m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // UInt16Formatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnUInt16FormatterCreated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbUInt16FormatterObj obj = schemaObj.getUInt16FormatterTableObj().newInstance(); CFGenKbUInt16FormatterBuff dataBuff = obj.getUInt16FormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbUInt16FormatterObj realized = (ICFGenKbUInt16FormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnUInt16FormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*w ww . ja v a2 s. c o m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // UInt16Formatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnUInt16FormatterUpdated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbUInt16FormatterObj obj = schemaObj.getUInt16FormatterTableObj().newInstance(); CFGenKbUInt16FormatterBuff dataBuff = obj.getUInt16FormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbUInt16FormatterObj realized = (ICFGenKbUInt16FormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnUInt32FormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*w w w . j a v a 2 s.co m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenBind Attributes // GenFormatter Attributes // UInt32Formatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnUInt32FormatterCreated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = 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("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natCartridgeId = Long.parseLong(attrCartridgeId); int natItemId = Integer.parseInt(attrItemId); short natRuleTypeId = Short.parseShort(attrRuleTypeId); String natName = attrName; short natToolSetId = Short.parseShort(attrToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } short natGenDefId = Short.parseShort(attrGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbUInt32FormatterObj obj = schemaObj.getUInt32FormatterTableObj().newInstance(); CFGenKbUInt32FormatterBuff dataBuff = obj.getUInt32FormatterBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredCartridgeId(natCartridgeId); dataBuff.setRequiredItemId(natItemId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); dataBuff.setRequiredName(natName); dataBuff.setRequiredToolSetId(natToolSetId); dataBuff.setOptionalScopeDefId(natScopeDefId); dataBuff.setRequiredGenDefId(natGenDefId); dataBuff.setOptionalGelExecutableId(natGelExecutableId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbUInt32FormatterObj realized = (ICFGenKbUInt32FormatterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }