public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { 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; // ServerMethod Attributes String attrTableId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrSuffix = null; String attrDefaultVisibility = null; String attrIsInstanceMethod = null; String attrJMethodBody = null; // ServerProc Attributes String attrDummy = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnServerProcUpdated"); 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("TableId")) { if (attrTableId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTableId = 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("Suffix")) { if (attrSuffix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSuffix = 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("IsInstanceMethod")) { if (attrIsInstanceMethod != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsInstanceMethod = attrs.getValue(idxAttr); } else if (attrLocalName.equals("JMethodBody")) { if (attrJMethodBody != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrJMethodBody = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Dummy")) { if (attrDummy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDummy = 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 ((attrTableId == null) || (attrTableId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TableId"); } 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 ((attrIsInstanceMethod == null) || (attrIsInstanceMethod.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsInstanceMethod"); } if (attrJMethodBody == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "JMethodBody"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natId = Long.parseLong(attrId); 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); } long natTableId = Long.parseLong(attrTableId); 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; String natSuffix = attrSuffix; 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 + "\""); } boolean natIsInstanceMethod; if (attrIsInstanceMethod.equals("true") || attrIsInstanceMethod.equals("yes") || attrIsInstanceMethod.equals("1")) { natIsInstanceMethod = true; } else if (attrIsInstanceMethod.equals("false") || attrIsInstanceMethod.equals("no") || attrIsInstanceMethod.equals("0")) { natIsInstanceMethod = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsInstanceMethod value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsInstanceMethod + "\""); } String natJMethodBody = attrJMethodBody; String natDummy = attrDummy; // Instantiate a buffer for the parsed information ICFBamServerProcObj obj = (ICFBamServerProcObj) schemaObj.getServerProcTableObj().newInstance(); CFBamServerProcBuff dataBuff = obj.getServerProcBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredId(natId); 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.setRequiredTableId(natTableId); dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); dataBuff.setOptionalDefSchemaId(natDefSchemaId); dataBuff.setRequiredName(natName); dataBuff.setOptionalShortName(natShortName); dataBuff.setOptionalLabel(natLabel); dataBuff.setOptionalShortDescription(natShortDescription); dataBuff.setOptionalDescription(natDescription); dataBuff.setOptionalSuffix(natSuffix); dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); dataBuff.setRequiredIsInstanceMethod(natIsInstanceMethod); dataBuff.setRequiredJMethodBody(natJMethodBody); dataBuff.setOptionalDummy(natDummy); obj.copyBuffToPKey(); ICFBamServerProcObj realized = (ICFBamServerProcObj) 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 setServerProcBuff(CFBamServerProcBuff src) { super.setServerMethodBuff(src); setOptionalDummy(src.getOptionalDummy()); }
public boolean equals(Object obj) { if (obj == null) { return (false); } else if (obj instanceof CFBamServerProcBuff) { CFBamServerProcBuff rhs = (CFBamServerProcBuff) obj; if (getRequiredTenantId() != rhs.getRequiredTenantId()) { return (false); } if (getRequiredId() != rhs.getRequiredId()) { return (false); } if (getOptionalDummy() != null) { if (rhs.getOptionalDummy() != null) { if (!getOptionalDummy().equals(rhs.getOptionalDummy())) { return (false); } } } else { if (rhs.getOptionalDummy() != null) { return (false); } } return (true); } else if (obj instanceof CFBamScopePKey) { CFBamScopePKey rhs = (CFBamScopePKey) obj; if (getRequiredTenantId() != rhs.getRequiredTenantId()) { return (false); } if (getRequiredId() != rhs.getRequiredId()) { return (false); } return (true); } else if (obj instanceof CFBamServerProcHBuff) { CFBamServerProcHBuff rhs = (CFBamServerProcHBuff) obj; if (getRequiredTenantId() != rhs.getRequiredTenantId()) { return (false); } if (getRequiredId() != rhs.getRequiredId()) { return (false); } if (getOptionalDummy() != null) { if (rhs.getOptionalDummy() != null) { if (!getOptionalDummy().equals(rhs.getOptionalDummy())) { return (false); } } } else { if (rhs.getOptionalDummy() != null) { return (false); } } return (true); } else if (obj instanceof CFBamScopeHPKey) { CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj; if (getRequiredTenantId() != rhs.getRequiredTenantId()) { return (false); } if (getRequiredId() != rhs.getRequiredId()) { return (false); } return (true); } else { boolean retval = super.equals(obj); return (retval); } }
public int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFBamServerProcBuff) { CFBamServerProcBuff rhs = (CFBamServerProcBuff) obj; int retval = super.compareTo(rhs); if (retval != 0) { return (retval); } if (getOptionalDummy() != null) { if (rhs.getOptionalDummy() != null) { int cmp = getOptionalDummy().compareTo(rhs.getOptionalDummy()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDummy() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamScopePKey) { CFBamScopePKey rhs = (CFBamScopePKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFBamScopeHPKey) { CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj; { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFBamServerProcHBuff) { CFBamServerProcHBuff rhs = (CFBamServerProcHBuff) obj; int retval = super.compareTo(rhs); if (retval != 0) { return (retval); } if (getOptionalDummy() != null) { if (rhs.getOptionalDummy() != null) { int cmp = getOptionalDummy().compareTo(rhs.getOptionalDummy()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDummy() != null) { return (-1); } } return (0); } else { int retval = super.compareTo(obj); return (retval); } }