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.CFGenKbXMsgRspnUuidFormatterLockedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*w w w . ja 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 // UuidFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnUuidFormatterLocked"); 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 ICFGenKbUuidFormatterObj obj = schemaObj.getUuidFormatterTableObj().newInstance(); CFGenKbUuidFormatterBuff dataBuff = obj.getUuidFormatterBuff(); 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(); ICFGenKbUuidFormatterObj realized = (ICFGenKbUuidFormatterObj) 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.cfasterisk.v2_0.CFAstXMsgRqstHandler.CFAstXMsgRqstISOLanguageUpdateHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* w ww. j a v a 2 s .c o m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // ISOLanguage Attributes String attrISOCode = null; String attrBaseLanguageCode = null; String attrISOCountryId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstISOLanguageUpdate"); 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("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCode")) { if (attrISOCode != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("BaseLanguageCode")) { if (attrBaseLanguageCode != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrBaseLanguageCode = 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 if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrISOCode == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ISOCode"); } if (attrBaseLanguageCode == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "BaseLanguageCode"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt"); } if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy"); } if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt"); } if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFAstISOLanguagePKey pkey = schemaObj.getBackingStore().getFactoryISOLanguage().newPKey(); short natId; natId = Short.parseShort(attrId); pkey.setRequiredId(natId); // Read the instance ICFAstISOLanguageObj origBuff = schemaObj.getISOLanguageTableObj().readISOLanguage(pkey); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getISOLanguageTableObj().readISOLanguage()"); } else { // Edit the instance ICFAstISOLanguageEditObj editBuff = (ICFAstISOLanguageEditObj) origBuff.beginEdit(); CFAstISOLanguageBuff dataBuff = editBuff.getISOLanguageBuff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. String natISOCode = attrISOCode; dataBuff.setRequiredISOCode(natISOCode); String natBaseLanguageCode = attrBaseLanguageCode; dataBuff.setRequiredBaseLanguageCode(natBaseLanguageCode); Short natISOCountryId; if ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { natISOCountryId = null; } else { natISOCountryId = new Short(Short.parseShort(attrISOCountryId)); } dataBuff.setOptionalISOCountryId(natISOCountryId); int natRevision = Integer.parseInt(attrRevision); dataBuff.setRequiredRevision(natRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } // Attempt the update editBuff.update(); editBuff.endEdit(); String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAstXMsgISOLanguageMessageFormatter.formatISOLanguageRspnUpdated("\n\t\t\t", origBuff.getISOLanguageBuff()) + "\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.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnTextFormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from ww w . j ava 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 // TextFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTextFormatterCreated"); 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 ICFGenKbTextFormatterObj obj = schemaObj.getTextFormatterTableObj().newInstance(); CFGenKbTextFormatterBuff dataBuff = obj.getTextFormatterBuff(); 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(); ICFGenKbTextFormatterObj realized = (ICFGenKbTextFormatterObj) 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.CFGenKbXMsgRspnTextFormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w .ja v a 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 // TextFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTextFormatterUpdated"); 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 ICFGenKbTextFormatterObj obj = schemaObj.getTextFormatterTableObj().newInstance(); CFGenKbTextFormatterBuff dataBuff = obj.getTextFormatterBuff(); 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(); ICFGenKbTextFormatterObj realized = (ICFGenKbTextFormatterObj) 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.CFGenKbXMsgRspnTimeFormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*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 // TimeFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTimeFormatterCreated"); 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 ICFGenKbTimeFormatterObj obj = schemaObj.getTimeFormatterTableObj().newInstance(); CFGenKbTimeFormatterBuff dataBuff = obj.getTimeFormatterBuff(); 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(); ICFGenKbTimeFormatterObj realized = (ICFGenKbTimeFormatterObj) 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.CFGenKbXMsgRspnTimeFormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w ww .j ava 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 // TimeFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTimeFormatterUpdated"); 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 ICFGenKbTimeFormatterObj obj = schemaObj.getTimeFormatterTableObj().newInstance(); CFGenKbTimeFormatterBuff dataBuff = obj.getTimeFormatterBuff(); 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(); ICFGenKbTimeFormatterObj realized = (ICFGenKbTimeFormatterObj) 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.CFGenKbXMsgRspnUuidFormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w .j a va 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 // UuidFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnUuidFormatterCreated"); 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 ICFGenKbUuidFormatterObj obj = schemaObj.getUuidFormatterTableObj().newInstance(); CFGenKbUuidFormatterBuff dataBuff = obj.getUuidFormatterBuff(); 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(); ICFGenKbUuidFormatterObj realized = (ICFGenKbUuidFormatterObj) 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.CFGenKbXMsgRspnUuidFormatterUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w ww.j a 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 // UuidFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnUuidFormatterUpdated"); 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 ICFGenKbUuidFormatterObj obj = schemaObj.getUuidFormatterTableObj().newInstance(); CFGenKbUuidFormatterBuff dataBuff = obj.getUuidFormatterBuff(); 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(); ICFGenKbUuidFormatterObj realized = (ICFGenKbUuidFormatterObj) 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.CFGenKbXMsgRspnTokenFormatterLockedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w w w.j a va 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 // TokenFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTokenFormatterLocked"); 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 ICFGenKbTokenFormatterObj obj = schemaObj.getTokenFormatterTableObj().newInstance(); CFGenKbTokenFormatterBuff dataBuff = obj.getTokenFormatterBuff(); 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(); ICFGenKbTokenFormatterObj realized = (ICFGenKbTokenFormatterObj) 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.CFGenKbXMsgRspnTokenFormatterCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from www .jav a 2 s . 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 // TokenFormatter Attributes // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTokenFormatterCreated"); 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 ICFGenKbTokenFormatterObj obj = schemaObj.getTokenFormatterTableObj().newInstance(); CFGenKbTokenFormatterBuff dataBuff = obj.getTokenFormatterBuff(); 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(); ICFGenKbTokenFormatterObj realized = (ICFGenKbTokenFormatterObj) 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); } }