protected CFAccFeeDetailBuff unpackFeeDetailResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackFeeDetailResultSetToBuff"; int idxcol = 1; CFAccFeeDetailBuff buff = schema.getFactoryFeeDetail().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFAccSybaseSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFAccSybaseSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredFeeId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredFeeDetailId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredAmountCharged(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
protected CFSecurityISOCountryLanguageBuff unpackISOCountryLanguageResultSetToBuff( ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOCountryLanguageResultSetToBuff"; int idxcol = 1; CFSecurityISOCountryLanguageBuff buff = schema.getFactoryISOCountryLanguage().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFCrmMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFCrmMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } } idxcol++; buff.setRequiredISOCountryId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredISOLanguageId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
protected CFInternetURLProtocolBuff unpackURLProtocolResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackURLProtocolResultSetToBuff"; int idxcol = 1; CFInternetURLProtocolBuff buff = schema.getFactoryURLProtocol().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFDbTestPgSqlSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFDbTestPgSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredURLProtocolId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredIsSecure(resultSet.getBoolean(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
protected CFSecurityHostNodeBuff unpackHostNodeResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackHostNodeResultSetToBuff"; int idxcol = 1; CFSecurityHostNodeBuff buff = schema.getFactoryHostNode().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFDbTestMSSqlSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFDbTestMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredClusterId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredHostNodeId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredHostName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
protected CFCrmMemoDataBuff unpackMemoDataResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackMemoDataResultSetToBuff"; int idxcol = 1; CFCrmMemoDataBuff buff = schema.getFactoryMemoData().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFCrmMSSqlSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFCrmMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredMemoId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredContactId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredMemo(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
protected CFSecurityTSecGroupBuff unpackTSecGroupResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackTSecGroupResultSetToBuff"; int idxcol = 1; CFSecurityTSecGroupBuff buff = schema.getFactoryTSecGroup().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFCrmSybaseSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFCrmSybaseSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredTSecGroupId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredIsVisible(("Y".equals(resultSet.getString(idxcol)) ? true : false)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
protected CFSecuritySecAppBuff unpackSecAppResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackSecAppResultSetToBuff"; int idxcol = 1; CFSecuritySecAppBuff buff = schema.getFactorySecApp().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFFreeSwitchOracleSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFFreeSwitchOracleSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredClusterId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredSecAppId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredJEEMountName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFDbTestXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrClusterId = null; String attrSecGroupId = null; String attrSecUserId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecGroupMemberReadByUUserIdx"); CFDbTestXMsgRqstHandler xmsgRqstHandler = (CFDbTestXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFDbTestSchemaObj 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("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecGroupId")) { if (attrSecGroupId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecGroupId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecUserId")) { if (attrSecUserId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecUserId = 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 ((attrClusterId == null) || (attrClusterId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId"); } if ((attrSecGroupId == null) || (attrSecGroupId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupId"); } if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecUserId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natClusterId; natClusterId = Long.parseLong(attrClusterId); int natSecGroupId; natSecGroupId = Integer.parseInt(attrSecGroupId); UUID natSecUserId; if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { natSecUserId = null; } else { natSecUserId = UUID.fromString(attrSecUserId); } // Read the object ICFDbTestSecGroupMemberObj read = ((ICFDbTestSecGroupMemberObj) schemaObj .getSecGroupMemberTableObj() .readSecGroupMemberByUUserIdx(natClusterId, natSecGroupId, natSecUserId, true)); if (read != null) { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSecGroupMemberMessageFormatter.formatSecGroupMemberRspnSingleOpenTag() + CFDbTestXMsgSecGroupMemberMessageFormatter.formatSecGroupMemberRspnDerivedRec( "\n\t\t", read.getSecGroupMemberBuff()) + "\n" + "\t" + CFDbTestXMsgSecGroupMemberMessageFormatter .formatSecGroupMemberRspnSingleCloseTag() + schemaFormatter.formatRspnXmlPostamble(); ((CFDbTestXMsgRqstHandler) getParser()).appendResponse(response); } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(response); } } catch (RuntimeException e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Scope Attributes String attrTenantId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // ClearDep Attributes String attrRelationId = null; // ClearSubDep3 Attributes String attrContClearDep2TenantId = null; String attrContClearDep2Id = null; String attrName = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstClearSubDep3Update"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj 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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RelationId")) { if (attrRelationId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRelationId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContClearDep2TenantId")) { if (attrContClearDep2TenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContClearDep2TenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContClearDep2Id")) { if (attrContClearDep2Id != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContClearDep2Id = 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("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 ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } 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"); } if ((attrRelationId == null) || (attrRelationId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "RelationId"); } if ((attrContClearDep2TenantId == null) || (attrContClearDep2TenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2TenantId"); } if ((attrContClearDep2Id == null) || (attrContClearDep2Id.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFBamScopePKey pkey = ((ICFBamSchema) schemaObj.getBackingStore()).getFactoryScope().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); // Read the instance ICFBamClearSubDep3Obj origBuff = ((ICFBamClearSubDep3Obj) schemaObj.getClearSubDep3TableObj().readClearSubDep3(pkey)); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "getClearSubDep3TableObj().readClearSubDep3()"); } else { // Edit the instance ICFBamClearSubDep3EditObj editBuff = (ICFBamClearSubDep3EditObj) origBuff.beginEdit(); CFBamClearSubDep3Buff dataBuff = editBuff.getClearSubDep3Buff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. 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); } long natRelationId = Long.parseLong(attrRelationId); dataBuff.setRequiredRelationId(natRelationId); long natContClearDep2TenantId = Long.parseLong(attrContClearDep2TenantId); dataBuff.setRequiredContClearDep2TenantId(natContClearDep2TenantId); long natContClearDep2Id = Long.parseLong(attrContClearDep2Id); dataBuff.setRequiredContClearDep2Id(natContClearDep2Id); String natName = attrName; dataBuff.setRequiredName(natName); // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgClearSubDep3MessageFormatter.formatClearSubDep3RspnUpdated( "\n\t\t\t", origBuff.getClearSubDep3Buff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
protected CFSecurityISOCurrencyBuff unpackISOCurrencyResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOCurrencyResultSetToBuff"; int idxcol = 1; CFSecurityISOCurrencyBuff buff = schema.getFactoryISOCurrency().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFInternetMSSqlSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFInternetMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredISOCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredISOCode(resultSet.getString(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalUnitSymbol(null); } else { buff.setOptionalUnitSymbol(colVal); } } idxcol++; buff.setRequiredPrecis(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Tenant Attributes String attrClusterId = null; String attrTenantName = 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("RqstTenantCreate"); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFAsteriskTenantEditObj editBuff = (ICFAsteriskTenantEditObj) schemaObj.getTenantTableObj().newInstance().beginEdit(); CFSecurityTenantBuff dataBuff = (CFSecurityTenantBuff) editBuff.getTenantBuff(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else 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("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantName")) { if (attrTenantName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantName = attrs.getValue(idxAttr); } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrClusterId == null) || (attrClusterId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrTenantName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantName"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natClusterId = Long.parseLong(attrClusterId); dataBuff.setRequiredClusterId(natClusterId); String natTenantName = attrTenantName; dataBuff.setRequiredTenantName(natTenantName); 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 create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFAsteriskTenantObj created = (ICFAsteriskTenantObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgTenantMessageFormatter.formatTenantRspnCreated( "\n\t\t\t", created.getTenantBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFAsteriskXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFCrmXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrSecSessionId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecSessionDelete"); CFCrmXMsgRqstHandler xmsgRqstHandler = (CFCrmXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFCrmSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFSecuritySecSessionPKey pkey = ((ICFCrmSchema) schemaObj.getBackingStore()).getFactorySecSession().newPKey(); // 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("SecSessionId")) { if (attrSecSessionId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecSessionId = 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 ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecSessionId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natSecSessionId; if ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) { natSecSessionId = null; } else { natSecSessionId = UUID.fromString(attrSecSessionId); } pkey.setRequiredSecSessionId(natSecSessionId); pkey.setRequiredSecSessionId(natSecSessionId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFCrmSecSessionObj read = ((ICFCrmSecSessionObj) schemaObj.getSecSessionTableObj().readSecSession(pkey)); if (read != null) { if (read.getSecSessionBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete SecSession"); } else { ICFCrmSecSessionEditObj editBuff = (ICFCrmSecSessionEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecSessionMessageFormatter.formatSecSessionRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFCrmXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFCrmXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // ReqMinMaxValue Attributes String attrTenantId = null; String attrDescription = null; String attrTestInt16 = null; String attrTestInt32 = null; String attrTestInt64 = null; String attrTestUInt16 = null; String attrTestUInt32 = null; String attrTestUInt64 = null; String attrTestFloat = null; String attrTestDouble = null; String attrTestNumber = null; String attrTestDate = null; String attrTestTimestamp = null; String attrTestTZDate = null; String attrTestTZTimestamp = 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("ReqMinMaxValue"); CFDbTestXMsgRspnHandler xmsgRspnHandler = (CFDbTestXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj 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("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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt16")) { if (attrTestInt16 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt16 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt32")) { if (attrTestInt32 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt32 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt64")) { if (attrTestInt64 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt64 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt16")) { if (attrTestUInt16 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt16 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt32")) { if (attrTestUInt32 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt32 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt64")) { if (attrTestUInt64 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt64 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestFloat")) { if (attrTestFloat != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestFloat = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestDouble")) { if (attrTestDouble != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestDouble = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestNumber")) { if (attrTestNumber != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestNumber = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestDate")) { if (attrTestDate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestDate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTimestamp")) { if (attrTestTimestamp != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTimestamp = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTZDate")) { if (attrTestTZDate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTZDate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTZTimestamp")) { if (attrTestTZTimestamp != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTZTimestamp = 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 ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } if ((attrTestInt16 == null) || (attrTestInt16.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestInt16"); } if ((attrTestInt32 == null) || (attrTestInt32.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestInt32"); } if ((attrTestInt64 == null) || (attrTestInt64.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestInt64"); } if ((attrTestUInt16 == null) || (attrTestUInt16.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestUInt16"); } if ((attrTestUInt32 == null) || (attrTestUInt32.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestUInt32"); } if ((attrTestUInt64 == null) || (attrTestUInt64.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestUInt64"); } if ((attrTestFloat == null) || (attrTestFloat.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestFloat"); } if ((attrTestDouble == null) || (attrTestDouble.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestDouble"); } if ((attrTestNumber == null) || (attrTestNumber.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestNumber"); } if ((attrTestDate == null) || (attrTestDate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestDate"); } if ((attrTestTimestamp == null) || (attrTestTimestamp.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestTimestamp"); } if ((attrTestTZDate == null) || (attrTestTZDate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestTZDate"); } if ((attrTestTZTimestamp == null) || (attrTestTZTimestamp.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestTZTimestamp"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natId = Long.parseLong(attrId); String natDescription = attrDescription; short natTestInt16 = Short.parseShort(attrTestInt16); int natTestInt32 = Integer.parseInt(attrTestInt32); long natTestInt64 = Long.parseLong(attrTestInt64); int natTestUInt16 = Integer.parseInt(attrTestUInt16); long natTestUInt32 = Long.parseLong(attrTestUInt32); BigDecimal natTestUInt64 = new BigDecimal(attrTestUInt64); float natTestFloat = Float.parseFloat(attrTestFloat); double natTestDouble = Double.parseDouble(attrTestDouble); BigDecimal natTestNumber = new BigDecimal(attrTestNumber); Calendar natTestDate; try { natTestDate = CFLibXmlUtil.parseDate(attrTestDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException(getClass(), S_ProcName, 0, "TestDate", attrTestDate, e); } Calendar natTestTimestamp; try { natTestTimestamp = CFLibXmlUtil.parseTimestamp(attrTestTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTimestamp", attrTestTimestamp, e); } Calendar natTestTZDate; try { natTestTZDate = CFLibXmlUtil.parseTZDate(attrTestTZDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZDate", attrTestTZDate, e); } Calendar natTestTZTimestamp; try { natTestTZTimestamp = CFLibXmlUtil.parseTZTimestamp(attrTestTZTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZTimestamp", attrTestTZTimestamp, e); } int natRevision = Integer.parseInt(attrRevision); 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); } // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFDbTestReqMinMaxValueObj obj = (ICFDbTestReqMinMaxValueObj) (schemaObj.getReqMinMaxValueTableObj().newInstance()); CFDbTestReqMinMaxValueBuff dataBuff = obj.getReqMinMaxValueBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredId(natId); dataBuff.setRequiredDescription(natDescription); dataBuff.setRequiredTestInt16(natTestInt16); dataBuff.setRequiredTestInt32(natTestInt32); dataBuff.setRequiredTestInt64(natTestInt64); dataBuff.setRequiredTestUInt16(natTestUInt16); dataBuff.setRequiredTestUInt32(natTestUInt32); dataBuff.setRequiredTestUInt64(natTestUInt64); dataBuff.setRequiredTestFloat(natTestFloat); dataBuff.setRequiredTestDouble(natTestDouble); dataBuff.setRequiredTestNumber(natTestNumber); dataBuff.setRequiredTestDate(natTestDate); dataBuff.setRequiredTestTimestamp(natTestTimestamp); dataBuff.setRequiredTestTZDate(natTestTZDate); dataBuff.setRequiredTestTZTimestamp(natTestTZTimestamp); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFDbTestReqMinMaxValueObj> list = (List<ICFDbTestReqMinMaxValueObj>) xmsgRspnHandler.getListOfObjects(); ICFDbTestReqMinMaxValueObj realized = (ICFDbTestReqMinMaxValueObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(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); } }
protected CFSecurityISOTimezoneBuff unpackISOTimezoneResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOTimezoneResultSetToBuff"; int idxcol = 1; CFSecurityISOTimezoneBuff buff = schema.getFactoryISOTimezone().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFDbTestPgSqlSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFDbTestPgSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredISOTimezoneId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredIso8601(resultSet.getString(idxcol)); idxcol++; buff.setRequiredTZName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredTZHourOffset(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredTZMinOffset(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredVisible(resultSet.getBoolean(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFSecurityXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrSecProxyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecSessionDeleteBySecProxyIdx"); CFSecurityXMsgRqstHandler xmsgRqstHandler = (CFSecurityXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFSecuritySchemaObj 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("SecProxyId")) { if (attrSecProxyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecProxyId = 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 // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types UUID natSecProxyId; if ((attrSecProxyId == null) || (attrSecProxyId.length() <= 0)) { natSecProxyId = null; } else { natSecProxyId = UUID.fromString(attrSecProxyId); } // Delete the objects schemaObj.getSecSessionTableObj().deleteSecSessionBySecProxyIdx(natSecProxyId); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgSecSessionMessageFormatter.formatSecSessionRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFSecurityXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFSecurityXMsgRqstHandler xmsgRqstHandler = ((CFSecurityXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFSecurityXMsgRqstHandler xmsgRqstHandler = ((CFSecurityXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFDbTestXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrSecUserId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecDeviceReadByUserIdx"); CFDbTestXMsgRqstHandler xmsgRqstHandler = (CFDbTestXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFDbTestSchemaObj 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("SecUserId")) { if (attrSecUserId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecUserId = 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 ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecUserId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natSecUserId; if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { natSecUserId = null; } else { natSecUserId = UUID.fromString(attrSecUserId); } // Read the objects List<ICFSecuritySecDeviceObj> list = schemaObj.getSecDeviceTableObj().readSecDeviceByUserIdx(natSecUserId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSecDeviceMessageFormatter.formatSecDeviceRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecuritySecDeviceObj> iter = list.iterator(); ICFSecuritySecDeviceObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFDbTestXMsgSecDeviceMessageFormatter.formatSecDeviceRspnDerivedRec( "\n\t\t", cur.getSecDeviceBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFDbTestXMsgSecDeviceMessageFormatter.formatSecDeviceRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // ContactURL Attributes String attrTenantId = null; String attrContactURLId = null; String attrContactId = null; String attrName = null; String attrURL = 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("ContactURL"); CFAccXMsgRspnHandler xmsgRspnHandler = (CFAccXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj 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("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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContactURLId")) { if (attrContactURLId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContactURLId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContactId")) { if (attrContactId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContactId = 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("URL")) { if (attrURL != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrURL = 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 ((attrContactURLId == null) || (attrContactURLId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContactURLId"); } if ((attrContactId == null) || (attrContactId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContactId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if (attrURL == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "URL"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natContactURLId = Long.parseLong(attrContactURLId); long natContactId = Long.parseLong(attrContactId); String natName = attrName; String natURL = attrURL; int natRevision = Integer.parseInt(attrRevision); 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); } // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFAccContactURLObj obj = (ICFAccContactURLObj) (schemaObj.getContactURLTableObj().newInstance()); CFCrmContactURLBuff dataBuff = obj.getContactURLBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredContactURLId(natContactURLId); dataBuff.setRequiredContactId(natContactId); dataBuff.setRequiredName(natName); dataBuff.setRequiredURL(natURL); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFCrmContactURLObj> list = (List<ICFCrmContactURLObj>) xmsgRspnHandler.getListOfObjects(); ICFCrmContactURLObj realized = (ICFCrmContactURLObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(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); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFDbTestXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Value Attributes String attrTenantId = null; String attrScopeId = null; String attrName = null; String attrDefaultVisibility = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Atom Attributes // TokenDef Attributes // TokenType Attributes String attrSchemaDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTokenTypeUpdate"); CFDbTestXMsgRqstHandler xmsgRqstHandler = (CFDbTestXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFDbTestSchemaObj 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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = 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("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SchemaDefId")) { if (attrSchemaDefId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSchemaDefId = 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 ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } 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"); } if ((attrSchemaDefId == null) || (attrSchemaDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaDefId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFDbTestValuePKey pkey = ((ICFDbTestSchema) schemaObj.getBackingStore()).getFactoryValue().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); // Read the instance ICFDbTestTokenTypeObj origBuff = ((ICFDbTestTokenTypeObj) schemaObj.getTokenTypeTableObj().readTokenType(pkey)); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "getTokenTypeTableObj().readTokenType()"); } else { // Edit the instance ICFDbTestTokenTypeEditObj editBuff = (ICFDbTestTokenTypeEditObj) origBuff.beginEdit(); CFDbTestTokenTypeBuff dataBuff = editBuff.getTokenTypeBuff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natScopeId = Long.parseLong(attrScopeId); dataBuff.setRequiredScopeId(natScopeId); String natName = attrName; dataBuff.setRequiredName(natName); boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } dataBuff.setOptionalPrevTenantId(natPrevTenantId); Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } dataBuff.setOptionalPrevId(natPrevId); Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } dataBuff.setOptionalNextTenantId(natNextTenantId); Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } dataBuff.setOptionalNextId(natNextId); 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); } long natSchemaDefId = Long.parseLong(attrSchemaDefId); dataBuff.setRequiredSchemaDefId(natSchemaDefId); // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgTokenTypeMessageFormatter.formatTokenTypeRspnUpdated( "\n\t\t\t", origBuff.getTokenTypeBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFDbTestXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // TSecGroup Attributes String attrTenantId = null; String attrTSecGroupId = null; String attrName = null; String attrIsVisible = 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("RspnTSecGroupLocked"); CFFreeSwitchXMsgRspnHandler xmsgRspnHandler = (CFFreeSwitchXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFFreeSwitchSchemaObj 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("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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TSecGroupId")) { if (attrTSecGroupId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTSecGroupId = 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("IsVisible")) { if (attrIsVisible != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsVisible = 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 ((attrTSecGroupId == null) || (attrTSecGroupId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TSecGroupId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsVisible == null) || (attrIsVisible.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsVisible"); } 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); int natTSecGroupId = Integer.parseInt(attrTSecGroupId); String natName = attrName; boolean natIsVisible; if (attrIsVisible.equals("true") || attrIsVisible.equals("yes") || attrIsVisible.equals("1")) { natIsVisible = true; } else if (attrIsVisible.equals("false") || attrIsVisible.equals("no") || attrIsVisible.equals("0")) { natIsVisible = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsVisible value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsVisible + "\""); } int natRevision = Integer.parseInt(attrRevision); 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); } // Instantiate a buffer for the parsed information ICFFreeSwitchTSecGroupObj obj = (ICFFreeSwitchTSecGroupObj) schemaObj.getTSecGroupTableObj().newInstance(); CFSecurityTSecGroupBuff dataBuff = obj.getTSecGroupBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredTSecGroupId(natTSecGroupId); dataBuff.setRequiredName(natName); dataBuff.setRequiredIsVisible(natIsVisible); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } obj.copyBuffToPKey(); ICFFreeSwitchTSecGroupObj realized = (ICFFreeSwitchTSecGroupObj) 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); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // Value Attributes String attrTenantId = null; String attrScopeId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrGenerateId = null; String attrDataScope = null; String attrViewAccessSecurity = null; String attrEditAccessSecurity = null; String attrViewAccessFrequency = null; String attrEditAccessFrequency = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = null; String attrDefaultVisibility = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Atom Attributes String attrDbName = null; // NmTokenDef Attributes String attrMaxLen = null; String attrInitValue = null; String attrDefaultValue = null; String attrNullValue = null; String attrUnknownValue = null; String attrShowLines = null; // NmTokenCol Attributes String attrTableId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("NmTokenCol"); CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj 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("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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = 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("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenerateId")) { if (attrGenerateId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerateId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DataScope")) { if (attrDataScope != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScope = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessSecurity")) { if (attrViewAccessSecurity != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessSecurity = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessSecurity")) { if (attrEditAccessSecurity != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessSecurity = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessFrequency")) { if (attrViewAccessFrequency != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequency = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessFrequency")) { if (attrEditAccessFrequency != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequency = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxLen")) { if (attrMaxLen != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxLen = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InitValue")) { if (attrInitValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInitValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultValue")) { if (attrDefaultValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NullValue")) { if (attrNullValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNullValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnknownValue")) { if (attrUnknownValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnknownValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShowLines")) { if (attrShowLines != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShowLines = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TableId")) { if (attrTableId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTableId = 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 ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } if ((attrMaxLen == null) || (attrMaxLen.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MaxLen"); } if ((attrShowLines == null) || (attrShowLines.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ShowLines"); } if ((attrTableId == null) || (attrTableId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TableId"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natScopeId = Long.parseLong(attrScopeId); long natId = Long.parseLong(attrId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } String natName = attrName; String natShortName = attrShortName; String natLabel = attrLabel; String natShortDescription = attrShortDescription; String natDescription = attrDescription; boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } Boolean natGenerateId; if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) { natGenerateId = null; } else if (attrGenerateId.equals("true") || attrGenerateId.equals("yes") || attrGenerateId.equals("1")) { natGenerateId = true; } else if (attrGenerateId.equals("false") || attrGenerateId.equals("no") || attrGenerateId.equals("0")) { natGenerateId = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerateId + "\""); } ICFBamSchema.DataScopeEnum natDataScope; if ((attrDataScope == null) || (attrDataScope.length() <= 0)) { natDataScope = null; } else { natDataScope = CFBamSchema.parseDataScopeEnum(attrDataScope); } ICFBamSchema.AccessSecurityEnum natViewAccessSecurity; if ((attrViewAccessSecurity == null) || (attrViewAccessSecurity.length() <= 0)) { natViewAccessSecurity = null; } else { natViewAccessSecurity = CFBamSchema.parseAccessSecurityEnum(attrViewAccessSecurity); } ICFBamSchema.AccessSecurityEnum natEditAccessSecurity; if ((attrEditAccessSecurity == null) || (attrEditAccessSecurity.length() <= 0)) { natEditAccessSecurity = null; } else { natEditAccessSecurity = CFBamSchema.parseAccessSecurityEnum(attrEditAccessSecurity); } ICFBamSchema.AccessFrequencyEnum natViewAccessFrequency; if ((attrViewAccessFrequency == null) || (attrViewAccessFrequency.length() <= 0)) { natViewAccessFrequency = null; } else { natViewAccessFrequency = CFBamSchema.parseAccessFrequencyEnum(attrViewAccessFrequency); } ICFBamSchema.AccessFrequencyEnum natEditAccessFrequency; if ((attrEditAccessFrequency == null) || (attrEditAccessFrequency.length() <= 0)) { natEditAccessFrequency = null; } else { natEditAccessFrequency = CFBamSchema.parseAccessFrequencyEnum(attrEditAccessFrequency); } Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } int natRevision = Integer.parseInt(attrRevision); 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); } String natDbName = attrDbName; int natMaxLen = Integer.parseInt(attrMaxLen); String natInitValue = attrInitValue; String natDefaultValue = attrDefaultValue; String natNullValue = attrNullValue; String natUnknownValue = attrUnknownValue; short natShowLines = Short.parseShort(attrShowLines); long natTableId = Long.parseLong(attrTableId); // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFBamNmTokenColObj obj = (ICFBamNmTokenColObj) (schemaObj.getNmTokenColTableObj().newInstance()); CFBamNmTokenColBuff dataBuff = obj.getNmTokenColBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredScopeId(natScopeId); dataBuff.setRequiredId(natId); dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); dataBuff.setOptionalDefSchemaId(natDefSchemaId); dataBuff.setRequiredName(natName); dataBuff.setOptionalShortName(natShortName); dataBuff.setOptionalLabel(natLabel); dataBuff.setOptionalShortDescription(natShortDescription); dataBuff.setOptionalDescription(natDescription); dataBuff.setRequiredIsNullable(natIsNullable); dataBuff.setOptionalGenerateId(natGenerateId); dataBuff.setOptionalDataScope(natDataScope); dataBuff.setOptionalViewAccessSecurity(natViewAccessSecurity); dataBuff.setOptionalEditAccessSecurity(natEditAccessSecurity); dataBuff.setOptionalViewAccessFrequency(natViewAccessFrequency); dataBuff.setOptionalEditAccessFrequency(natEditAccessFrequency); dataBuff.setOptionalPrevTenantId(natPrevTenantId); dataBuff.setOptionalPrevId(natPrevId); dataBuff.setOptionalNextTenantId(natNextTenantId); dataBuff.setOptionalNextId(natNextId); dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } dataBuff.setOptionalDbName(natDbName); dataBuff.setRequiredMaxLen(natMaxLen); dataBuff.setOptionalInitValue(natInitValue); dataBuff.setOptionalDefaultValue(natDefaultValue); dataBuff.setOptionalNullValue(natNullValue); dataBuff.setOptionalUnknownValue(natUnknownValue); dataBuff.setRequiredShowLines(natShowLines); dataBuff.setRequiredTableId(natTableId); obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFBamValueObj> list = (List<ICFBamValueObj>) xmsgRspnHandler.getListOfObjects(); ICFBamNmTokenColObj realized = (ICFBamNmTokenColObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(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); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // FSSFConferenceProfile Attributes String attrTenantId = null; String attrFSSFConferenceProfileId = null; String attrFSSFConferenceId = null; String attrName = null; String attrSoundPrefix = null; String attrAckSound = null; String attrAloneSound = null; String attrBadPinSound = null; String attrEnterSound = null; String attrExitSound = null; String attrIsLockedSound = null; String attrKickedSound = null; String attrLockedSound = null; String attrMaxMembersSound = null; String attrMOHSound = null; String attrMuteDetectSound = null; String attrMutedSound = null; String attrNackSound = null; String attrPerpetualSound = null; String attrPinSound = null; String attrPin = null; String attrUnmutedSound = null; String attrRate = null; String attrAutoRecord = null; String attrValInterval = null; String attrEnergyLevel = null; String attrMemberFlags = null; String attrConferenceFlags = null; String attrCallerControls = null; String attrTTSEngine = null; String attrTTSVoice = null; String attrMaxMembers = null; String attrComfortNoise = null; String attrAnnounceCount = null; String attrSuppressEvents = null; String attrVerboseEvents = null; String attrCallerIdName = null; String attrCallerIdNumber = 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("RqstFSSFConferenceProfileCreate"); CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFFreeSwitchFSSFConferenceProfileEditObj editBuff = (ICFFreeSwitchFSSFConferenceProfileEditObj) schemaObj.getFSSFConferenceProfileTableObj().newInstance().beginEdit(); CFFreeSwitchFSSFConferenceProfileBuff dataBuff = (CFFreeSwitchFSSFConferenceProfileBuff) editBuff.getFSSFConferenceProfileBuff(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else 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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FSSFConferenceProfileId")) { if (attrFSSFConferenceProfileId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFConferenceProfileId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FSSFConferenceId")) { if (attrFSSFConferenceId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFConferenceId = 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("SoundPrefix")) { if (attrSoundPrefix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSoundPrefix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AckSound")) { if (attrAckSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAckSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AloneSound")) { if (attrAloneSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAloneSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("BadPinSound")) { if (attrBadPinSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrBadPinSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EnterSound")) { if (attrEnterSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEnterSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ExitSound")) { if (attrExitSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrExitSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsLockedSound")) { if (attrIsLockedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsLockedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("KickedSound")) { if (attrKickedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrKickedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("LockedSound")) { if (attrLockedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLockedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxMembersSound")) { if (attrMaxMembersSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxMembersSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MOHSound")) { if (attrMOHSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMOHSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MuteDetectSound")) { if (attrMuteDetectSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMuteDetectSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MutedSound")) { if (attrMutedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMutedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NackSound")) { if (attrNackSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNackSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PerpetualSound")) { if (attrPerpetualSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPerpetualSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PinSound")) { if (attrPinSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPinSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Pin")) { if (attrPin != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPin = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnmutedSound")) { if (attrUnmutedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnmutedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Rate")) { if (attrRate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AutoRecord")) { if (attrAutoRecord != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAutoRecord = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ValInterval")) { if (attrValInterval != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrValInterval = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EnergyLevel")) { if (attrEnergyLevel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEnergyLevel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MemberFlags")) { if (attrMemberFlags != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMemberFlags = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ConferenceFlags")) { if (attrConferenceFlags != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrConferenceFlags = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CallerControls")) { if (attrCallerControls != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCallerControls = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TTSEngine")) { if (attrTTSEngine != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTTSEngine = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TTSVoice")) { if (attrTTSVoice != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTTSVoice = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxMembers")) { if (attrMaxMembers != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxMembers = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ComfortNoise")) { if (attrComfortNoise != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrComfortNoise = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AnnounceCount")) { if (attrAnnounceCount != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAnnounceCount = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SuppressEvents")) { if (attrSuppressEvents != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSuppressEvents = attrs.getValue(idxAttr); } else if (attrLocalName.equals("VerboseEvents")) { if (attrVerboseEvents != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrVerboseEvents = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CallerIdName")) { if (attrCallerIdName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCallerIdName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CallerIdNumber")) { if (attrCallerIdNumber != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCallerIdNumber = attrs.getValue(idxAttr); } 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 ((attrFSSFConferenceProfileId == null) || (attrFSSFConferenceProfileId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFConferenceProfileId"); } if ((attrFSSFConferenceId == null) || (attrFSSFConferenceId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFConferenceId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if (attrSoundPrefix == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SoundPrefix"); } if ((attrRate == null) || (attrRate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Rate"); } if (attrAutoRecord == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AutoRecord"); } if ((attrValInterval == null) || (attrValInterval.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ValInterval"); } if ((attrEnergyLevel == null) || (attrEnergyLevel.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "EnergyLevel"); } if (attrMemberFlags == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MemberFlags"); } if (attrConferenceFlags == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ConferenceFlags"); } if (attrCallerControls == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CallerControls"); } if (attrTTSEngine == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TTSEngine"); } if (attrTTSVoice == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TTSVoice"); } if ((attrMaxMembers == null) || (attrMaxMembers.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MaxMembers"); } if ((attrComfortNoise == null) || (attrComfortNoise.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ComfortNoise"); } if ((attrAnnounceCount == null) || (attrAnnounceCount.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AnnounceCount"); } if (attrSuppressEvents == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SuppressEvents"); } if (attrVerboseEvents == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "VerboseEvents"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId = Long.parseLong(attrTenantId); dataBuff.setRequiredTenantId(natTenantId); long natFSSFConferenceProfileId = Long.parseLong(attrFSSFConferenceProfileId); dataBuff.setRequiredFSSFConferenceProfileId(natFSSFConferenceProfileId); long natFSSFConferenceId = Long.parseLong(attrFSSFConferenceId); dataBuff.setRequiredFSSFConferenceId(natFSSFConferenceId); String natName = attrName; dataBuff.setRequiredName(natName); String natSoundPrefix = attrSoundPrefix; dataBuff.setRequiredSoundPrefix(natSoundPrefix); String natAckSound = attrAckSound; dataBuff.setOptionalAckSound(natAckSound); String natAloneSound = attrAloneSound; dataBuff.setOptionalAloneSound(natAloneSound); String natBadPinSound = attrBadPinSound; dataBuff.setOptionalBadPinSound(natBadPinSound); String natEnterSound = attrEnterSound; dataBuff.setOptionalEnterSound(natEnterSound); String natExitSound = attrExitSound; dataBuff.setOptionalExitSound(natExitSound); String natIsLockedSound = attrIsLockedSound; dataBuff.setOptionalIsLockedSound(natIsLockedSound); String natKickedSound = attrKickedSound; dataBuff.setOptionalKickedSound(natKickedSound); String natLockedSound = attrLockedSound; dataBuff.setOptionalLockedSound(natLockedSound); String natMaxMembersSound = attrMaxMembersSound; dataBuff.setOptionalMaxMembersSound(natMaxMembersSound); String natMOHSound = attrMOHSound; dataBuff.setOptionalMOHSound(natMOHSound); String natMuteDetectSound = attrMuteDetectSound; dataBuff.setOptionalMuteDetectSound(natMuteDetectSound); String natMutedSound = attrMutedSound; dataBuff.setOptionalMutedSound(natMutedSound); String natNackSound = attrNackSound; dataBuff.setOptionalNackSound(natNackSound); String natPerpetualSound = attrPerpetualSound; dataBuff.setOptionalPerpetualSound(natPerpetualSound); String natPinSound = attrPinSound; dataBuff.setOptionalPinSound(natPinSound); String natPin = attrPin; dataBuff.setOptionalPin(natPin); String natUnmutedSound = attrUnmutedSound; dataBuff.setOptionalUnmutedSound(natUnmutedSound); int natRate = Integer.parseInt(attrRate); dataBuff.setRequiredRate(natRate); String natAutoRecord = attrAutoRecord; dataBuff.setRequiredAutoRecord(natAutoRecord); int natValInterval = Integer.parseInt(attrValInterval); dataBuff.setRequiredValInterval(natValInterval); int natEnergyLevel = Integer.parseInt(attrEnergyLevel); dataBuff.setRequiredEnergyLevel(natEnergyLevel); String natMemberFlags = attrMemberFlags; dataBuff.setRequiredMemberFlags(natMemberFlags); String natConferenceFlags = attrConferenceFlags; dataBuff.setRequiredConferenceFlags(natConferenceFlags); String natCallerControls = attrCallerControls; dataBuff.setRequiredCallerControls(natCallerControls); String natTTSEngine = attrTTSEngine; dataBuff.setRequiredTTSEngine(natTTSEngine); String natTTSVoice = attrTTSVoice; dataBuff.setRequiredTTSVoice(natTTSVoice); int natMaxMembers = Integer.parseInt(attrMaxMembers); dataBuff.setRequiredMaxMembers(natMaxMembers); int natComfortNoise = Integer.parseInt(attrComfortNoise); dataBuff.setRequiredComfortNoise(natComfortNoise); int natAnnounceCount = Integer.parseInt(attrAnnounceCount); dataBuff.setRequiredAnnounceCount(natAnnounceCount); String natSuppressEvents = attrSuppressEvents; dataBuff.setRequiredSuppressEvents(natSuppressEvents); String natVerboseEvents = attrVerboseEvents; dataBuff.setRequiredVerboseEvents(natVerboseEvents); String natCallerIdName = attrCallerIdName; dataBuff.setOptionalCallerIdName(natCallerIdName); String natCallerIdNumber = attrCallerIdNumber; dataBuff.setOptionalCallerIdNumber(natCallerIdNumber); 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 create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFFreeSwitchFSSFConferenceProfileObj created = (ICFFreeSwitchFSSFConferenceProfileObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgFSSFConferenceProfileMessageFormatter .formatFSSFConferenceProfileRspnCreated( "\n\t\t\t", created.getFSSFConferenceProfileBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // Param Attributes String attrTenantId = null; String attrServerMethodId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrTypeTenantId = null; String attrTypeId = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = 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("Param"); CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj 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("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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ServerMethodId")) { if (attrServerMethodId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrServerMethodId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = 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("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TypeTenantId")) { if (attrTypeTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTypeTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TypeId")) { if (attrTypeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = 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 ((attrServerMethodId == null) || (attrServerMethodId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ServerMethodId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natServerMethodId = Long.parseLong(attrServerMethodId); long natId = Long.parseLong(attrId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } String natName = attrName; String natShortDescription = attrShortDescription; String natDescription = attrDescription; boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } Long natTypeTenantId; if ((attrTypeTenantId == null) || (attrTypeTenantId.length() <= 0)) { natTypeTenantId = null; } else { natTypeTenantId = new Long(Long.parseLong(attrTypeTenantId)); } Long natTypeId; if ((attrTypeId == null) || (attrTypeId.length() <= 0)) { natTypeId = null; } else { natTypeId = new Long(Long.parseLong(attrTypeId)); } Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } int natRevision = Integer.parseInt(attrRevision); 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); } // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFBamParamObj obj = (ICFBamParamObj) (schemaObj.getParamTableObj().newInstance()); CFBamParamBuff dataBuff = obj.getParamBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredServerMethodId(natServerMethodId); dataBuff.setRequiredId(natId); dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); dataBuff.setOptionalDefSchemaId(natDefSchemaId); dataBuff.setRequiredName(natName); dataBuff.setOptionalShortDescription(natShortDescription); dataBuff.setOptionalDescription(natDescription); dataBuff.setRequiredIsNullable(natIsNullable); dataBuff.setOptionalTypeTenantId(natTypeTenantId); dataBuff.setOptionalTypeId(natTypeId); dataBuff.setOptionalPrevTenantId(natPrevTenantId); dataBuff.setOptionalPrevId(natPrevId); dataBuff.setOptionalNextTenantId(natNextTenantId); dataBuff.setOptionalNextId(natNextId); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFBamParamObj> list = (List<ICFBamParamObj>) xmsgRspnHandler.getListOfObjects(); ICFBamParamObj realized = (ICFBamParamObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(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); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // Cluster Attributes String attrFullDomainName = null; String attrDescription = 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("RspnClusterLocked"); CFSecurityXMsgRspnHandler xmsgRspnHandler = (CFSecurityXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFSecuritySchemaObj 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("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("FullDomainName")) { if (attrFullDomainName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFullDomainName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = 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 (attrFullDomainName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FullDomainName"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } 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 natId = Long.parseLong(attrId); String natFullDomainName = attrFullDomainName; String natDescription = attrDescription; int natRevision = Integer.parseInt(attrRevision); 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); } // Instantiate a buffer for the parsed information ICFSecurityClusterObj obj = (ICFSecurityClusterObj) schemaObj.getClusterTableObj().newInstance(); CFSecurityClusterBuff dataBuff = obj.getClusterBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredFullDomainName(natFullDomainName); dataBuff.setRequiredDescription(natDescription); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } obj.copyBuffToPKey(); ICFSecurityClusterObj realized = (ICFSecurityClusterObj) 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); } }
protected CFInternetTopDomainBuff unpackTopDomainResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackTopDomainResultSetToBuff"; int idxcol = 1; String classCode = resultSet.getString(idxcol); idxcol++; CFInternetTopDomainBuff buff; if (classCode.equals("TDOM")) { buff = schema.getFactoryTopDomain().newBuff(); } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Unrecognized class code \"" + classCode + "\""); } { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFDbTestDb2LUWSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFDbTestDb2LUWSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredId(resultSet.getLong(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDescription(null); } else { buff.setOptionalDescription(colVal); } } idxcol++; buff.setRequiredTldId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }