Example usage for java.lang Short Short

List of usage examples for java.lang Short Short

Introduction

In this page you can find the example usage for java.lang Short Short.

Prototype

@Deprecated(since = "9")
public Short(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Short object that represents the short value indicated by the String parameter.

Usage

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenFileUpdateHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*  w  w w .  j  av a2s.c  om*/
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // GenItem Attributes
        String attrTenantId = null;
        String attrCartridgeId = null;
        String attrItemId = null;
        String attrRuleTypeId = null;
        String attrName = null;
        String attrToolSetId = null;
        String attrScopeDefId = null;
        String attrGenDefId = null;
        String attrGelExecutableId = null;
        // GenRule Attributes
        String attrBody = null;
        // GenFile Attributes
        String attrSourceBundle = null;
        String attrBasePackageName = null;
        String attrSubPackageName = null;
        String attrExpansionClassName = null;
        String attrExpansionKeyName = null;
        String attrExpansionFileName = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstGenFileUpdate");

        CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGenKbSchemaObj 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("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CartridgeId")) {
                if (attrCartridgeId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCartridgeId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ItemId")) {
                if (attrItemId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrItemId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("RuleTypeId")) {
                if (attrRuleTypeId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrRuleTypeId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Name")) {
                if (attrName != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrName = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ToolSetId")) {
                if (attrToolSetId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrToolSetId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ScopeDefId")) {
                if (attrScopeDefId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrScopeDefId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("GenDefId")) {
                if (attrGenDefId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrGenDefId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("GelExecutableId")) {
                if (attrGelExecutableId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrGelExecutableId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Body")) {
                if (attrBody != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBody = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SourceBundle")) {
                if (attrSourceBundle != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSourceBundle = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BasePackageName")) {
                if (attrBasePackageName != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBasePackageName = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SubPackageName")) {
                if (attrSubPackageName != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSubPackageName = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ExpansionClassName")) {
                if (attrExpansionClassName != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrExpansionClassName = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ExpansionKeyName")) {
                if (attrExpansionKeyName != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrExpansionKeyName = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ExpansionFileName")) {
                if (attrExpansionFileName != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrExpansionFileName = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values
        if ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "TenantId");
        }
        if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "CartridgeId");
        }
        if ((attrItemId == null) || (attrItemId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ItemId");
        }
        if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "RuleTypeId");
        }
        if (attrName == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Name");
        }
        if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ToolSetId");
        }
        if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "GenDefId");
        }
        if ((attrRevision == null) || (attrRevision.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Revision");
        }
        if (attrBody == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Body");
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();

        // Instantiate a PKey buffer for the parsed information
        CFGenKbGenItemPKey pkey = schemaObj.getBackingStore().getFactoryGenItem().newPKey();

        long natTenantId;
        natTenantId = Long.parseLong(attrTenantId);
        pkey.setRequiredTenantId(natTenantId);
        long natCartridgeId;
        natCartridgeId = Long.parseLong(attrCartridgeId);
        pkey.setRequiredCartridgeId(natCartridgeId);
        int natItemId;
        natItemId = Integer.parseInt(attrItemId);
        pkey.setRequiredItemId(natItemId);
        // Read the instance
        ICFGenKbGenFileObj origBuff = schemaObj.getGenFileTableObj().readGenFile(pkey);
        if (origBuff == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getGenFileTableObj().readGenFile()");
        } else {
            // Edit the instance
            ICFGenKbGenFileEditObj editBuff = (ICFGenKbGenFileEditObj) origBuff.beginEdit();
            CFGenKbGenFileBuff dataBuff = editBuff.getGenFileBuff();
            // Convert string attributes to native Java types
            // and apply the converted attributes to the editBuff.
            short natRuleTypeId = Short.parseShort(attrRuleTypeId);

            dataBuff.setRequiredRuleTypeId(natRuleTypeId);

            String natName = attrName;

            dataBuff.setRequiredName(natName);

            short natToolSetId = Short.parseShort(attrToolSetId);

            dataBuff.setRequiredToolSetId(natToolSetId);

            Short natScopeDefId;
            if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) {
                natScopeDefId = null;
            } else {
                natScopeDefId = new Short(Short.parseShort(attrScopeDefId));
            }

            dataBuff.setOptionalScopeDefId(natScopeDefId);

            short natGenDefId = Short.parseShort(attrGenDefId);

            dataBuff.setRequiredGenDefId(natGenDefId);

            Integer natGelExecutableId;
            if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) {
                natGelExecutableId = null;
            } else {
                natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId));
            }

            dataBuff.setOptionalGelExecutableId(natGelExecutableId);

            int natRevision = Integer.parseInt(attrRevision);
            dataBuff.setRequiredRevision(natRevision);
            String natBody = attrBody;

            dataBuff.setRequiredBody(natBody);

            String natSourceBundle = attrSourceBundle;

            dataBuff.setOptionalSourceBundle(natSourceBundle);

            String natBasePackageName = attrBasePackageName;

            dataBuff.setOptionalBasePackageName(natBasePackageName);

            String natSubPackageName = attrSubPackageName;

            dataBuff.setOptionalSubPackageName(natSubPackageName);

            String natExpansionClassName = attrExpansionClassName;

            dataBuff.setOptionalExpansionClassName(natExpansionClassName);

            String natExpansionKeyName = attrExpansionKeyName;

            dataBuff.setOptionalExpansionKeyName(natExpansionKeyName);

            String natExpansionFileName = attrExpansionFileName;

            dataBuff.setOptionalExpansionFileName(natExpansionFileName);

            //   Attempt the update
            editBuff.update();
            editBuff.endEdit();
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgGenFileMessageFormatter.formatGenFileRspnUpdated("\n\t\t\t",
                            origBuff.getGenFileBuff())
                    + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            ((CFGenKbXMsgRqstHandler) getParser()).appendResponse(response);
        }
    } catch (RuntimeException e) {
        String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}

From source file:net.sf.juffrou.reflect.spring.BeanWrapperTests.java

@Test
public void testNumberObjects() {
    NumberTestBean tb = new NumberTestBean();
    BeanWrapper bw = new JuffrouSpringBeanWrapper(tb);

    try {/*from   ww  w .ja v a2s  . c om*/
        bw.setPropertyValue("short2", "2");
        bw.setPropertyValue("int2", "8");
        bw.setPropertyValue("long2", "6");
        bw.setPropertyValue("bigInteger", "3");
        bw.setPropertyValue("float2", "8.1");
        bw.setPropertyValue("double2", "6.1");
        bw.setPropertyValue("bigDecimal", "4.0");
    } catch (BeansException ex) {
        fail("Should not throw BeansException: " + ex.getMessage());
    }

    assertTrue("Correct short2 value", new Short("2").equals(bw.getPropertyValue("short2")));
    assertTrue("Correct short2 value", new Short("2").equals(tb.getShort2()));
    assertTrue("Correct int2 value", new Integer("8").equals(bw.getPropertyValue("int2")));
    assertTrue("Correct int2 value", new Integer("8").equals(tb.getInt2()));
    assertTrue("Correct long2 value", new Long("6").equals(bw.getPropertyValue("long2")));
    assertTrue("Correct long2 value", new Long("6").equals(tb.getLong2()));
    assertTrue("Correct bigInteger value", new BigInteger("3").equals(bw.getPropertyValue("bigInteger")));
    assertTrue("Correct bigInteger value", new BigInteger("3").equals(tb.getBigInteger()));
    assertTrue("Correct float2 value", new Float("8.1").equals(bw.getPropertyValue("float2")));
    assertTrue("Correct float2 value", new Float("8.1").equals(tb.getFloat2()));
    assertTrue("Correct double2 value", new Double("6.1").equals(bw.getPropertyValue("double2")));
    assertTrue("Correct double2 value", new Double("6.1").equals(tb.getDouble2()));
    assertTrue("Correct bigDecimal value", new BigDecimal("4.0").equals(bw.getPropertyValue("bigDecimal")));
    assertTrue("Correct bigDecimal value", new BigDecimal("4.0").equals(tb.getBigDecimal()));
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRspnHandler.CFAccXMsgRspnAccountEntryRecHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/* w w  w.  j  a v  a  2 s.co m*/
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // AccountEntry Attributes
        String attrTenantId = null;
        String attrAccountId = null;
        String attrEntryId = null;
        String attrSplitEntryId = null;
        String attrEntryStamp = null;
        String attrDescription = null;
        String attrTransferTenantId = null;
        String attrTransferAccountId = null;
        String attrDebitCurrencyId = null;
        String attrDebit = null;
        String attrCreditCurrencyId = null;
        String attrCredit = null;
        String attrConvertedCurrencyId = null;
        String attrConvertedAmount = null;
        String attrBalanceCurrencyId = null;
        String attrBalance = 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("AccountEntry");

        CFAccXMsgRspnHandler xmsgRspnHandler = (CFAccXMsgRspnHandler) getParser();
        if (xmsgRspnHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAccSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Revision")) {
                if (attrRevision != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrRevision = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedAt")) {
                if (attrCreatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedBy")) {
                if (attrCreatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedAt")) {
                if (attrUpdatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedBy")) {
                if (attrUpdatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("AccountId")) {
                if (attrAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryId")) {
                if (attrEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SplitEntryId")) {
                if (attrSplitEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSplitEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryStamp")) {
                if (attrEntryStamp != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryStamp = 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("TransferTenantId")) {
                if (attrTransferTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TransferAccountId")) {
                if (attrTransferAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("DebitCurrencyId")) {
                if (attrDebitCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebitCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Debit")) {
                if (attrDebit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreditCurrencyId")) {
                if (attrCreditCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreditCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Credit")) {
                if (attrCredit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCredit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedCurrencyId")) {
                if (attrConvertedCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedAmount")) {
                if (attrConvertedAmount != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedAmount = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BalanceCurrencyId")) {
                if (attrBalanceCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalanceCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Balance")) {
                if (attrBalance != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalance = 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 ((attrAccountId == null) || (attrAccountId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "AccountId");
        }
        if ((attrEntryId == null) || (attrEntryId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryId");
        }
        if ((attrEntryStamp == null) || (attrEntryStamp.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp");
        }
        if (attrDescription == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Description");
        }
        if ((attrConvertedCurrencyId == null) || (attrConvertedCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedCurrencyId");
        }
        if ((attrConvertedAmount == null) || (attrConvertedAmount.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedAmount");
        }
        if ((attrBalanceCurrencyId == null) || (attrBalanceCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BalanceCurrencyId");
        }
        if ((attrBalance == null) || (attrBalance.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Balance");
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext();

        // Convert string attributes to native Java types

        long natTenantId = Long.parseLong(attrTenantId);

        long natAccountId = Long.parseLong(attrAccountId);

        UUID natEntryId = UUID.fromString(attrEntryId);

        UUID natSplitEntryId;
        if ((attrSplitEntryId == null) || (attrSplitEntryId.length() <= 0)) {
            natSplitEntryId = null;
        } else {
            natSplitEntryId = UUID.fromString(attrSplitEntryId);
        }

        Calendar natEntryStamp;
        try {
            natEntryStamp = CFLibXmlUtil.parseTimestamp(attrEntryStamp);
        } catch (RuntimeException e) {
            throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp", attrEntryStamp, e);
        }

        String natDescription = attrDescription;

        Long natTransferTenantId;
        if ((attrTransferTenantId == null) || (attrTransferTenantId.length() <= 0)) {
            natTransferTenantId = null;
        } else {
            natTransferTenantId = new Long(Long.parseLong(attrTransferTenantId));
        }

        Long natTransferAccountId;
        if ((attrTransferAccountId == null) || (attrTransferAccountId.length() <= 0)) {
            natTransferAccountId = null;
        } else {
            natTransferAccountId = new Long(Long.parseLong(attrTransferAccountId));
        }

        Short natDebitCurrencyId;
        if ((attrDebitCurrencyId == null) || (attrDebitCurrencyId.length() <= 0)) {
            natDebitCurrencyId = null;
        } else {
            natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId));
        }

        BigDecimal natDebit;
        if ((attrDebit == null) || (attrDebit.length() <= 0)) {
            natDebit = null;
        } else {
            natDebit = new BigDecimal(attrDebit);
        }

        Short natCreditCurrencyId;
        if ((attrCreditCurrencyId == null) || (attrCreditCurrencyId.length() <= 0)) {
            natCreditCurrencyId = null;
        } else {
            natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId));
        }

        BigDecimal natCredit;
        if ((attrCredit == null) || (attrCredit.length() <= 0)) {
            natCredit = null;
        } else {
            natCredit = new BigDecimal(attrCredit);
        }

        short natConvertedCurrencyId = Short.parseShort(attrConvertedCurrencyId);

        BigDecimal natConvertedAmount = new BigDecimal(attrConvertedAmount);

        short natBalanceCurrencyId = Short.parseShort(attrBalanceCurrencyId);

        BigDecimal natBalance = new BigDecimal(attrBalance);

        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
        ICFAccAccountEntryObj obj = schemaObj.getAccountEntryTableObj().newInstance();
        CFAccAccountEntryBuff dataBuff = obj.getAccountEntryBuff();
        dataBuff.setRequiredTenantId(natTenantId);
        dataBuff.setRequiredAccountId(natAccountId);
        dataBuff.setRequiredEntryId(natEntryId);
        dataBuff.setOptionalSplitEntryId(natSplitEntryId);
        dataBuff.setRequiredEntryStamp(natEntryStamp);
        dataBuff.setRequiredDescription(natDescription);
        dataBuff.setOptionalTransferTenantId(natTransferTenantId);
        dataBuff.setOptionalTransferAccountId(natTransferAccountId);
        dataBuff.setOptionalDebitCurrencyId(natDebitCurrencyId);
        dataBuff.setOptionalDebit(natDebit);
        dataBuff.setOptionalCreditCurrencyId(natCreditCurrencyId);
        dataBuff.setOptionalCredit(natCredit);
        dataBuff.setRequiredConvertedCurrencyId(natConvertedCurrencyId);
        dataBuff.setRequiredConvertedAmount(natConvertedAmount);
        dataBuff.setRequiredBalanceCurrencyId(natBalanceCurrencyId);
        dataBuff.setRequiredBalance(natBalance);
        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();
        SortedMap<CFAccAccountEntryPKey, ICFAccAccountEntryObj> sortedMap = (SortedMap<CFAccAccountEntryPKey, ICFAccAccountEntryObj>) xmsgRspnHandler
                .getSortedMapOfObjects();
        ICFAccAccountEntryObj realized = (ICFAccAccountEntryObj) obj.realize();
        xmsgRspnHandler.setLastObjectProcessed(realized);
        if (sortedMap != null) {
            sortedMap.put(realized.getPKey(), realized);
        }
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashXMsgRspnHandler.CFGCashXMsgRspnAccountEntryRecHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//w w  w .  j a  va2  s .c  o m
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // AccountEntry Attributes
        String attrTenantId = null;
        String attrAccountId = null;
        String attrEntryId = null;
        String attrSplitEntryId = null;
        String attrEntryStamp = null;
        String attrDescription = null;
        String attrTransferTenantId = null;
        String attrTransferAccountId = null;
        String attrDebitCurrencyId = null;
        String attrDebit = null;
        String attrCreditCurrencyId = null;
        String attrCredit = null;
        String attrConvertedCurrencyId = null;
        String attrConvertedAmount = null;
        String attrBalanceCurrencyId = null;
        String attrBalance = 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("AccountEntry");

        CFGCashXMsgRspnHandler xmsgRspnHandler = (CFGCashXMsgRspnHandler) getParser();
        if (xmsgRspnHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGCashSchemaObj 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("AccountId")) {
                if (attrAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryId")) {
                if (attrEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SplitEntryId")) {
                if (attrSplitEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSplitEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryStamp")) {
                if (attrEntryStamp != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryStamp = 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("TransferTenantId")) {
                if (attrTransferTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TransferAccountId")) {
                if (attrTransferAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("DebitCurrencyId")) {
                if (attrDebitCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebitCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Debit")) {
                if (attrDebit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreditCurrencyId")) {
                if (attrCreditCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreditCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Credit")) {
                if (attrCredit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCredit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedCurrencyId")) {
                if (attrConvertedCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedAmount")) {
                if (attrConvertedAmount != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedAmount = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BalanceCurrencyId")) {
                if (attrBalanceCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalanceCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Balance")) {
                if (attrBalance != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalance = 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 ((attrAccountId == null) || (attrAccountId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "AccountId");
        }
        if ((attrEntryId == null) || (attrEntryId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryId");
        }
        if ((attrEntryStamp == null) || (attrEntryStamp.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp");
        }
        if (attrDescription == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Description");
        }
        if ((attrConvertedCurrencyId == null) || (attrConvertedCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedCurrencyId");
        }
        if ((attrConvertedAmount == null) || (attrConvertedAmount.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedAmount");
        }
        if ((attrBalanceCurrencyId == null) || (attrBalanceCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BalanceCurrencyId");
        }
        if ((attrBalance == null) || (attrBalance.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Balance");
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext();

        // Convert string attributes to native Java types

        long natTenantId = Long.parseLong(attrTenantId);

        long natAccountId = Long.parseLong(attrAccountId);

        UUID natEntryId = UUID.fromString(attrEntryId);

        UUID natSplitEntryId;
        if ((attrSplitEntryId == null) || (attrSplitEntryId.length() <= 0)) {
            natSplitEntryId = null;
        } else {
            natSplitEntryId = UUID.fromString(attrSplitEntryId);
        }

        Calendar natEntryStamp;
        try {
            natEntryStamp = CFLibXmlUtil.parseTimestamp(attrEntryStamp);
        } catch (RuntimeException e) {
            throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp", attrEntryStamp, e);
        }

        String natDescription = attrDescription;

        Long natTransferTenantId;
        if ((attrTransferTenantId == null) || (attrTransferTenantId.length() <= 0)) {
            natTransferTenantId = null;
        } else {
            natTransferTenantId = new Long(Long.parseLong(attrTransferTenantId));
        }

        Long natTransferAccountId;
        if ((attrTransferAccountId == null) || (attrTransferAccountId.length() <= 0)) {
            natTransferAccountId = null;
        } else {
            natTransferAccountId = new Long(Long.parseLong(attrTransferAccountId));
        }

        Short natDebitCurrencyId;
        if ((attrDebitCurrencyId == null) || (attrDebitCurrencyId.length() <= 0)) {
            natDebitCurrencyId = null;
        } else {
            natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId));
        }

        BigDecimal natDebit;
        if ((attrDebit == null) || (attrDebit.length() <= 0)) {
            natDebit = null;
        } else {
            natDebit = new BigDecimal(attrDebit);
        }

        Short natCreditCurrencyId;
        if ((attrCreditCurrencyId == null) || (attrCreditCurrencyId.length() <= 0)) {
            natCreditCurrencyId = null;
        } else {
            natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId));
        }

        BigDecimal natCredit;
        if ((attrCredit == null) || (attrCredit.length() <= 0)) {
            natCredit = null;
        } else {
            natCredit = new BigDecimal(attrCredit);
        }

        short natConvertedCurrencyId = Short.parseShort(attrConvertedCurrencyId);

        BigDecimal natConvertedAmount = new BigDecimal(attrConvertedAmount);

        short natBalanceCurrencyId = Short.parseShort(attrBalanceCurrencyId);

        BigDecimal natBalance = new BigDecimal(attrBalance);

        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
        ICFGCashAccountEntryObj obj = schemaObj.getAccountEntryTableObj().newInstance();
        CFGCashAccountEntryBuff dataBuff = obj.getAccountEntryBuff();
        dataBuff.setRequiredTenantId(natTenantId);
        dataBuff.setRequiredAccountId(natAccountId);
        dataBuff.setRequiredEntryId(natEntryId);
        dataBuff.setOptionalSplitEntryId(natSplitEntryId);
        dataBuff.setRequiredEntryStamp(natEntryStamp);
        dataBuff.setRequiredDescription(natDescription);
        dataBuff.setOptionalTransferTenantId(natTransferTenantId);
        dataBuff.setOptionalTransferAccountId(natTransferAccountId);
        dataBuff.setOptionalDebitCurrencyId(natDebitCurrencyId);
        dataBuff.setOptionalDebit(natDebit);
        dataBuff.setOptionalCreditCurrencyId(natCreditCurrencyId);
        dataBuff.setOptionalCredit(natCredit);
        dataBuff.setRequiredConvertedCurrencyId(natConvertedCurrencyId);
        dataBuff.setRequiredConvertedAmount(natConvertedAmount);
        dataBuff.setRequiredBalanceCurrencyId(natBalanceCurrencyId);
        dataBuff.setRequiredBalance(natBalance);
        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();
        SortedMap<CFGCashAccountEntryPKey, ICFGCashAccountEntryObj> sortedMap = (SortedMap<CFGCashAccountEntryPKey, ICFGCashAccountEntryObj>) xmsgRspnHandler
                .getSortedMapOfObjects();
        ICFGCashAccountEntryObj realized = (ICFGCashAccountEntryObj) obj.realize();
        xmsgRspnHandler.setLastObjectProcessed(realized);
        if (sortedMap != null) {
            sortedMap.put(realized.getPKey(), realized);
        }
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRspnHandler.CFAccXMsgRspnAccountEntryLockedHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from  w  w  w. ja  v  a  2  s  . c  o m*/
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // AccountEntry Attributes
        String attrTenantId = null;
        String attrAccountId = null;
        String attrEntryId = null;
        String attrSplitEntryId = null;
        String attrEntryStamp = null;
        String attrDescription = null;
        String attrTransferTenantId = null;
        String attrTransferAccountId = null;
        String attrDebitCurrencyId = null;
        String attrDebit = null;
        String attrCreditCurrencyId = null;
        String attrCredit = null;
        String attrConvertedCurrencyId = null;
        String attrConvertedAmount = null;
        String attrBalanceCurrencyId = null;
        String attrBalance = 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("RspnAccountEntryLocked");

        CFAccXMsgRspnHandler xmsgRspnHandler = (CFAccXMsgRspnHandler) getParser();
        if (xmsgRspnHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAccSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Revision")) {
                if (attrRevision != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrRevision = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedAt")) {
                if (attrCreatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedBy")) {
                if (attrCreatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedAt")) {
                if (attrUpdatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedBy")) {
                if (attrUpdatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("AccountId")) {
                if (attrAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryId")) {
                if (attrEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SplitEntryId")) {
                if (attrSplitEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSplitEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryStamp")) {
                if (attrEntryStamp != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryStamp = 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("TransferTenantId")) {
                if (attrTransferTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TransferAccountId")) {
                if (attrTransferAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("DebitCurrencyId")) {
                if (attrDebitCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebitCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Debit")) {
                if (attrDebit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreditCurrencyId")) {
                if (attrCreditCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreditCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Credit")) {
                if (attrCredit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCredit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedCurrencyId")) {
                if (attrConvertedCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedAmount")) {
                if (attrConvertedAmount != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedAmount = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BalanceCurrencyId")) {
                if (attrBalanceCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalanceCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Balance")) {
                if (attrBalance != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalance = 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 ((attrAccountId == null) || (attrAccountId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "AccountId");
        }
        if ((attrEntryId == null) || (attrEntryId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryId");
        }
        if ((attrEntryStamp == null) || (attrEntryStamp.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp");
        }
        if (attrDescription == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Description");
        }
        if ((attrConvertedCurrencyId == null) || (attrConvertedCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedCurrencyId");
        }
        if ((attrConvertedAmount == null) || (attrConvertedAmount.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedAmount");
        }
        if ((attrBalanceCurrencyId == null) || (attrBalanceCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BalanceCurrencyId");
        }
        if ((attrBalance == null) || (attrBalance.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Balance");
        }
        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 natAccountId = Long.parseLong(attrAccountId);

        UUID natEntryId = UUID.fromString(attrEntryId);

        UUID natSplitEntryId;
        if ((attrSplitEntryId == null) || (attrSplitEntryId.length() <= 0)) {
            natSplitEntryId = null;
        } else {
            natSplitEntryId = UUID.fromString(attrSplitEntryId);
        }

        Calendar natEntryStamp;
        try {
            natEntryStamp = CFLibXmlUtil.parseTimestamp(attrEntryStamp);
        } catch (RuntimeException e) {
            throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp", attrEntryStamp, e);
        }

        String natDescription = attrDescription;

        Long natTransferTenantId;
        if ((attrTransferTenantId == null) || (attrTransferTenantId.length() <= 0)) {
            natTransferTenantId = null;
        } else {
            natTransferTenantId = new Long(Long.parseLong(attrTransferTenantId));
        }

        Long natTransferAccountId;
        if ((attrTransferAccountId == null) || (attrTransferAccountId.length() <= 0)) {
            natTransferAccountId = null;
        } else {
            natTransferAccountId = new Long(Long.parseLong(attrTransferAccountId));
        }

        Short natDebitCurrencyId;
        if ((attrDebitCurrencyId == null) || (attrDebitCurrencyId.length() <= 0)) {
            natDebitCurrencyId = null;
        } else {
            natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId));
        }

        BigDecimal natDebit;
        if ((attrDebit == null) || (attrDebit.length() <= 0)) {
            natDebit = null;
        } else {
            natDebit = new BigDecimal(attrDebit);
        }

        Short natCreditCurrencyId;
        if ((attrCreditCurrencyId == null) || (attrCreditCurrencyId.length() <= 0)) {
            natCreditCurrencyId = null;
        } else {
            natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId));
        }

        BigDecimal natCredit;
        if ((attrCredit == null) || (attrCredit.length() <= 0)) {
            natCredit = null;
        } else {
            natCredit = new BigDecimal(attrCredit);
        }

        short natConvertedCurrencyId = Short.parseShort(attrConvertedCurrencyId);

        BigDecimal natConvertedAmount = new BigDecimal(attrConvertedAmount);

        short natBalanceCurrencyId = Short.parseShort(attrBalanceCurrencyId);

        BigDecimal natBalance = new BigDecimal(attrBalance);

        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
        ICFAccAccountEntryObj obj = schemaObj.getAccountEntryTableObj().newInstance();
        CFAccAccountEntryBuff dataBuff = obj.getAccountEntryBuff();
        dataBuff.setRequiredTenantId(natTenantId);
        dataBuff.setRequiredAccountId(natAccountId);
        dataBuff.setRequiredEntryId(natEntryId);
        dataBuff.setOptionalSplitEntryId(natSplitEntryId);
        dataBuff.setRequiredEntryStamp(natEntryStamp);
        dataBuff.setRequiredDescription(natDescription);
        dataBuff.setOptionalTransferTenantId(natTransferTenantId);
        dataBuff.setOptionalTransferAccountId(natTransferAccountId);
        dataBuff.setOptionalDebitCurrencyId(natDebitCurrencyId);
        dataBuff.setOptionalDebit(natDebit);
        dataBuff.setOptionalCreditCurrencyId(natCreditCurrencyId);
        dataBuff.setOptionalCredit(natCredit);
        dataBuff.setRequiredConvertedCurrencyId(natConvertedCurrencyId);
        dataBuff.setRequiredConvertedAmount(natConvertedAmount);
        dataBuff.setRequiredBalanceCurrencyId(natBalanceCurrencyId);
        dataBuff.setRequiredBalance(natBalance);
        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();
        ICFAccAccountEntryObj realized = (ICFAccAccountEntryObj) obj.realize();
        xmsgRspnHandler.setLastObjectProcessed(realized);
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRspnHandler.CFAccXMsgRspnAccountEntryCreatedHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from ww  w  .  jav  a 2s . c  o  m*/
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // AccountEntry Attributes
        String attrTenantId = null;
        String attrAccountId = null;
        String attrEntryId = null;
        String attrSplitEntryId = null;
        String attrEntryStamp = null;
        String attrDescription = null;
        String attrTransferTenantId = null;
        String attrTransferAccountId = null;
        String attrDebitCurrencyId = null;
        String attrDebit = null;
        String attrCreditCurrencyId = null;
        String attrCredit = null;
        String attrConvertedCurrencyId = null;
        String attrConvertedAmount = null;
        String attrBalanceCurrencyId = null;
        String attrBalance = 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("RspnAccountEntryCreated");

        CFAccXMsgRspnHandler xmsgRspnHandler = (CFAccXMsgRspnHandler) getParser();
        if (xmsgRspnHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAccSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Revision")) {
                if (attrRevision != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrRevision = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedAt")) {
                if (attrCreatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedBy")) {
                if (attrCreatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedAt")) {
                if (attrUpdatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedBy")) {
                if (attrUpdatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("AccountId")) {
                if (attrAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryId")) {
                if (attrEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SplitEntryId")) {
                if (attrSplitEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSplitEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryStamp")) {
                if (attrEntryStamp != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryStamp = 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("TransferTenantId")) {
                if (attrTransferTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TransferAccountId")) {
                if (attrTransferAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("DebitCurrencyId")) {
                if (attrDebitCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebitCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Debit")) {
                if (attrDebit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreditCurrencyId")) {
                if (attrCreditCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreditCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Credit")) {
                if (attrCredit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCredit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedCurrencyId")) {
                if (attrConvertedCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedAmount")) {
                if (attrConvertedAmount != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedAmount = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BalanceCurrencyId")) {
                if (attrBalanceCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalanceCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Balance")) {
                if (attrBalance != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalance = 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 ((attrAccountId == null) || (attrAccountId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "AccountId");
        }
        if ((attrEntryId == null) || (attrEntryId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryId");
        }
        if ((attrEntryStamp == null) || (attrEntryStamp.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp");
        }
        if (attrDescription == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Description");
        }
        if ((attrConvertedCurrencyId == null) || (attrConvertedCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedCurrencyId");
        }
        if ((attrConvertedAmount == null) || (attrConvertedAmount.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedAmount");
        }
        if ((attrBalanceCurrencyId == null) || (attrBalanceCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BalanceCurrencyId");
        }
        if ((attrBalance == null) || (attrBalance.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Balance");
        }
        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 natAccountId = Long.parseLong(attrAccountId);

        UUID natEntryId = UUID.fromString(attrEntryId);

        UUID natSplitEntryId;
        if ((attrSplitEntryId == null) || (attrSplitEntryId.length() <= 0)) {
            natSplitEntryId = null;
        } else {
            natSplitEntryId = UUID.fromString(attrSplitEntryId);
        }

        Calendar natEntryStamp;
        try {
            natEntryStamp = CFLibXmlUtil.parseTimestamp(attrEntryStamp);
        } catch (RuntimeException e) {
            throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp", attrEntryStamp, e);
        }

        String natDescription = attrDescription;

        Long natTransferTenantId;
        if ((attrTransferTenantId == null) || (attrTransferTenantId.length() <= 0)) {
            natTransferTenantId = null;
        } else {
            natTransferTenantId = new Long(Long.parseLong(attrTransferTenantId));
        }

        Long natTransferAccountId;
        if ((attrTransferAccountId == null) || (attrTransferAccountId.length() <= 0)) {
            natTransferAccountId = null;
        } else {
            natTransferAccountId = new Long(Long.parseLong(attrTransferAccountId));
        }

        Short natDebitCurrencyId;
        if ((attrDebitCurrencyId == null) || (attrDebitCurrencyId.length() <= 0)) {
            natDebitCurrencyId = null;
        } else {
            natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId));
        }

        BigDecimal natDebit;
        if ((attrDebit == null) || (attrDebit.length() <= 0)) {
            natDebit = null;
        } else {
            natDebit = new BigDecimal(attrDebit);
        }

        Short natCreditCurrencyId;
        if ((attrCreditCurrencyId == null) || (attrCreditCurrencyId.length() <= 0)) {
            natCreditCurrencyId = null;
        } else {
            natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId));
        }

        BigDecimal natCredit;
        if ((attrCredit == null) || (attrCredit.length() <= 0)) {
            natCredit = null;
        } else {
            natCredit = new BigDecimal(attrCredit);
        }

        short natConvertedCurrencyId = Short.parseShort(attrConvertedCurrencyId);

        BigDecimal natConvertedAmount = new BigDecimal(attrConvertedAmount);

        short natBalanceCurrencyId = Short.parseShort(attrBalanceCurrencyId);

        BigDecimal natBalance = new BigDecimal(attrBalance);

        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
        ICFAccAccountEntryObj obj = schemaObj.getAccountEntryTableObj().newInstance();
        CFAccAccountEntryBuff dataBuff = obj.getAccountEntryBuff();
        dataBuff.setRequiredTenantId(natTenantId);
        dataBuff.setRequiredAccountId(natAccountId);
        dataBuff.setRequiredEntryId(natEntryId);
        dataBuff.setOptionalSplitEntryId(natSplitEntryId);
        dataBuff.setRequiredEntryStamp(natEntryStamp);
        dataBuff.setRequiredDescription(natDescription);
        dataBuff.setOptionalTransferTenantId(natTransferTenantId);
        dataBuff.setOptionalTransferAccountId(natTransferAccountId);
        dataBuff.setOptionalDebitCurrencyId(natDebitCurrencyId);
        dataBuff.setOptionalDebit(natDebit);
        dataBuff.setOptionalCreditCurrencyId(natCreditCurrencyId);
        dataBuff.setOptionalCredit(natCredit);
        dataBuff.setRequiredConvertedCurrencyId(natConvertedCurrencyId);
        dataBuff.setRequiredConvertedAmount(natConvertedAmount);
        dataBuff.setRequiredBalanceCurrencyId(natBalanceCurrencyId);
        dataBuff.setRequiredBalance(natBalance);
        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();
        ICFAccAccountEntryObj realized = (ICFAccAccountEntryObj) obj.realize();
        xmsgRspnHandler.setLastObjectProcessed(realized);
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRspnHandler.CFAccXMsgRspnAccountEntryUpdatedHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from   ww w . ja  v  a2 s  . com*/
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // AccountEntry Attributes
        String attrTenantId = null;
        String attrAccountId = null;
        String attrEntryId = null;
        String attrSplitEntryId = null;
        String attrEntryStamp = null;
        String attrDescription = null;
        String attrTransferTenantId = null;
        String attrTransferAccountId = null;
        String attrDebitCurrencyId = null;
        String attrDebit = null;
        String attrCreditCurrencyId = null;
        String attrCredit = null;
        String attrConvertedCurrencyId = null;
        String attrConvertedAmount = null;
        String attrBalanceCurrencyId = null;
        String attrBalance = 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("RspnAccountEntryUpdated");

        CFAccXMsgRspnHandler xmsgRspnHandler = (CFAccXMsgRspnHandler) getParser();
        if (xmsgRspnHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAccSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Revision")) {
                if (attrRevision != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrRevision = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedAt")) {
                if (attrCreatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreatedBy")) {
                if (attrCreatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedAt")) {
                if (attrUpdatedAt != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedAt = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("UpdatedBy")) {
                if (attrUpdatedBy != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrUpdatedBy = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("AccountId")) {
                if (attrAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryId")) {
                if (attrEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SplitEntryId")) {
                if (attrSplitEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSplitEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryStamp")) {
                if (attrEntryStamp != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryStamp = 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("TransferTenantId")) {
                if (attrTransferTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TransferAccountId")) {
                if (attrTransferAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("DebitCurrencyId")) {
                if (attrDebitCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebitCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Debit")) {
                if (attrDebit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreditCurrencyId")) {
                if (attrCreditCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreditCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Credit")) {
                if (attrCredit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCredit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedCurrencyId")) {
                if (attrConvertedCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedAmount")) {
                if (attrConvertedAmount != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedAmount = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BalanceCurrencyId")) {
                if (attrBalanceCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalanceCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Balance")) {
                if (attrBalance != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalance = 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 ((attrAccountId == null) || (attrAccountId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "AccountId");
        }
        if ((attrEntryId == null) || (attrEntryId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryId");
        }
        if ((attrEntryStamp == null) || (attrEntryStamp.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp");
        }
        if (attrDescription == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Description");
        }
        if ((attrConvertedCurrencyId == null) || (attrConvertedCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedCurrencyId");
        }
        if ((attrConvertedAmount == null) || (attrConvertedAmount.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedAmount");
        }
        if ((attrBalanceCurrencyId == null) || (attrBalanceCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BalanceCurrencyId");
        }
        if ((attrBalance == null) || (attrBalance.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Balance");
        }
        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 natAccountId = Long.parseLong(attrAccountId);

        UUID natEntryId = UUID.fromString(attrEntryId);

        UUID natSplitEntryId;
        if ((attrSplitEntryId == null) || (attrSplitEntryId.length() <= 0)) {
            natSplitEntryId = null;
        } else {
            natSplitEntryId = UUID.fromString(attrSplitEntryId);
        }

        Calendar natEntryStamp;
        try {
            natEntryStamp = CFLibXmlUtil.parseTimestamp(attrEntryStamp);
        } catch (RuntimeException e) {
            throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp", attrEntryStamp, e);
        }

        String natDescription = attrDescription;

        Long natTransferTenantId;
        if ((attrTransferTenantId == null) || (attrTransferTenantId.length() <= 0)) {
            natTransferTenantId = null;
        } else {
            natTransferTenantId = new Long(Long.parseLong(attrTransferTenantId));
        }

        Long natTransferAccountId;
        if ((attrTransferAccountId == null) || (attrTransferAccountId.length() <= 0)) {
            natTransferAccountId = null;
        } else {
            natTransferAccountId = new Long(Long.parseLong(attrTransferAccountId));
        }

        Short natDebitCurrencyId;
        if ((attrDebitCurrencyId == null) || (attrDebitCurrencyId.length() <= 0)) {
            natDebitCurrencyId = null;
        } else {
            natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId));
        }

        BigDecimal natDebit;
        if ((attrDebit == null) || (attrDebit.length() <= 0)) {
            natDebit = null;
        } else {
            natDebit = new BigDecimal(attrDebit);
        }

        Short natCreditCurrencyId;
        if ((attrCreditCurrencyId == null) || (attrCreditCurrencyId.length() <= 0)) {
            natCreditCurrencyId = null;
        } else {
            natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId));
        }

        BigDecimal natCredit;
        if ((attrCredit == null) || (attrCredit.length() <= 0)) {
            natCredit = null;
        } else {
            natCredit = new BigDecimal(attrCredit);
        }

        short natConvertedCurrencyId = Short.parseShort(attrConvertedCurrencyId);

        BigDecimal natConvertedAmount = new BigDecimal(attrConvertedAmount);

        short natBalanceCurrencyId = Short.parseShort(attrBalanceCurrencyId);

        BigDecimal natBalance = new BigDecimal(attrBalance);

        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
        ICFAccAccountEntryObj obj = schemaObj.getAccountEntryTableObj().newInstance();
        CFAccAccountEntryBuff dataBuff = obj.getAccountEntryBuff();
        dataBuff.setRequiredTenantId(natTenantId);
        dataBuff.setRequiredAccountId(natAccountId);
        dataBuff.setRequiredEntryId(natEntryId);
        dataBuff.setOptionalSplitEntryId(natSplitEntryId);
        dataBuff.setRequiredEntryStamp(natEntryStamp);
        dataBuff.setRequiredDescription(natDescription);
        dataBuff.setOptionalTransferTenantId(natTransferTenantId);
        dataBuff.setOptionalTransferAccountId(natTransferAccountId);
        dataBuff.setOptionalDebitCurrencyId(natDebitCurrencyId);
        dataBuff.setOptionalDebit(natDebit);
        dataBuff.setOptionalCreditCurrencyId(natCreditCurrencyId);
        dataBuff.setOptionalCredit(natCredit);
        dataBuff.setRequiredConvertedCurrencyId(natConvertedCurrencyId);
        dataBuff.setRequiredConvertedAmount(natConvertedAmount);
        dataBuff.setRequiredBalanceCurrencyId(natBalanceCurrencyId);
        dataBuff.setRequiredBalance(natBalance);
        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();
        ICFAccAccountEntryObj realized = (ICFAccAccountEntryObj) obj.realize();
        xmsgRspnHandler.setLastObjectProcessed(realized);
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashXMsgRspnHandler.CFGCashXMsgRspnAccountEntryLockedHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//from  w  w  w.jav  a  2 s  .c  o m
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // AccountEntry Attributes
        String attrTenantId = null;
        String attrAccountId = null;
        String attrEntryId = null;
        String attrSplitEntryId = null;
        String attrEntryStamp = null;
        String attrDescription = null;
        String attrTransferTenantId = null;
        String attrTransferAccountId = null;
        String attrDebitCurrencyId = null;
        String attrDebit = null;
        String attrCreditCurrencyId = null;
        String attrCredit = null;
        String attrConvertedCurrencyId = null;
        String attrConvertedAmount = null;
        String attrBalanceCurrencyId = null;
        String attrBalance = 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("RspnAccountEntryLocked");

        CFGCashXMsgRspnHandler xmsgRspnHandler = (CFGCashXMsgRspnHandler) getParser();
        if (xmsgRspnHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGCashSchemaObj 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("AccountId")) {
                if (attrAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryId")) {
                if (attrEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SplitEntryId")) {
                if (attrSplitEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSplitEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryStamp")) {
                if (attrEntryStamp != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryStamp = 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("TransferTenantId")) {
                if (attrTransferTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TransferAccountId")) {
                if (attrTransferAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("DebitCurrencyId")) {
                if (attrDebitCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebitCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Debit")) {
                if (attrDebit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreditCurrencyId")) {
                if (attrCreditCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreditCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Credit")) {
                if (attrCredit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCredit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedCurrencyId")) {
                if (attrConvertedCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedAmount")) {
                if (attrConvertedAmount != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedAmount = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BalanceCurrencyId")) {
                if (attrBalanceCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalanceCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Balance")) {
                if (attrBalance != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalance = 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 ((attrAccountId == null) || (attrAccountId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "AccountId");
        }
        if ((attrEntryId == null) || (attrEntryId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryId");
        }
        if ((attrEntryStamp == null) || (attrEntryStamp.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp");
        }
        if (attrDescription == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Description");
        }
        if ((attrConvertedCurrencyId == null) || (attrConvertedCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedCurrencyId");
        }
        if ((attrConvertedAmount == null) || (attrConvertedAmount.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedAmount");
        }
        if ((attrBalanceCurrencyId == null) || (attrBalanceCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BalanceCurrencyId");
        }
        if ((attrBalance == null) || (attrBalance.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Balance");
        }
        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 natAccountId = Long.parseLong(attrAccountId);

        UUID natEntryId = UUID.fromString(attrEntryId);

        UUID natSplitEntryId;
        if ((attrSplitEntryId == null) || (attrSplitEntryId.length() <= 0)) {
            natSplitEntryId = null;
        } else {
            natSplitEntryId = UUID.fromString(attrSplitEntryId);
        }

        Calendar natEntryStamp;
        try {
            natEntryStamp = CFLibXmlUtil.parseTimestamp(attrEntryStamp);
        } catch (RuntimeException e) {
            throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp", attrEntryStamp, e);
        }

        String natDescription = attrDescription;

        Long natTransferTenantId;
        if ((attrTransferTenantId == null) || (attrTransferTenantId.length() <= 0)) {
            natTransferTenantId = null;
        } else {
            natTransferTenantId = new Long(Long.parseLong(attrTransferTenantId));
        }

        Long natTransferAccountId;
        if ((attrTransferAccountId == null) || (attrTransferAccountId.length() <= 0)) {
            natTransferAccountId = null;
        } else {
            natTransferAccountId = new Long(Long.parseLong(attrTransferAccountId));
        }

        Short natDebitCurrencyId;
        if ((attrDebitCurrencyId == null) || (attrDebitCurrencyId.length() <= 0)) {
            natDebitCurrencyId = null;
        } else {
            natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId));
        }

        BigDecimal natDebit;
        if ((attrDebit == null) || (attrDebit.length() <= 0)) {
            natDebit = null;
        } else {
            natDebit = new BigDecimal(attrDebit);
        }

        Short natCreditCurrencyId;
        if ((attrCreditCurrencyId == null) || (attrCreditCurrencyId.length() <= 0)) {
            natCreditCurrencyId = null;
        } else {
            natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId));
        }

        BigDecimal natCredit;
        if ((attrCredit == null) || (attrCredit.length() <= 0)) {
            natCredit = null;
        } else {
            natCredit = new BigDecimal(attrCredit);
        }

        short natConvertedCurrencyId = Short.parseShort(attrConvertedCurrencyId);

        BigDecimal natConvertedAmount = new BigDecimal(attrConvertedAmount);

        short natBalanceCurrencyId = Short.parseShort(attrBalanceCurrencyId);

        BigDecimal natBalance = new BigDecimal(attrBalance);

        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
        ICFGCashAccountEntryObj obj = schemaObj.getAccountEntryTableObj().newInstance();
        CFGCashAccountEntryBuff dataBuff = obj.getAccountEntryBuff();
        dataBuff.setRequiredTenantId(natTenantId);
        dataBuff.setRequiredAccountId(natAccountId);
        dataBuff.setRequiredEntryId(natEntryId);
        dataBuff.setOptionalSplitEntryId(natSplitEntryId);
        dataBuff.setRequiredEntryStamp(natEntryStamp);
        dataBuff.setRequiredDescription(natDescription);
        dataBuff.setOptionalTransferTenantId(natTransferTenantId);
        dataBuff.setOptionalTransferAccountId(natTransferAccountId);
        dataBuff.setOptionalDebitCurrencyId(natDebitCurrencyId);
        dataBuff.setOptionalDebit(natDebit);
        dataBuff.setOptionalCreditCurrencyId(natCreditCurrencyId);
        dataBuff.setOptionalCredit(natCredit);
        dataBuff.setRequiredConvertedCurrencyId(natConvertedCurrencyId);
        dataBuff.setRequiredConvertedAmount(natConvertedAmount);
        dataBuff.setRequiredBalanceCurrencyId(natBalanceCurrencyId);
        dataBuff.setRequiredBalance(natBalance);
        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();
        ICFGCashAccountEntryObj realized = (ICFGCashAccountEntryObj) obj.realize();
        xmsgRspnHandler.setLastObjectProcessed(realized);
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashXMsgRspnHandler.CFGCashXMsgRspnAccountEntryCreatedHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//from  w w w  . j  a  v a2  s. co m
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // AccountEntry Attributes
        String attrTenantId = null;
        String attrAccountId = null;
        String attrEntryId = null;
        String attrSplitEntryId = null;
        String attrEntryStamp = null;
        String attrDescription = null;
        String attrTransferTenantId = null;
        String attrTransferAccountId = null;
        String attrDebitCurrencyId = null;
        String attrDebit = null;
        String attrCreditCurrencyId = null;
        String attrCredit = null;
        String attrConvertedCurrencyId = null;
        String attrConvertedAmount = null;
        String attrBalanceCurrencyId = null;
        String attrBalance = 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("RspnAccountEntryCreated");

        CFGCashXMsgRspnHandler xmsgRspnHandler = (CFGCashXMsgRspnHandler) getParser();
        if (xmsgRspnHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGCashSchemaObj 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("AccountId")) {
                if (attrAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryId")) {
                if (attrEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("SplitEntryId")) {
                if (attrSplitEntryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrSplitEntryId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("EntryStamp")) {
                if (attrEntryStamp != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrEntryStamp = 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("TransferTenantId")) {
                if (attrTransferTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TransferAccountId")) {
                if (attrTransferAccountId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTransferAccountId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("DebitCurrencyId")) {
                if (attrDebitCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebitCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Debit")) {
                if (attrDebit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrDebit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("CreditCurrencyId")) {
                if (attrCreditCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCreditCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Credit")) {
                if (attrCredit != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrCredit = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedCurrencyId")) {
                if (attrConvertedCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ConvertedAmount")) {
                if (attrConvertedAmount != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrConvertedAmount = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BalanceCurrencyId")) {
                if (attrBalanceCurrencyId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalanceCurrencyId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("Balance")) {
                if (attrBalance != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBalance = 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 ((attrAccountId == null) || (attrAccountId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "AccountId");
        }
        if ((attrEntryId == null) || (attrEntryId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryId");
        }
        if ((attrEntryStamp == null) || (attrEntryStamp.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp");
        }
        if (attrDescription == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Description");
        }
        if ((attrConvertedCurrencyId == null) || (attrConvertedCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedCurrencyId");
        }
        if ((attrConvertedAmount == null) || (attrConvertedAmount.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ConvertedAmount");
        }
        if ((attrBalanceCurrencyId == null) || (attrBalanceCurrencyId.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BalanceCurrencyId");
        }
        if ((attrBalance == null) || (attrBalance.length() <= 0)) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "Balance");
        }
        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 natAccountId = Long.parseLong(attrAccountId);

        UUID natEntryId = UUID.fromString(attrEntryId);

        UUID natSplitEntryId;
        if ((attrSplitEntryId == null) || (attrSplitEntryId.length() <= 0)) {
            natSplitEntryId = null;
        } else {
            natSplitEntryId = UUID.fromString(attrSplitEntryId);
        }

        Calendar natEntryStamp;
        try {
            natEntryStamp = CFLibXmlUtil.parseTimestamp(attrEntryStamp);
        } catch (RuntimeException e) {
            throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0,
                    "EntryStamp", attrEntryStamp, e);
        }

        String natDescription = attrDescription;

        Long natTransferTenantId;
        if ((attrTransferTenantId == null) || (attrTransferTenantId.length() <= 0)) {
            natTransferTenantId = null;
        } else {
            natTransferTenantId = new Long(Long.parseLong(attrTransferTenantId));
        }

        Long natTransferAccountId;
        if ((attrTransferAccountId == null) || (attrTransferAccountId.length() <= 0)) {
            natTransferAccountId = null;
        } else {
            natTransferAccountId = new Long(Long.parseLong(attrTransferAccountId));
        }

        Short natDebitCurrencyId;
        if ((attrDebitCurrencyId == null) || (attrDebitCurrencyId.length() <= 0)) {
            natDebitCurrencyId = null;
        } else {
            natDebitCurrencyId = new Short(Short.parseShort(attrDebitCurrencyId));
        }

        BigDecimal natDebit;
        if ((attrDebit == null) || (attrDebit.length() <= 0)) {
            natDebit = null;
        } else {
            natDebit = new BigDecimal(attrDebit);
        }

        Short natCreditCurrencyId;
        if ((attrCreditCurrencyId == null) || (attrCreditCurrencyId.length() <= 0)) {
            natCreditCurrencyId = null;
        } else {
            natCreditCurrencyId = new Short(Short.parseShort(attrCreditCurrencyId));
        }

        BigDecimal natCredit;
        if ((attrCredit == null) || (attrCredit.length() <= 0)) {
            natCredit = null;
        } else {
            natCredit = new BigDecimal(attrCredit);
        }

        short natConvertedCurrencyId = Short.parseShort(attrConvertedCurrencyId);

        BigDecimal natConvertedAmount = new BigDecimal(attrConvertedAmount);

        short natBalanceCurrencyId = Short.parseShort(attrBalanceCurrencyId);

        BigDecimal natBalance = new BigDecimal(attrBalance);

        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
        ICFGCashAccountEntryObj obj = schemaObj.getAccountEntryTableObj().newInstance();
        CFGCashAccountEntryBuff dataBuff = obj.getAccountEntryBuff();
        dataBuff.setRequiredTenantId(natTenantId);
        dataBuff.setRequiredAccountId(natAccountId);
        dataBuff.setRequiredEntryId(natEntryId);
        dataBuff.setOptionalSplitEntryId(natSplitEntryId);
        dataBuff.setRequiredEntryStamp(natEntryStamp);
        dataBuff.setRequiredDescription(natDescription);
        dataBuff.setOptionalTransferTenantId(natTransferTenantId);
        dataBuff.setOptionalTransferAccountId(natTransferAccountId);
        dataBuff.setOptionalDebitCurrencyId(natDebitCurrencyId);
        dataBuff.setOptionalDebit(natDebit);
        dataBuff.setOptionalCreditCurrencyId(natCreditCurrencyId);
        dataBuff.setOptionalCredit(natCredit);
        dataBuff.setRequiredConvertedCurrencyId(natConvertedCurrencyId);
        dataBuff.setRequiredConvertedAmount(natConvertedAmount);
        dataBuff.setRequiredBalanceCurrencyId(natBalanceCurrencyId);
        dataBuff.setRequiredBalance(natBalance);
        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();
        ICFGCashAccountEntryObj realized = (ICFGCashAccountEntryObj) 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);
    }
}