public int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFBamEnumTagBuff) { CFBamEnumTagBuff rhs = (CFBamEnumTagBuff) obj; int retval = super.compareTo(rhs); if (retval != 0) { return (retval); } return (0); } else if (obj instanceof CFBamEnumTagByEnumTagTenantIdxKey) { CFBamEnumTagByEnumTagTenantIdxKey rhs = (CFBamEnumTagByEnumTagTenantIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } return (0); } else if (obj instanceof CFBamEnumTagByEnumIdxKey) { CFBamEnumTagByEnumIdxKey rhs = (CFBamEnumTagByEnumIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredEnumId() < rhs.getRequiredEnumId()) { return (-1); } else if (getRequiredEnumId() > rhs.getRequiredEnumId()) { return (1); } return (0); } else if (obj instanceof CFBamEnumTagByDefSchemaIdxKey) { CFBamEnumTagByDefSchemaIdxKey rhs = (CFBamEnumTagByDefSchemaIdxKey) obj; if (getOptionalDefSchemaTenantId() != null) { Long lhsDefSchemaTenantId = getOptionalDefSchemaTenantId(); if (rhs.getOptionalDefSchemaTenantId() != null) { Long rhsDefSchemaTenantId = rhs.getOptionalDefSchemaTenantId(); int cmp = lhsDefSchemaTenantId.compareTo(rhsDefSchemaTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaTenantId() != null) { return (-1); } } if (getOptionalDefSchemaId() != null) { Long lhsDefSchemaId = getOptionalDefSchemaId(); if (rhs.getOptionalDefSchemaId() != null) { Long rhsDefSchemaId = rhs.getOptionalDefSchemaId(); int cmp = lhsDefSchemaId.compareTo(rhsDefSchemaId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagByEnumNameIdxKey) { CFBamEnumTagByEnumNameIdxKey rhs = (CFBamEnumTagByEnumNameIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredEnumId() < rhs.getRequiredEnumId()) { return (-1); } else if (getRequiredEnumId() > rhs.getRequiredEnumId()) { return (1); } { int cmp = getRequiredName().compareTo(rhs.getRequiredName()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFBamEnumTagByPrevIdxKey) { CFBamEnumTagByPrevIdxKey rhs = (CFBamEnumTagByPrevIdxKey) obj; if (getOptionalPrevTenantId() != null) { Long lhsPrevTenantId = getOptionalPrevTenantId(); if (rhs.getOptionalPrevTenantId() != null) { Long rhsPrevTenantId = rhs.getOptionalPrevTenantId(); int cmp = lhsPrevTenantId.compareTo(rhsPrevTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevTenantId() != null) { return (-1); } } if (getOptionalPrevId() != null) { Long lhsPrevId = getOptionalPrevId(); if (rhs.getOptionalPrevId() != null) { Long rhsPrevId = rhs.getOptionalPrevId(); int cmp = lhsPrevId.compareTo(rhsPrevId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagByNextIdxKey) { CFBamEnumTagByNextIdxKey rhs = (CFBamEnumTagByNextIdxKey) obj; if (getOptionalNextTenantId() != null) { Long lhsNextTenantId = getOptionalNextTenantId(); if (rhs.getOptionalNextTenantId() != null) { Long rhsNextTenantId = rhs.getOptionalNextTenantId(); int cmp = lhsNextTenantId.compareTo(rhsNextTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextTenantId() != null) { return (-1); } } if (getOptionalNextId() != null) { Long lhsNextId = getOptionalNextId(); if (rhs.getOptionalNextId() != null) { Long rhsNextId = rhs.getOptionalNextId(); int cmp = lhsNextId.compareTo(rhsNextId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagHBuff) { CFBamEnumTagHBuff rhs = (CFBamEnumTagHBuff) obj; int retval = 0; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } 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); } if (getOptionalDefSchemaTenantId() != null) { Long lhsDefSchemaTenantId = getOptionalDefSchemaTenantId(); if (rhs.getOptionalDefSchemaTenantId() != null) { Long rhsDefSchemaTenantId = rhs.getOptionalDefSchemaTenantId(); int cmp = lhsDefSchemaTenantId.compareTo(rhsDefSchemaTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaTenantId() != null) { return (-1); } } if (getOptionalDefSchemaId() != null) { Long lhsDefSchemaId = getOptionalDefSchemaId(); if (rhs.getOptionalDefSchemaId() != null) { Long rhsDefSchemaId = rhs.getOptionalDefSchemaId(); int cmp = lhsDefSchemaId.compareTo(rhsDefSchemaId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaId() != null) { return (-1); } } if (getRequiredEnumId() < rhs.getRequiredEnumId()) { return (-1); } else if (getRequiredEnumId() > rhs.getRequiredEnumId()) { return (1); } if (getOptionalEnumCode() != null) { Short lhsEnumCode = getOptionalEnumCode(); if (rhs.getOptionalEnumCode() != null) { Short rhsEnumCode = rhs.getOptionalEnumCode(); int cmp = lhsEnumCode.compareTo(rhsEnumCode); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEnumCode() != null) { return (-1); } } { int cmp = getRequiredName().compareTo(rhs.getRequiredName()); if (cmp != 0) { return (cmp); } } if (getOptionalPrevTenantId() != null) { Long lhsPrevTenantId = getOptionalPrevTenantId(); if (rhs.getOptionalPrevTenantId() != null) { Long rhsPrevTenantId = rhs.getOptionalPrevTenantId(); int cmp = lhsPrevTenantId.compareTo(rhsPrevTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevTenantId() != null) { return (-1); } } if (getOptionalPrevId() != null) { Long lhsPrevId = getOptionalPrevId(); if (rhs.getOptionalPrevId() != null) { Long rhsPrevId = rhs.getOptionalPrevId(); int cmp = lhsPrevId.compareTo(rhsPrevId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevId() != null) { return (-1); } } if (getOptionalNextTenantId() != null) { Long lhsNextTenantId = getOptionalNextTenantId(); if (rhs.getOptionalNextTenantId() != null) { Long rhsNextTenantId = rhs.getOptionalNextTenantId(); int cmp = lhsNextTenantId.compareTo(rhsNextTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextTenantId() != null) { return (-1); } } if (getOptionalNextId() != null) { Long lhsNextId = getOptionalNextId(); if (rhs.getOptionalNextId() != null) { Long rhsNextId = rhs.getOptionalNextId(); int cmp = lhsNextId.compareTo(rhsNextId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagHPKey) { CFBamEnumTagHPKey rhs = (CFBamEnumTagHPKey) obj; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } 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 CFBamEnumTagPKey) { CFBamEnumTagPKey rhs = (CFBamEnumTagPKey) 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 CFBamHPKey) { CFBamHPKey rhs = (CFBamHPKey) obj; { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } return (0); } else { return (super.compareTo(obj)); } }
public int compareTo(Object obj) { if (obj == null) { return (1); } else if (obj instanceof CFBamSchemaDefByEAccSecIdxKey) { CFBamSchemaDefByEAccSecIdxKey rhs = (CFBamSchemaDefByEAccSecIdxKey) obj; if (getOptionalEditAccessSecurityId() != null) { Short lhsEditAccessSecurityId = getOptionalEditAccessSecurityId(); if (rhs.getOptionalEditAccessSecurityId() != null) { Short rhsEditAccessSecurityId = rhs.getOptionalEditAccessSecurityId(); int cmp = lhsEditAccessSecurityId.compareTo(rhsEditAccessSecurityId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEditAccessSecurityId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamSchemaDefBuff) { CFBamSchemaDefBuff rhs = (CFBamSchemaDefBuff) obj; if (getOptionalEditAccessSecurityId() != null) { Short lhsEditAccessSecurityId = getOptionalEditAccessSecurityId(); if (rhs.getOptionalEditAccessSecurityId() != null) { Short rhsEditAccessSecurityId = rhs.getOptionalEditAccessSecurityId(); int cmp = lhsEditAccessSecurityId.compareTo(rhsEditAccessSecurityId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEditAccessSecurityId() != null) { return (-1); } } return (0); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null); } }
public CFSecurityCursor openISOTimezoneCursorByOffsetIdx( CFSecurityAuthorization Authorization, short TZHourOffset, short TZMinOffset) { String sql = getSqlSelectISOTimezoneBuff() + "WHERE " + "itzn.TZHourOffset = " + Short.toString(TZHourOffset) + " " + "AND " + "itzn.TZMinOffset = " + Short.toString(TZMinOffset) + " " + "ORDER BY " + "itzn.ISOTimezoneId ASC"; CFDbTestCursor cursor = new CFDbTestPgSqlCursor(Authorization, schema, sql); return (cursor); }
public String toString() { String ret = "<CFSecurityISOCountryLanguageByCountryIdx" + " RequiredISOCountryId=" + "\"" + Short.toString(getRequiredISOCountryId()) + "\"" + "/>"; return (ret); }
private Short parseShort(String value) throws IllegalArgumentException { if (value == null || value.trim().length() == 0) { return null; } try { return Short.parseShort(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid short value '" + value + "' specified"); } }
public String toString() { String ret = "<CFBamISOLanguageHPKey" + " RequiredId=" + "\"" + Short.toString(getRequiredId()) + "\"" + " RequiredRevision=\"" + Integer.toString(getRequiredRevision()) + "\"" + "/>"; return (ret); }
public String toString() { String ret = "<CFInternetURLProtocolHPKey" + " RequiredURLProtocolId=" + "\"" + Short.toString(getRequiredURLProtocolId()) + "\"" + " RequiredRevision=\"" + Integer.toString(getRequiredRevision()) + "\"" + "/>"; return (ret); }
public String toString() { String ret = "<CFAsteriskClusterId64Gen" + " RequiredId=" + "\"" + Long.toString(getRequiredId()) + "\"" + ", SliceId=\"" + Short.toString(getRequiredSliceId()) + "\"" + ", NextId=\"" + Long.toString(nextId) + "\"/>"; return (ret); }
public CFSecurityCursor openISOCountryLanguageCursorByLanguageIdx( CFSecurityAuthorization Authorization, short ISOLanguageId) { String sql = getSqlSelectISOCountryLanguageBuff() + "WHERE " + "iscl.ISOLanguageId = " + Short.toString(ISOLanguageId) + " " + "ORDER BY " + "iscl.ISOCountryId ASC" + ", " + "iscl.ISOLanguageId ASC"; CFFreeSwitchCursor cursor = new CFFreeSwitchPgSqlCursor(Authorization, schema, sql); return (cursor); }
public String toString() { String ret = "<CFCrmClusterId32Gen" + " RequiredId=" + "\"" + Long.toString(getRequiredId()) + "\"" + ", SliceId=\"" + Short.toString(getRequiredSliceId()) + "\"" + ", NextId=\"" + Integer.toString(nextId) + "\"/>"; return (ret); }
public CFSecurityCursor openISOCountryCurrencyCursorByCurrencyIdx( CFSecurityAuthorization Authorization, short ISOCurrencyId) { String sql = getSqlSelectISOCountryCurrencyBuff() + " WHERE " + "iccy.isocurrencyid = " + Short.toString(ISOCurrencyId) + " " + "ORDER BY " + "iccy.ISOCountryId ASC" + ", " + "iccy.ISOCurrencyId ASC"; CFBamCursor cursor = new CFBamMSSqlCursor(Authorization, schema, sql); return (cursor); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support // ISOLanguage Attributes String attrISOCode = null; String attrBaseLanguageCode = null; String attrISOCountryId = null; // ISOLanguage References // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("ISOLanguage"); CFDbTestSaxLoader saxLoader = (CFDbTestSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFDbTestISOLanguageEditObj editBuff = (ICFDbTestISOLanguageEditObj) schemaObj.getISOLanguageTableObj().newInstance().beginEdit(); // 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("ISOCode")) { if (attrISOCode != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("BaseLanguageCode")) { if (attrBaseLanguageCode != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrBaseLanguageCode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrISOCode == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCode"); } if (attrBaseLanguageCode == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "BaseLanguageCode"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("ISOCode", attrISOCode); curContext.putNamedValue("BaseLanguageCode", attrBaseLanguageCode); curContext.putNamedValue("ISOCountryId", attrISOCountryId); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natId; natId = Short.parseShort(attrId); editBuff.getPKey().setRequiredId(natId); editBuff.getISOLanguageBuff().setRequiredId(natId); String natISOCode = attrISOCode; editBuff.setRequiredISOCode(natISOCode); String natBaseLanguageCode = attrBaseLanguageCode; editBuff.setRequiredBaseLanguageCode(natBaseLanguageCode); Short natISOCountryId; if ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { natISOCountryId = null; } else { natISOCountryId = new Short(Short.parseShort(attrISOCountryId)); } editBuff.setOptionalISOCountryId(natISOCountryId); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } CFDbTestSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getISOLanguageLoaderBehaviour(); ICFDbTestISOLanguageEditObj editISOLanguage = null; ICFDbTestISOLanguageObj origISOLanguage = (ICFDbTestISOLanguageObj) schemaObj .getISOLanguageTableObj() .readISOLanguageByCodeIdx(editBuff.getRequiredISOCode()); editBuff.getPKey().setRequiredId(natId); editBuff.getISOLanguageBuff().setRequiredId(natId); if (origISOLanguage == null) { editISOLanguage = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editISOLanguage = (ICFDbTestISOLanguageEditObj) origISOLanguage.beginEdit(); editISOLanguage.setRequiredISOCode(editBuff.getRequiredISOCode()); editISOLanguage.setRequiredBaseLanguageCode(editBuff.getRequiredBaseLanguageCode()); editISOLanguage.setOptionalISOCountryId(editBuff.getOptionalISOCountryId()); break; case Replace: editISOLanguage = (ICFDbTestISOLanguageEditObj) origISOLanguage.beginEdit(); editISOLanguage.delete(); editISOLanguage.endEdit(); origISOLanguage = null; editISOLanguage = editBuff; break; } } if (editISOLanguage != null) { if (origISOLanguage != null) { editISOLanguage.update(); } else { origISOLanguage = (ICFDbTestISOLanguageObj) editISOLanguage.create(); } editISOLanguage.endEdit(); } curContext.putNamedValue("Object", origISOLanguage); } 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 { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; 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 attrDataScopeId = null; String attrViewAccessSecurityId = null; String attrEditAccessSecurityId = null; String attrViewAccessFrequencyId = null; String attrEditAccessFrequencyId = 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; // BlobDef Attributes String attrMaxLen = null; String attrInitValue = null; String attrDefaultValue = null; String attrNullValue = null; String attrUnknownValue = null; // BlobType 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("RqstBlobTypeCreate"); 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()"); } // Instantiate an edit buffer for the parsed information ICFBamBlobTypeEditObj editBuff = (ICFBamBlobTypeEditObj) schemaObj.getBlobTypeTableObj().newInstance().beginEdit(); CFBamBlobTypeBuff dataBuff = (CFBamBlobTypeBuff) editBuff.getBlobTypeBuff(); // 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("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("DataScopeId")) { if (attrDataScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessSecurityId")) { if (attrViewAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessSecurityId")) { if (attrEditAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessFrequencyId")) { if (attrViewAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessFrequencyId")) { if (attrEditAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequencyId = 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("SchemaDefId")) { if (attrSchemaDefId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSchemaDefId = 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 ((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 ((attrSchemaDefId == null) || (attrSchemaDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaDefId"); } // 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 natScopeId = Long.parseLong(attrScopeId); dataBuff.setRequiredScopeId(natScopeId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } dataBuff.setOptionalDefSchemaId(natDefSchemaId); String natName = attrName; dataBuff.setRequiredName(natName); String natShortName = attrShortName; dataBuff.setOptionalShortName(natShortName); String natLabel = attrLabel; dataBuff.setOptionalLabel(natLabel); String natShortDescription = attrShortDescription; dataBuff.setOptionalShortDescription(natShortDescription); String natDescription = attrDescription; dataBuff.setOptionalDescription(natDescription); 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 + "\""); } dataBuff.setRequiredIsNullable(natIsNullable); 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 + "\""); } dataBuff.setOptionalGenerateId(natGenerateId); Short natDataScopeId; if ((attrDataScopeId == null) || (attrDataScopeId.length() <= 0)) { natDataScopeId = null; } else { natDataScopeId = new Short(Short.parseShort(attrDataScopeId)); } dataBuff.setOptionalDataScopeId(natDataScopeId); Short natViewAccessSecurityId; if ((attrViewAccessSecurityId == null) || (attrViewAccessSecurityId.length() <= 0)) { natViewAccessSecurityId = null; } else { natViewAccessSecurityId = new Short(Short.parseShort(attrViewAccessSecurityId)); } dataBuff.setOptionalViewAccessSecurityId(natViewAccessSecurityId); Short natEditAccessSecurityId; if ((attrEditAccessSecurityId == null) || (attrEditAccessSecurityId.length() <= 0)) { natEditAccessSecurityId = null; } else { natEditAccessSecurityId = new Short(Short.parseShort(attrEditAccessSecurityId)); } dataBuff.setOptionalEditAccessSecurityId(natEditAccessSecurityId); Short natViewAccessFrequencyId; if ((attrViewAccessFrequencyId == null) || (attrViewAccessFrequencyId.length() <= 0)) { natViewAccessFrequencyId = null; } else { natViewAccessFrequencyId = new Short(Short.parseShort(attrViewAccessFrequencyId)); } dataBuff.setOptionalViewAccessFrequencyId(natViewAccessFrequencyId); Short natEditAccessFrequencyId; if ((attrEditAccessFrequencyId == null) || (attrEditAccessFrequencyId.length() <= 0)) { natEditAccessFrequencyId = null; } else { natEditAccessFrequencyId = new Short(Short.parseShort(attrEditAccessFrequencyId)); } dataBuff.setOptionalEditAccessFrequencyId(natEditAccessFrequencyId); 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); 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); 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); } String natDbName = attrDbName; dataBuff.setOptionalDbName(natDbName); int natMaxLen = Integer.parseInt(attrMaxLen); dataBuff.setRequiredMaxLen(natMaxLen); byte[] natInitValue; if (attrInitValue == null) { natInitValue = null; } else if (attrInitValue.length() <= 0) { natInitValue = new byte[0]; } else { natInitValue = Base64.decodeBase64(attrInitValue.getBytes()); } dataBuff.setOptionalInitValue(natInitValue); byte[] natDefaultValue; if (attrDefaultValue == null) { natDefaultValue = null; } else if (attrDefaultValue.length() <= 0) { natDefaultValue = new byte[0]; } else { natDefaultValue = Base64.decodeBase64(attrDefaultValue.getBytes()); } dataBuff.setOptionalDefaultValue(natDefaultValue); byte[] natNullValue; if (attrNullValue == null) { natNullValue = null; } else if (attrNullValue.length() <= 0) { natNullValue = new byte[0]; } else { natNullValue = Base64.decodeBase64(attrNullValue.getBytes()); } dataBuff.setOptionalNullValue(natNullValue); byte[] natUnknownValue; if (attrUnknownValue == null) { natUnknownValue = null; } else if (attrUnknownValue.length() <= 0) { natUnknownValue = new byte[0]; } else { natUnknownValue = Base64.decodeBase64(attrUnknownValue.getBytes()); } dataBuff.setOptionalUnknownValue(natUnknownValue); long natSchemaDefId = Long.parseLong(attrSchemaDefId); dataBuff.setRequiredSchemaDefId(natSchemaDefId); // Attempt the create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFBamBlobTypeObj created = (ICFBamBlobTypeObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgBlobTypeMessageFormatter.formatBlobTypeRspnCreated( "\n\t\t\t", created.getBlobTypeBuff()) + "\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); } }
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; // Primary Key Attributes for Constant Enum support String attrISOCountryId = null; String attrISOCurrencyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstISOCountryCurrencyDelete"); 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 a PKey buffer for the parsed information CFSecurityISOCountryCurrencyPKey pkey = ((ICFAsteriskSchema) schemaObj.getBackingStore()) .getFactoryISOCountryCurrency() .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("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCurrencyId")) { if (attrISOCurrencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCurrencyId = 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 ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCountryId"); } if ((attrISOCurrencyId == null) || (attrISOCurrencyId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCurrencyId"); } 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. short natISOCountryId; natISOCountryId = Short.parseShort(attrISOCountryId); pkey.setRequiredISOCountryId(natISOCountryId); pkey.setRequiredISOCountryId(natISOCountryId); short natISOCurrencyId; natISOCurrencyId = Short.parseShort(attrISOCurrencyId); pkey.setRequiredISOCurrencyId(natISOCurrencyId); pkey.setRequiredISOCurrencyId(natISOCurrencyId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFAsteriskISOCountryCurrencyObj read = ((ICFAsteriskISOCountryCurrencyObj) schemaObj.getISOCountryCurrencyTableObj().readISOCountryCurrency(pkey)); if (read != null) { if (read.getISOCountryCurrencyBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete ISOCountryCurrency"); } else { ICFAsteriskISOCountryCurrencyEditObj editBuff = (ICFAsteriskISOCountryCurrencyEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgISOCountryCurrencyMessageFormatter .formatISOCountryCurrencyRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFAsteriskXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\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 { 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); } }
private void processRequest(PDU pdu) throws DBException, IOException { // Process the request and add to SMS_RECEIVE_QUEUE if (pdu.getCommandId() == Data.DELIVER_SM) { dsm = (DeliverSM) pdu; this.userId = dsm.getSourceAddr().getAddress(); this.serviceId = dsm.getDestAddr().getAddress(); this.info = dsm.getShortMessage(); ByteBuffer da = null; try { da = dsm.getDestSubaddress(); String te = Convert.hexToString(da.getHexDump().substring(2)); // this.RequestID = te; Gateway.util.log(this.getClass().getName(), "getDestSubaddress:" + te); } catch (ValueNotSetException ex) { } short destport = 0; try { destport = dsm.getDestinationPort(); Gateway.util.log(this.getClass().getName(), "getDestinationPort:" + destport); } catch (ValueNotSetException e) { // TODO Auto-generated catch block // Tim Dport o day // ByteBuffer otaData =new // ByteBuffer(info.getBytes(Data.ENC_ISO8859_1)); ByteBuffer otaData = new ByteBuffer(); otaData = dsm.getShortMessagebuff(); try { byte udhlength = otaData.removeByte(); byte udhele1 = otaData.removeByte(); byte udhele2 = otaData.removeByte(); short sdport = otaData.removeShort(); short ssport = otaData.removeShort(); String newmsg = otaData.removeString(otaData.length(), Data.ENC_ISO8859_1); if (udhlength == 6 && udhele1 == 5) { destport = sdport; this.info = newmsg; Gateway.util.log( this.getClass().getName(), "getDestinationPort:" + destport + "@info=" + newmsg); } } catch (NotEnoughDataInByteBufferException e1) { // TODO Auto-generated catch block } } this.Dport = Short.toString(destport); if (this.info == null) { this.info = "null"; } this.userId = removePlusSign(this.userId); this.serviceId = rebuildServiceId(this.serviceId); this.operator = Preference.mobileOperator; // Added on 22//2003 : VinaPhone gui ban tin DeliverReport voi // truong esm_class != 0x4. ==> He thong xem nhu ban tin thuong // sai format va gui thong bao -- report -- thong bao --> LOOP./ // To pass over this, set: if (dsm.getEsmClass() == 0x4 || info.startsWith("id:")) { // DeliverReport // (not // processed)! Gateway.util.log(this.getClass().getName(), "It can be DeliverReport (not processed)!"); return; // not processed } // Normal message (request): // Neu mobile o che do tieng viet // --> Loai bo space (ky tu 00) giua cac ky tu this.info = StringTool.removeChar(this.info, '\00'); String newserviceid = this.serviceId; newserviceid = newserviceid.substring(newserviceid.length() - 4); // DANND add DateFormat dateFormat = new SimpleDateFormat("MMddHHmmssSSS"); java.util.Date date = new java.util.Date(); String datetime = dateFormat.format(date); this.RequestID = Preference.prefix_requestid + datetime + threadId; dbTools.add2SMSReceiveQueueR( this.userId, this.serviceId, this.operator, this.commandCode, this.info, this.RequestID, this.Dport); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAccXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Contact Attributes String attrTenantId = null; String attrContactId = null; String attrContactListId = null; String attrISOTimezoneId = null; String attrFullName = null; String attrLastName = null; String attrFirstName = null; String attrCustom = null; String attrCustom2 = null; String attrCustom3 = 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("RqstContactUpdate"); CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAccSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("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("ContactId")) { if (attrContactId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContactId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContactListId")) { if (attrContactListId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContactListId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOTimezoneId")) { if (attrISOTimezoneId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOTimezoneId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FullName")) { if (attrFullName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFullName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("LastName")) { if (attrLastName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLastName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FirstName")) { if (attrFirstName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFirstName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Custom")) { if (attrCustom != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCustom = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Custom2")) { if (attrCustom2 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCustom2 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Custom3")) { if (attrCustom3 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCustom3 = 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 ((attrContactId == null) || (attrContactId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContactId"); } if ((attrContactListId == null) || (attrContactListId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContactListId"); } if (attrFullName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FullName"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt"); } if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy"); } if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt"); } if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFCrmContactPKey pkey = ((ICFAccSchema) schemaObj.getBackingStore()).getFactoryContact().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natContactId; natContactId = Long.parseLong(attrContactId); pkey.setRequiredContactId(natContactId); // Read the instance ICFAccContactObj origBuff = ((ICFAccContactObj) schemaObj.getContactTableObj().readContact(pkey)); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "getContactTableObj().readContact()"); } else { // Edit the instance ICFAccContactEditObj editBuff = (ICFAccContactEditObj) origBuff.beginEdit(); CFCrmContactBuff dataBuff = editBuff.getContactBuff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natContactListId = Long.parseLong(attrContactListId); dataBuff.setRequiredContactListId(natContactListId); Short natISOTimezoneId; if ((attrISOTimezoneId == null) || (attrISOTimezoneId.length() <= 0)) { natISOTimezoneId = null; } else { natISOTimezoneId = new Short(Short.parseShort(attrISOTimezoneId)); } dataBuff.setOptionalISOTimezoneId(natISOTimezoneId); String natFullName = attrFullName; dataBuff.setRequiredFullName(natFullName); String natLastName = attrLastName; dataBuff.setOptionalLastName(natLastName); String natFirstName = attrFirstName; dataBuff.setOptionalFirstName(natFirstName); String natCustom = attrCustom; dataBuff.setOptionalCustom(natCustom); String natCustom2 = attrCustom2; dataBuff.setOptionalCustom2(natCustom2); String natCustom3 = attrCustom3; dataBuff.setOptionalCustom3(natCustom3); int natRevision = Integer.parseInt(attrRevision); dataBuff.setRequiredRevision(natRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgContactMessageFormatter.formatContactRspnUpdated( "\n\t\t\t", origBuff.getContactBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFAccXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.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; // 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 attrDataScopeId = null; String attrViewAccessSecurityId = null; String attrEditAccessSecurityId = null; String attrViewAccessFrequencyId = null; String attrEditAccessFrequencyId = 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; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnAtomLocked"); 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("DataScopeId")) { if (attrDataScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessSecurityId")) { if (attrViewAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessSecurityId")) { if (attrEditAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessFrequencyId")) { if (attrViewAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessFrequencyId")) { if (attrEditAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequencyId = 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("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 ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long 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 + "\""); } Short natDataScopeId; if ((attrDataScopeId == null) || (attrDataScopeId.length() <= 0)) { natDataScopeId = null; } else { natDataScopeId = new Short(Short.parseShort(attrDataScopeId)); } Short natViewAccessSecurityId; if ((attrViewAccessSecurityId == null) || (attrViewAccessSecurityId.length() <= 0)) { natViewAccessSecurityId = null; } else { natViewAccessSecurityId = new Short(Short.parseShort(attrViewAccessSecurityId)); } Short natEditAccessSecurityId; if ((attrEditAccessSecurityId == null) || (attrEditAccessSecurityId.length() <= 0)) { natEditAccessSecurityId = null; } else { natEditAccessSecurityId = new Short(Short.parseShort(attrEditAccessSecurityId)); } Short natViewAccessFrequencyId; if ((attrViewAccessFrequencyId == null) || (attrViewAccessFrequencyId.length() <= 0)) { natViewAccessFrequencyId = null; } else { natViewAccessFrequencyId = new Short(Short.parseShort(attrViewAccessFrequencyId)); } Short natEditAccessFrequencyId; if ((attrEditAccessFrequencyId == null) || (attrEditAccessFrequencyId.length() <= 0)) { natEditAccessFrequencyId = null; } else { natEditAccessFrequencyId = new Short(Short.parseShort(attrEditAccessFrequencyId)); } 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; // Instantiate a buffer for the parsed information ICFBamAtomObj obj = (ICFBamAtomObj) schemaObj.getAtomTableObj().newInstance(); CFBamAtomBuff dataBuff = obj.getAtomBuff(); 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.setOptionalDataScopeId(natDataScopeId); dataBuff.setOptionalViewAccessSecurityId(natViewAccessSecurityId); dataBuff.setOptionalEditAccessSecurityId(natEditAccessSecurityId); dataBuff.setOptionalViewAccessFrequencyId(natViewAccessFrequencyId); dataBuff.setOptionalEditAccessFrequencyId(natEditAccessFrequencyId); 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); obj.copyBuffToPKey(); ICFBamAtomObj realized = (ICFBamAtomObj) 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 String getObjName() { String objName; short val = getRequiredISOLanguageId(); objName = Short.toString(val); return (objName); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFSecurityXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // ISOCountryLanguage Attributes String attrISOCountryId = null; String attrISOLanguageId = 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("RqstISOCountryLanguageCreate"); 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()"); } // Instantiate an edit buffer for the parsed information ICFSecurityISOCountryLanguageEditObj editBuff = (ICFSecurityISOCountryLanguageEditObj) schemaObj.getISOCountryLanguageTableObj().newInstance().beginEdit(); CFSecurityISOCountryLanguageBuff dataBuff = (CFSecurityISOCountryLanguageBuff) editBuff.getISOCountryLanguageBuff(); // 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("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOLanguageId")) { if (attrISOLanguageId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOLanguageId = attrs.getValue(idxAttr); } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCountryId"); } if ((attrISOLanguageId == null) || (attrISOLanguageId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOLanguageId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natISOCountryId = Short.parseShort(attrISOCountryId); dataBuff.setRequiredISOCountryId(natISOCountryId); short natISOLanguageId = Short.parseShort(attrISOLanguageId); dataBuff.setRequiredISOLanguageId(natISOLanguageId); 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 ICFSecurityISOCountryLanguageObj created = (ICFSecurityISOCountryLanguageObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgISOCountryLanguageMessageFormatter .formatISOCountryLanguageRspnCreated( "\n\t\t\t", created.getISOCountryLanguageBuff()) + "\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 int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFCrmAddressBuff) { CFCrmAddressBuff rhs = (CFCrmAddressBuff) obj; int retval = super.compareTo(rhs); if (retval != 0) { return (retval); } return (0); } else if (obj instanceof CFCrmAddressByTenantIdxKey) { CFCrmAddressByTenantIdxKey rhs = (CFCrmAddressByTenantIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } return (0); } else if (obj instanceof CFCrmAddressByContactIdxKey) { CFCrmAddressByContactIdxKey rhs = (CFCrmAddressByContactIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredContactId() < rhs.getRequiredContactId()) { return (-1); } else if (getRequiredContactId() > rhs.getRequiredContactId()) { return (1); } return (0); } else if (obj instanceof CFCrmAddressByUDescrIdxKey) { CFCrmAddressByUDescrIdxKey rhs = (CFCrmAddressByUDescrIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredContactId() < rhs.getRequiredContactId()) { return (-1); } else if (getRequiredContactId() > rhs.getRequiredContactId()) { return (1); } { int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFCrmAddressByCountryIdxKey) { CFCrmAddressByCountryIdxKey rhs = (CFCrmAddressByCountryIdxKey) obj; if (getOptionalCountryId() != null) { Short lhsCountryId = getOptionalCountryId(); if (rhs.getOptionalCountryId() != null) { Short rhsCountryId = rhs.getOptionalCountryId(); int cmp = lhsCountryId.compareTo(rhsCountryId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalCountryId() != null) { return (-1); } } return (0); } else if (obj instanceof CFCrmAddressHBuff) { CFCrmAddressHBuff rhs = (CFCrmAddressHBuff) obj; int retval = 0; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredAddressId() < rhs.getRequiredAddressId()) { return (-1); } else if (getRequiredAddressId() > rhs.getRequiredAddressId()) { return (1); } if (getRequiredContactId() < rhs.getRequiredContactId()) { return (-1); } else if (getRequiredContactId() > rhs.getRequiredContactId()) { return (1); } { int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription()); if (cmp != 0) { return (cmp); } } if (getOptionalAddrLine1() != null) { if (rhs.getOptionalAddrLine1() != null) { int cmp = getOptionalAddrLine1().compareTo(rhs.getOptionalAddrLine1()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalAddrLine1() != null) { return (-1); } } if (getOptionalAddrLine2() != null) { if (rhs.getOptionalAddrLine2() != null) { int cmp = getOptionalAddrLine2().compareTo(rhs.getOptionalAddrLine2()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalAddrLine2() != null) { return (-1); } } if (getOptionalCity() != null) { if (rhs.getOptionalCity() != null) { int cmp = getOptionalCity().compareTo(rhs.getOptionalCity()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalCity() != null) { return (-1); } } if (getOptionalState() != null) { if (rhs.getOptionalState() != null) { int cmp = getOptionalState().compareTo(rhs.getOptionalState()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalState() != null) { return (-1); } } if (getOptionalCountryId() != null) { Short lhsCountryId = getOptionalCountryId(); if (rhs.getOptionalCountryId() != null) { Short rhsCountryId = rhs.getOptionalCountryId(); int cmp = lhsCountryId.compareTo(rhsCountryId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalCountryId() != null) { return (-1); } } if (getOptionalZip() != null) { if (rhs.getOptionalZip() != null) { int cmp = getOptionalZip().compareTo(rhs.getOptionalZip()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalZip() != null) { return (-1); } } return (0); } else if (obj instanceof CFCrmAddressHPKey) { CFCrmAddressHPKey rhs = (CFCrmAddressHPKey) obj; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredAddressId() < rhs.getRequiredAddressId()) { return (-1); } else if (getRequiredAddressId() > rhs.getRequiredAddressId()) { return (1); } return (0); } else if (obj instanceof CFCrmAddressPKey) { CFCrmAddressPKey rhs = (CFCrmAddressPKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredAddressId() < rhs.getRequiredAddressId()) { return (-1); } else if (getRequiredAddressId() > rhs.getRequiredAddressId()) { return (1); } return (0); } else if (obj instanceof CFCrmHPKey) { CFCrmHPKey rhs = (CFCrmHPKey) obj; { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } return (0); } else { return (super.compareTo(obj)); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // OptMaxValue Attributes 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; // OptMaxValue References ICFDbTestTenantObj refTenant = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("OptMaxValue"); CFDbTestSaxLoader saxLoader = (CFDbTestSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFDbTestOptMaxValueEditObj editBuff = (ICFDbTestOptMaxValueEditObj) schemaObj.getOptMaxValueTableObj().newInstance().beginEdit(); // 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("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 (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("Description", attrDescription); curContext.putNamedValue("TestInt16", attrTestInt16); curContext.putNamedValue("TestInt32", attrTestInt32); curContext.putNamedValue("TestInt64", attrTestInt64); curContext.putNamedValue("TestUInt16", attrTestUInt16); curContext.putNamedValue("TestUInt32", attrTestUInt32); curContext.putNamedValue("TestUInt64", attrTestUInt64); curContext.putNamedValue("TestFloat", attrTestFloat); curContext.putNamedValue("TestDouble", attrTestDouble); curContext.putNamedValue("TestNumber", attrTestNumber); curContext.putNamedValue("TestDate", attrTestDate); curContext.putNamedValue("TestTimestamp", attrTestTimestamp); curContext.putNamedValue("TestTZDate", attrTestTZDate); curContext.putNamedValue("TestTZTimestamp", attrTestTZTimestamp); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } String natDescription = attrDescription; editBuff.setRequiredDescription(natDescription); Short natTestInt16; if ((attrTestInt16 == null) || (attrTestInt16.length() <= 0)) { natTestInt16 = null; } else { natTestInt16 = new Short(Short.parseShort(attrTestInt16)); } editBuff.setOptionalTestInt16(natTestInt16); Integer natTestInt32; if ((attrTestInt32 == null) || (attrTestInt32.length() <= 0)) { natTestInt32 = null; } else { natTestInt32 = new Integer(Integer.parseInt(attrTestInt32)); } editBuff.setOptionalTestInt32(natTestInt32); Long natTestInt64; if ((attrTestInt64 == null) || (attrTestInt64.length() <= 0)) { natTestInt64 = null; } else { natTestInt64 = new Long(Long.parseLong(attrTestInt64)); } editBuff.setOptionalTestInt64(natTestInt64); Integer natTestUInt16; if ((attrTestUInt16 == null) || (attrTestUInt16.length() <= 0)) { natTestUInt16 = null; } else { natTestUInt16 = new Integer(Integer.parseInt(attrTestUInt16)); } editBuff.setOptionalTestUInt16(natTestUInt16); Long natTestUInt32; if ((attrTestUInt32 == null) || (attrTestUInt32.length() <= 0)) { natTestUInt32 = null; } else { natTestUInt32 = new Long(Long.parseLong(attrTestUInt32)); } editBuff.setOptionalTestUInt32(natTestUInt32); BigDecimal natTestUInt64; if ((attrTestUInt64 == null) || (attrTestUInt64.length() <= 0)) { natTestUInt64 = null; } else { natTestUInt64 = CFLibBigDecimalUtil.parse("CFDbTest.OptMaxValue.TestUInt64", 19, 0, attrTestUInt64); } editBuff.setOptionalTestUInt64(natTestUInt64); Float natTestFloat; if ((attrTestFloat == null) || (attrTestFloat.length() <= 0)) { natTestFloat = null; } else { natTestFloat = new Float(Float.parseFloat(attrTestFloat)); } editBuff.setOptionalTestFloat(natTestFloat); Double natTestDouble; if ((attrTestDouble == null) || (attrTestDouble.length() <= 0)) { natTestDouble = null; } else { natTestDouble = new Double(Double.parseDouble(attrTestDouble)); } editBuff.setOptionalTestDouble(natTestDouble); BigDecimal natTestNumber; if ((attrTestNumber == null) || (attrTestNumber.length() <= 0)) { natTestNumber = null; } else { natTestNumber = CFLibBigDecimalUtil.parse("CFDbTest.OptMaxValue.TestNumber", 20, 0, attrTestNumber); } editBuff.setOptionalTestNumber(natTestNumber); Calendar natTestDate; if ((attrTestDate == null) || (attrTestDate.length() <= 0)) { natTestDate = null; } else { try { natTestDate = CFLibXmlUtil.parseDate(attrTestDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException(getClass(), S_ProcName, 0, "TestDate", attrTestDate, e); } } editBuff.setOptionalTestDate(natTestDate); Calendar natTestTimestamp; if ((attrTestTimestamp == null) || (attrTestTimestamp.length() <= 0)) { natTestTimestamp = null; } else { try { natTestTimestamp = CFLibXmlUtil.parseTimestamp(attrTestTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTimestamp", attrTestTimestamp, e); } } editBuff.setOptionalTestTimestamp(natTestTimestamp); Calendar natTestTZDate; if ((attrTestTZDate == null) || (attrTestTZDate.length() <= 0)) { natTestTZDate = null; } else { try { natTestTZDate = CFLibXmlUtil.parseTZDate(attrTestTZDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZDate", attrTestTZDate, e); } } editBuff.setOptionalTestTZDate(natTestTZDate); Calendar natTestTZTimestamp; if ((attrTestTZTimestamp == null) || (attrTestTZTimestamp.length() <= 0)) { natTestTZTimestamp = null; } else { try { natTestTZTimestamp = CFLibXmlUtil.parseTZTimestamp(attrTestTZTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZTimestamp", attrTestTZTimestamp, e); } } editBuff.setOptionalTestTZTimestamp(natTestTZTimestamp); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } // Resolve and apply required Container reference if (scopeObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj"); } else if (scopeObj instanceof ICFDbTestTenantObj) { refTenant = (ICFDbTestTenantObj) scopeObj; editBuff.setRequiredContainerTenant(refTenant); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFDbTestTenantObj"); } CFDbTestSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getOptMaxValueLoaderBehaviour(); ICFDbTestOptMaxValueEditObj editOptMaxValue = null; ICFDbTestOptMaxValueObj origOptMaxValue = (ICFDbTestOptMaxValueObj) schemaObj .getOptMaxValueTableObj() .readOptMaxValueByUDescrIdx( refTenant.getRequiredId(), editBuff.getRequiredDescription()); if (origOptMaxValue == null) { editOptMaxValue = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editOptMaxValue = (ICFDbTestOptMaxValueEditObj) origOptMaxValue.beginEdit(); editOptMaxValue.setRequiredDescription(editBuff.getRequiredDescription()); editOptMaxValue.setOptionalTestInt16(editBuff.getOptionalTestInt16()); editOptMaxValue.setOptionalTestInt32(editBuff.getOptionalTestInt32()); editOptMaxValue.setOptionalTestInt64(editBuff.getOptionalTestInt64()); editOptMaxValue.setOptionalTestUInt16(editBuff.getOptionalTestUInt16()); editOptMaxValue.setOptionalTestUInt32(editBuff.getOptionalTestUInt32()); editOptMaxValue.setOptionalTestUInt64(editBuff.getOptionalTestUInt64()); editOptMaxValue.setOptionalTestFloat(editBuff.getOptionalTestFloat()); editOptMaxValue.setOptionalTestDouble(editBuff.getOptionalTestDouble()); editOptMaxValue.setOptionalTestNumber(editBuff.getOptionalTestNumber()); editOptMaxValue.setOptionalTestDate(editBuff.getOptionalTestDate()); editOptMaxValue.setOptionalTestTimestamp(editBuff.getOptionalTestTimestamp()); editOptMaxValue.setOptionalTestTZDate(editBuff.getOptionalTestTZDate()); editOptMaxValue.setOptionalTestTZTimestamp(editBuff.getOptionalTestTZTimestamp()); break; case Replace: editOptMaxValue = (ICFDbTestOptMaxValueEditObj) origOptMaxValue.beginEdit(); editOptMaxValue.delete(); editOptMaxValue.endEdit(); origOptMaxValue = null; editOptMaxValue = editBuff; break; } } if (editOptMaxValue != null) { if (origOptMaxValue != null) { editOptMaxValue.update(); } else { origOptMaxValue = (ICFDbTestOptMaxValueObj) editOptMaxValue.create(); } editOptMaxValue.endEdit(); } curContext.putNamedValue("Object", origOptMaxValue); } 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 int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFBamBoolTypeBuff) { CFBamBoolTypeBuff rhs = (CFBamBoolTypeBuff) obj; int retval = super.compareTo(rhs); if (retval != 0) { return (retval); } return (0); } else if (obj instanceof CFBamBoolTypeBySchemaIdxKey) { CFBamBoolTypeBySchemaIdxKey rhs = (CFBamBoolTypeBySchemaIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredSchemaDefId() < rhs.getRequiredSchemaDefId()) { return (-1); } else if (getRequiredSchemaDefId() > rhs.getRequiredSchemaDefId()) { return (1); } return (0); } else if (obj instanceof CFBamBoolTypeHBuff) { CFBamBoolTypeHBuff rhs = (CFBamBoolTypeHBuff) obj; int retval = super.compareTo(rhs); if (retval != 0) { return (retval); } { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredScopeId() < rhs.getRequiredScopeId()) { return (-1); } else if (getRequiredScopeId() > rhs.getRequiredScopeId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } if (getOptionalDefSchemaTenantId() != null) { Long lhsDefSchemaTenantId = getOptionalDefSchemaTenantId(); if (rhs.getOptionalDefSchemaTenantId() != null) { Long rhsDefSchemaTenantId = rhs.getOptionalDefSchemaTenantId(); int cmp = lhsDefSchemaTenantId.compareTo(rhsDefSchemaTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaTenantId() != null) { return (-1); } } if (getOptionalDefSchemaId() != null) { Long lhsDefSchemaId = getOptionalDefSchemaId(); if (rhs.getOptionalDefSchemaId() != null) { Long rhsDefSchemaId = rhs.getOptionalDefSchemaId(); int cmp = lhsDefSchemaId.compareTo(rhsDefSchemaId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaId() != null) { return (-1); } } { int cmp = getRequiredName().compareTo(rhs.getRequiredName()); if (cmp != 0) { return (cmp); } } if (getOptionalShortName() != null) { if (rhs.getOptionalShortName() != null) { int cmp = getOptionalShortName().compareTo(rhs.getOptionalShortName()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalShortName() != null) { return (-1); } } if (getOptionalLabel() != null) { if (rhs.getOptionalLabel() != null) { int cmp = getOptionalLabel().compareTo(rhs.getOptionalLabel()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalLabel() != null) { return (-1); } } if (getOptionalShortDescription() != null) { if (rhs.getOptionalShortDescription() != null) { int cmp = getOptionalShortDescription().compareTo(rhs.getOptionalShortDescription()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalShortDescription() != null) { return (-1); } } if (getOptionalDescription() != null) { if (rhs.getOptionalDescription() != null) { int cmp = getOptionalDescription().compareTo(rhs.getOptionalDescription()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDescription() != null) { return (-1); } } if (getRequiredIsNullable()) { if (!rhs.getRequiredIsNullable()) { return (1); } } else { if (rhs.getRequiredIsNullable()) { return (-1); } } if (getOptionalGenerateId() != null) { Boolean lhsGenerateId = getOptionalGenerateId(); if (rhs.getOptionalGenerateId()) { Boolean rhsGenerateId = rhs.getOptionalGenerateId(); if (lhsGenerateId) { if (!rhsGenerateId) { return (1); } } else { if (rhsGenerateId) { return (-1); } } } else { return (1); } } else { if (rhs.getOptionalGenerateId() != null) { return (-1); } } if (getOptionalDataScopeId() != null) { Short lhsDataScopeId = getOptionalDataScopeId(); if (rhs.getOptionalDataScopeId() != null) { Short rhsDataScopeId = rhs.getOptionalDataScopeId(); int cmp = lhsDataScopeId.compareTo(rhsDataScopeId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDataScopeId() != null) { return (-1); } } if (getOptionalViewAccessSecurityId() != null) { Short lhsViewAccessSecurityId = getOptionalViewAccessSecurityId(); if (rhs.getOptionalViewAccessSecurityId() != null) { Short rhsViewAccessSecurityId = rhs.getOptionalViewAccessSecurityId(); int cmp = lhsViewAccessSecurityId.compareTo(rhsViewAccessSecurityId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalViewAccessSecurityId() != null) { return (-1); } } if (getOptionalEditAccessSecurityId() != null) { Short lhsEditAccessSecurityId = getOptionalEditAccessSecurityId(); if (rhs.getOptionalEditAccessSecurityId() != null) { Short rhsEditAccessSecurityId = rhs.getOptionalEditAccessSecurityId(); int cmp = lhsEditAccessSecurityId.compareTo(rhsEditAccessSecurityId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEditAccessSecurityId() != null) { return (-1); } } if (getOptionalViewAccessFrequencyId() != null) { Short lhsViewAccessFrequencyId = getOptionalViewAccessFrequencyId(); if (rhs.getOptionalViewAccessFrequencyId() != null) { Short rhsViewAccessFrequencyId = rhs.getOptionalViewAccessFrequencyId(); int cmp = lhsViewAccessFrequencyId.compareTo(rhsViewAccessFrequencyId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalViewAccessFrequencyId() != null) { return (-1); } } if (getOptionalEditAccessFrequencyId() != null) { Short lhsEditAccessFrequencyId = getOptionalEditAccessFrequencyId(); if (rhs.getOptionalEditAccessFrequencyId() != null) { Short rhsEditAccessFrequencyId = rhs.getOptionalEditAccessFrequencyId(); int cmp = lhsEditAccessFrequencyId.compareTo(rhsEditAccessFrequencyId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEditAccessFrequencyId() != null) { return (-1); } } if (getOptionalPrevTenantId() != null) { Long lhsPrevTenantId = getOptionalPrevTenantId(); if (rhs.getOptionalPrevTenantId() != null) { Long rhsPrevTenantId = rhs.getOptionalPrevTenantId(); int cmp = lhsPrevTenantId.compareTo(rhsPrevTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevTenantId() != null) { return (-1); } } if (getOptionalPrevId() != null) { Long lhsPrevId = getOptionalPrevId(); if (rhs.getOptionalPrevId() != null) { Long rhsPrevId = rhs.getOptionalPrevId(); int cmp = lhsPrevId.compareTo(rhsPrevId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevId() != null) { return (-1); } } if (getOptionalNextTenantId() != null) { Long lhsNextTenantId = getOptionalNextTenantId(); if (rhs.getOptionalNextTenantId() != null) { Long rhsNextTenantId = rhs.getOptionalNextTenantId(); int cmp = lhsNextTenantId.compareTo(rhsNextTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextTenantId() != null) { return (-1); } } if (getOptionalNextId() != null) { Long lhsNextId = getOptionalNextId(); if (rhs.getOptionalNextId() != null) { Long rhsNextId = rhs.getOptionalNextId(); int cmp = lhsNextId.compareTo(rhsNextId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextId() != null) { return (-1); } } if (getRequiredDefaultVisibility()) { if (!rhs.getRequiredDefaultVisibility()) { return (1); } } else { if (rhs.getRequiredDefaultVisibility()) { return (-1); } } if (getOptionalDbName() != null) { if (rhs.getOptionalDbName() != null) { int cmp = getOptionalDbName().compareTo(rhs.getOptionalDbName()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDbName() != null) { return (-1); } } if (getOptionalInitValue() != null) { Boolean lhsInitValue = getOptionalInitValue(); if (rhs.getOptionalInitValue()) { Boolean rhsInitValue = rhs.getOptionalInitValue(); if (lhsInitValue) { if (!rhsInitValue) { return (1); } } else { if (rhsInitValue) { return (-1); } } } else { return (1); } } else { if (rhs.getOptionalInitValue() != null) { return (-1); } } if (getOptionalDefaultValue() != null) { Boolean lhsDefaultValue = getOptionalDefaultValue(); if (rhs.getOptionalDefaultValue()) { Boolean rhsDefaultValue = rhs.getOptionalDefaultValue(); if (lhsDefaultValue) { if (!rhsDefaultValue) { return (1); } } else { if (rhsDefaultValue) { return (-1); } } } else { return (1); } } else { if (rhs.getOptionalDefaultValue() != null) { return (-1); } } if (getOptionalFalseString() != null) { if (rhs.getOptionalFalseString() != null) { int cmp = getOptionalFalseString().compareTo(rhs.getOptionalFalseString()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalFalseString() != null) { return (-1); } } if (getOptionalTrueString() != null) { if (rhs.getOptionalTrueString() != null) { int cmp = getOptionalTrueString().compareTo(rhs.getOptionalTrueString()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalTrueString() != null) { return (-1); } } if (getOptionalNullString() != null) { if (rhs.getOptionalNullString() != null) { int cmp = getOptionalNullString().compareTo(rhs.getOptionalNullString()); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNullString() != null) { return (-1); } } if (getRequiredSchemaDefId() < rhs.getRequiredSchemaDefId()) { return (-1); } else if (getRequiredSchemaDefId() > rhs.getRequiredSchemaDefId()) { return (1); } return (0); } else { return (super.compareTo(obj)); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // AuditAction Attributes String attrAuditActionId = null; String attrDescription = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnAuditActionLocked"); 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("AuditActionId")) { if (attrAuditActionId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAuditActionId = 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 ((attrAuditActionId == null) || (attrAuditActionId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AuditActionId"); } 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 short natAuditActionId = Short.parseShort(attrAuditActionId); String natDescription = attrDescription; int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFAccAuditActionObj obj = (ICFAccAuditActionObj) schemaObj.getAuditActionTableObj().newInstance(); CFSecurityAuditActionBuff dataBuff = obj.getAuditActionBuff(); dataBuff.setRequiredAuditActionId(natAuditActionId); dataBuff.setRequiredDescription(natDescription); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFAccAuditActionObj realized = (ICFAccAuditActionObj) 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; // ISOTimezone Attributes String attrISOTimezoneId = null; String attrIso8601 = null; String attrTZName = null; String attrTZHourOffset = null; String attrTZMinOffset = null; String attrDescription = null; String attrVisible = 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("RspnISOTimezoneLocked"); CFAsteriskXMsgRspnHandler xmsgRspnHandler = (CFAsteriskXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAsteriskSchemaObj 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("ISOTimezoneId")) { if (attrISOTimezoneId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOTimezoneId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Iso8601")) { if (attrIso8601 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIso8601 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TZName")) { if (attrTZName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTZName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TZHourOffset")) { if (attrTZHourOffset != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTZHourOffset = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TZMinOffset")) { if (attrTZMinOffset != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTZMinOffset = 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("Visible")) { if (attrVisible != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrVisible = 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 ((attrISOTimezoneId == null) || (attrISOTimezoneId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOTimezoneId"); } if (attrIso8601 == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Iso8601"); } if (attrTZName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TZName"); } if ((attrTZHourOffset == null) || (attrTZHourOffset.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TZHourOffset"); } if ((attrTZMinOffset == null) || (attrTZMinOffset.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TZMinOffset"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } if ((attrVisible == null) || (attrVisible.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Visible"); } 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 short natISOTimezoneId = Short.parseShort(attrISOTimezoneId); String natIso8601 = attrIso8601; String natTZName = attrTZName; short natTZHourOffset = Short.parseShort(attrTZHourOffset); short natTZMinOffset = Short.parseShort(attrTZMinOffset); String natDescription = attrDescription; boolean natVisible; if (attrVisible.equals("true") || attrVisible.equals("yes") || attrVisible.equals("1")) { natVisible = true; } else if (attrVisible.equals("false") || attrVisible.equals("no") || attrVisible.equals("0")) { natVisible = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected Visible value, must be one of true, false, yes, no, 1, or 0, not \"" + attrVisible + "\""); } 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 ICFAsteriskISOTimezoneObj obj = (ICFAsteriskISOTimezoneObj) schemaObj.getISOTimezoneTableObj().newInstance(); CFSecurityISOTimezoneBuff dataBuff = obj.getISOTimezoneBuff(); dataBuff.setRequiredISOTimezoneId(natISOTimezoneId); dataBuff.setRequiredIso8601(natIso8601); dataBuff.setRequiredTZName(natTZName); dataBuff.setRequiredTZHourOffset(natTZHourOffset); dataBuff.setRequiredTZMinOffset(natTZMinOffset); dataBuff.setRequiredDescription(natDescription); dataBuff.setRequiredVisible(natVisible); 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(); ICFAsteriskISOTimezoneObj realized = (ICFAsteriskISOTimezoneObj) 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; // ISOCountryCurrency Attributes String attrISOCountryId = null; String attrISOCurrencyId = 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("RspnISOCountryCurrencyCreated"); CFAsteriskXMsgRspnHandler xmsgRspnHandler = (CFAsteriskXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAsteriskSchemaObj 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("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCurrencyId")) { if (attrISOCurrencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCurrencyId = 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 ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCountryId"); } if ((attrISOCurrencyId == null) || (attrISOCurrencyId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCurrencyId"); } 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 short natISOCountryId = Short.parseShort(attrISOCountryId); short natISOCurrencyId = Short.parseShort(attrISOCurrencyId); 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 ICFAsteriskISOCountryCurrencyObj obj = (ICFAsteriskISOCountryCurrencyObj) schemaObj.getISOCountryCurrencyTableObj().newInstance(); CFSecurityISOCountryCurrencyBuff dataBuff = obj.getISOCountryCurrencyBuff(); dataBuff.setRequiredISOCountryId(natISOCountryId); dataBuff.setRequiredISOCurrencyId(natISOCurrencyId); 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(); ICFAsteriskISOCountryCurrencyObj realized = (ICFAsteriskISOCountryCurrencyObj) 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 { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstAccessFrequencyLock"); 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()"); } // Instantiate a PKey buffer for the parsed information CFBamAccessFrequencyPKey pkey = schemaObj.getBackingStore().getFactoryAccessFrequency().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("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"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natId; natId = Short.parseShort(attrId); pkey.setRequiredId(natId); pkey.setRequiredId(natId); // Lock the object ICFBamAccessFrequencyObj locked = schemaObj.getAccessFrequencyTableObj().lockAccessFrequency(pkey); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgAccessFrequencyMessageFormatter.formatAccessFrequencyRspnLocked( "\n\t\t\t", locked.getAccessFrequencyBuff()) + "\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); } }
/** * This is the main controller logic for item selection servlet. This determines whether to show a * list of items for a WorkOrder, add a item, edit a item's detail information, or delete a item. * The product_action parameter is past to this servlet to determine what action to perform. The * product_action parameter is a button defined by JSPs related to product presentation screens. * * <p>The default action is to show all product related to a parent WorkOrder. * * @param req HttpServlet request * @param resp HttpServlet response */ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WorkOrderDetailRemote workorderdetEJBean = null; securityChecks(req, resp); // Get the current session HttpSession session = req.getSession(false); if (session == null) return; String sTmp = ""; // Get a new business logic EJB (custInfoEJBean) USFEnv.getLog().writeDebug("getting buslogic EJB", this, null); try { workorderdetEJBean = workorderdetHome.create(); USFEnv.getLog().writeDebug("EJBean Created", this, null); } catch (CreateException e) { String errorMsg = "Critical Exception in ItemsServlet"; USFEnv.getLog().writeCrit(errorMsg + " failed EJB creation", this, e); errorJSP(req, resp, errorMsg); return; } catch (RemoteException e) { String errorMsg = "Critical Exception in ItemsServlet"; USFEnv.getLog().writeCrit(errorMsg + " failed EJB connect", this, e); errorJSP(req, resp, errorMsg); return; } catch (Exception e) { String errorMsg = "Critical Exception no EJB created"; USFEnv.getLog().writeCrit(errorMsg + " failed EJB creation", this, e); errorJSP(req, resp, errorMsg); return; } try { // Button user pressed in the itemselection.jsp String sJSPAction = req.getParameter("product_action"); USFEnv.getLog().writeWarn("product_action from JSP: " + sJSPAction, this, null); short year = Short.valueOf((String) session.getValue("Iyear")).shortValue(); long customerId = Long.valueOf((String) session.getValue("rcustId")).longValue(); long applicationId = Long.valueOf((String) session.getValue("rappid")).longValue(); long workorderId = 0; long bkId = 0; long billkeyId = 0; long bsId = 0; long wodId = 0; String editflag = ""; String bsNm = ""; java.sql.Date strtDate = null; java.sql.Date endDate = null; String prodError = ""; // Check to make sure session does have an WorkOrder ID if (session.getValue("WorkOrderId") != null) { // If Yes get the parent WorkOrder ID from session workorderId = Long.valueOf((String) session.getValue("WorkOrderId")).longValue(); } // Button Action from JSP is empty then show the Default page of the // Product Listing. if (USFUtil.isBlank(sJSPAction)) { USFEnv.getLog().writeDebug("Display product list for FRN.", this, null); // list items for parent Work Order Number Vector billingsystems = null; WrkOrdrDets workorderdets = new WrkOrdrDets(); billingsystems = workorderdets.getBillingSystems(); req.setAttribute("BillingSystems", billingsystems); for (int s = 0; s < billingsystems.size(); s++) USFEnv.getLog() .writeDebug("INSIDE BILLING SYSTEMS " + billingsystems.elementAt(s), this, null); listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } // Button action from JSP is to Add a new Item else if (sJSPAction.equals("add")) { // Remove the Product Object from session session.removeValue("prodObj"); editflag = "addnew"; req.setAttribute("editflag", editflag); // Read the Item and the Billing System for adding the New // Item. String formProdBsId = (String) req.getParameter("formProdId"); String formProdId = formProdBsId.substring(0, formProdBsId.indexOf("|")); String formProdName = formProdBsId.substring(formProdBsId.indexOf("|") + 1); long rscId = (new Long(formProdId).longValue()); // bsId = (new Long( formBsId ).longValue()) ; String billSystem = formProdName.substring(0, formProdName.indexOf("-")); String itemName = formProdName.substring(formProdName.indexOf("-") + 1); BlgSys blgSys = new BlgSys(); bsId = blgSys.getBsId(billSystem); // Create db connection for EJB workorderdetEJBean.connect(); // Get the WorkOrder Object. WorkOrder woObj = workorderdetEJBean.getWorkOrderInfo(workorderId); // Get the list of Billing Keys for the Billing System. String[] blgKeys = workorderdetEJBean.getBillingKeys(customerId, bsId); // Release db connection for EJB workorderdetEJBean.release(); // If no Billing Keys for the Billing System selected then redirect // to the List Items screen and show the error Message. if (blgKeys == null) { BlgSys blgsys = new BlgSys(); Hashtable bSysList = (Hashtable) blgsys.searchBlgSys(); // Hashtable bSysList = (Hashtable) USFEnv.getBillSystems(); // Set the JSP error message req.setAttribute("errorMsg", "No BTNs for Billing System " + billSystem); // list products for parent WorkOrder Number listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } req.setAttribute("prodcredit", "N"); req.setAttribute("bsystem", String.valueOf(bsId)); req.setAttribute("bkList", blgKeys); req.setAttribute("prodId", formProdId); String wid = String.valueOf(workorderId); session.putValue("workorderId", wid); req.setAttribute("billingsystem", billSystem); req.setAttribute("itemname", itemName); // Include the JSP to Edit Product includeJSP(req, resp, ITEM_JSP_PATH, "editItem"); return; } // Button action from JSP is to Edit a Product else if (sJSPAction.equals("edit")) { String bsysid = req.getParameter("bsId"); session.putValue("bysysidforedit", bsysid); wodId = (new Long((String) req.getParameter("wodId"))).longValue(); // bkId = (new Long( (String) req.getParameter("bkId"))).longValue() ; session.putValue("workorderdetid", String.valueOf(wodId)); bsId = (new Long((String) req.getParameter("bsId"))).longValue(); BlgSys blgSys = new BlgSys(); bsNm = blgSys.getBsName(bsId); // Create db connection for EJB workorderdetEJBean.connect(); // WorkOrder woObj = workorderdetEJBean.getWorkOrderInfo(workorderId); // Get the WorkOrder Number Object WrkOrdrDets wodets_obj = new WrkOrdrDets(); wodets_obj = workorderdetEJBean.getProductInfo(wodId); // Get the List of Billing Keys for the Billing System. String[] blgKeys = workorderdetEJBean.getBillingKeys(customerId, bsId); // Check if the Item has any Credits. If any credits then Billing // Key is not Editable else Editable. if (workorderdetEJBean.hasCredits(wodId)) { req.setAttribute("prodcredit", "Y"); } else { req.setAttribute("prodcredit", "N"); } // Release db connection for EJB workorderdetEJBean.release(); // If Item Object is not null (which generally is the case) then // set the Attributes for the JSP. if (wodets_obj != null) { // Put the Item Object in session editflag = "edit"; session.putValue("wodets", wodets_obj); req.setAttribute("editflag", editflag); // Set the attributes for the Billing System, Billing Key List, req.setAttribute("bkList", blgKeys); req.setAttribute("bsname", bsNm); // Include the JSP to Edit the Item. includeJSP(req, resp, ITEM_JSP_PATH, "editItem"); return; } // If Item Object is null (which generally should not Occur) show // the Default page of Item List for the WorkOrder Number else { // Set the JSP error message req.setAttribute( "errorMsg", "Product Key - " + wodId + " Information not available in the Data Base"); // list items for parent WorkOrder Number listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } } // Button action from JSP is to Delete an Item else if (sJSPAction.equals("delete")) { String formWodId = req.getParameter("wodId"); wodId = (new Long((String) req.getParameter("wodId"))).longValue(); // Create db connection for EJB workorderdetEJBean.connect(); // Delete the Item if (workorderdetEJBean.deleteProduct(wodId)) { req.setAttribute("errorMsg", "Product Key - " + wodId + " Deleted"); } else { req.setAttribute( "errorMsg", "Deletion Failed. Product Key - " + wodId + " is associated with amounts."); } // Release db connection for EJB workorderdetEJBean.release(); // Show the Item List screen listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } // Button action from JSP is to Save a Product. This includes Insertion // of New Product or Updation of an Existing Product. else if (sJSPAction.equals("save")) { boolean save = false; boolean newProd = false; // long qty=0; // Read the Billing System Id String formBsId = (String) req.getParameter("bs_id"); String bsysid = (String) req.getParameter("bsysid"); /* String trans_type = (String) req.getParameter("trans_type"); //String quantity = (String) req.getParameter("qty"); String quantity=""; if (!(req.getParameter("qty").equals(""))) { quantity=(String) req.getParameter("qty"); qty = (new Long(quantity).longValue()); } */ String prod_stat = (String) req.getParameter("prod_stat"); double nrcg_dscnt = (new Double((String) req.getParameter("NonRecurringDiscount"))).doubleValue(); double rcg_dscnt = (new Double((String) req.getParameter("RecurringDiscount"))).doubleValue(); String start_month = (String) req.getParameter("strt_month"); String start_day = (String) req.getParameter("strt_day"); String start_year = (String) req.getParameter("strt_year"); String end_month = (String) req.getParameter("end_month"); String end_day = (String) req.getParameter("end_day"); String end_year = (String) req.getParameter("end_year"); String start_date = start_month + "-" + start_day + "-" + start_year; String end_date = end_month + "-" + end_day + "-" + end_year; long wrkordrid = (new Long((String) session.getValue("WorkOrderId"))).longValue(); String for_editing = req.getParameter("for_editing"); String for_new = req.getParameter("for_new"); String formBkId = (String) req.getParameter("bk_id"); String formBKId = formBkId.substring(0, formBkId.indexOf("|")); String formBTN = formBkId.substring(formBkId.indexOf("|") + 1); billkeyId = (new Long(formBKId)).longValue(); try { bsId = (new Long((String) req.getParameter("bs_id"))).longValue(); } catch (Exception e) { USFEnv.getLog().writeDebug("Exception is " + e, this, null); } RHCCBlgKeys blgkeys = new RHCCBlgKeys(); if (for_editing.equals("editing")) { blgkeys.setRbkId(billkeyId); blgkeys.setRbkKeys(formBTN); blgkeys.setBsId(new Long(bsysid).longValue()); } if (for_new.equals("new")) { blgkeys.setRbkId(billkeyId); blgkeys.setRbkKeys(formBTN); blgkeys.setBsId(bsId); } int index = 0; WrkOrdrDets wod_obj = new WrkOrdrDets(); // wod_obj.setTxTyp(trans_type); // wod_obj.setQty(qty); wod_obj.setNonRcrgDscnt(nrcg_dscnt); wod_obj.setRcrgDscnt(rcg_dscnt); wod_obj.setRBKID(billkeyId); wod_obj.setWodStat(prod_stat); wod_obj.setWOID(wrkordrid); if (!(start_date.equals(""))) { strtDate = new java.sql.Date((new SimpleDateFormat("MM-dd-yyyy")).parse(start_date).getTime()); wod_obj.setStrtDat(strtDate); } // Else if the Start Date is null update the Item Object Date to // null else { wod_obj.setStrtDat(null); } // If Item Service End Date is not null read the date and update // the Item Object with the date if (!(end_date.equals(""))) { endDate = new java.sql.Date((new SimpleDateFormat("MM-dd-yyyy")).parse(end_date).getTime()); wod_obj.setEndDat(endDate); } // Else if the End Date is null update the Item Object Date to null else { wod_obj.setEndDat(null); } // Check if the Start Date is after the End Date or equals End Date if ((strtDate != null) && (endDate != null) && (strtDate.after(endDate))) { prodError = "Product Service Start Date is after Product Service End Date. \n"; index = 1; } else if ((strtDate != null) && (endDate != null) && (strtDate.equals(endDate))) { prodError = "Product Service Start Date equals Product Service End Date. \n"; } workorderdetEJBean.connect(); if (for_editing.equals("editing")) { long workorderdetID = (new Long((String) session.getValue("workorderdetid"))).longValue(); wod_obj.setWODID(workorderdetID); if (index == 0) { save = workorderdetEJBean.saveProduct(wod_obj); } if (save) { prodError = prodError + "<BR> Product Key - " + wod_obj.getWODID() + " Information updated"; req.setAttribute("error", prodError); } else { prodError = prodError + "<BR> Failed to update Product Information"; req.setAttribute("error", prodError); } } if (for_new.equals("new")) { if (index == 0) { int prodId = Integer.parseInt(req.getParameter("prod_Id")); wod_obj.setProd_id(prodId); save = workorderdetEJBean.saveProduct(wod_obj); } if (save) { prodError = prodError + "<BR> Product Key - " + wod_obj.getWODID() + " Information Saved"; req.setAttribute("error", prodError); } else { prodError = prodError + "<BR> Failed to Save Product Information"; req.setAttribute("error", prodError); } } workorderdetEJBean.release(); listProducts(wrkordrid, workorderdetEJBean, session, req, resp); } } // End of try block catch (Exception e) { if (workorderdetEJBean != null) { // calling bean release method try { workorderdetEJBean.release(); } catch (Exception ex) { USFEnv.getLog().writeCrit(" Exception in calling release() method ", this, e); } } String errorMsg = "Processing Exception in Items Servlet: "; USFEnv.getLog().writeCrit(errorMsg, this, e); errorJSP(req, resp, errorMsg); } // End of catch block } // end of doPost()
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrViewAccessFrequencyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstValueDeleteByVAccFreqIdx"); 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("ViewAccessFrequencyId")) { if (attrViewAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequencyId = 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 Short natViewAccessFrequencyId; natViewAccessFrequencyId = new Short(Short.parseShort(attrViewAccessFrequencyId)); // Delete the objects schemaObj.getAtomTableObj().deleteAtomByVAccFreqIdx(natViewAccessFrequencyId); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnDeleted() + "\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); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrDataScopeId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstInt32TypeReadByDataScopeIdx"); 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("DataScopeId")) { if (attrDataScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScopeId = 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 // and apply the converted attributes to the editBuff. Short natDataScopeId; natDataScopeId = new Short(Short.parseShort(attrDataScopeId)); // Read the objects List<ICFBamInt32TypeObj> list = schemaObj.getInt32TypeTableObj().readInt32TypeByDataScopeIdx(natDataScopeId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFBamInt32TypeObj> iter = list.iterator(); ICFBamInt32TypeObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFBamXMsgValueMessageFormatter.formatValueRspnDerivedRec("\n\t\t", cur.getValueBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } 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); } }