public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support // ISOCountry Attributes String attrISOCode = null; String attrName = null; // ISOCountry References // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("ISOCountry"); CFBamSaxLoader saxLoader = (CFBamSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFBamISOCountryEditObj editBuff = (ICFBamISOCountryEditObj) schemaObj.getISOCountryTableObj().newInstance().beginEdit(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCode")) { if (attrISOCode != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrISOCode == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCode"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("ISOCode", attrISOCode); curContext.putNamedValue("Name", attrName); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natId; natId = Short.parseShort(attrId); editBuff.getPKey().setRequiredId(natId); editBuff.getISOCountryBuff().setRequiredId(natId); String natISOCode = attrISOCode; editBuff.setRequiredISOCode(natISOCode); String natName = attrName; editBuff.setRequiredName(natName); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } CFBamSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getISOCountryLoaderBehaviour(); ICFBamISOCountryEditObj editISOCountry = null; ICFBamISOCountryObj origISOCountry = (ICFBamISOCountryObj) schemaObj .getISOCountryTableObj() .readISOCountryByISOCodeIdx(editBuff.getRequiredISOCode()); editBuff.getPKey().setRequiredId(natId); editBuff.getISOCountryBuff().setRequiredId(natId); if (origISOCountry == null) { editISOCountry = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editISOCountry = (ICFBamISOCountryEditObj) origISOCountry.beginEdit(); editISOCountry.setRequiredISOCode(editBuff.getRequiredISOCode()); editISOCountry.setRequiredName(editBuff.getRequiredName()); break; case Replace: editISOCountry = (ICFBamISOCountryEditObj) origISOCountry.beginEdit(); editISOCountry.delete(); editISOCountry.endEdit(); origISOCountry = null; editISOCountry = editBuff; break; } } if (editISOCountry != null) { if (origISOCountry != null) { editISOCountry.update(); } else { origISOCountry = (ICFBamISOCountryObj) editISOCountry.create(); } editISOCountry.endEdit(); } curContext.putNamedValue("Object", origISOCountry); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // TSecGroupMember Attributes String attrUser = null; // TSecGroupMember References ICFBamTenantObj refTenant = null; ICFBamTSecGroupObj refGroup = null; ICFBamSecUserObj refUser = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("TSecGroupMember"); CFBamSaxLoader saxLoader = (CFBamSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFBamTSecGroupMemberEditObj editBuff = (ICFBamTSecGroupMemberEditObj) schemaObj.getTSecGroupMemberTableObj().newInstance().beginEdit(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("User")) { if (attrUser != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUser = 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 ((attrUser == null) || (attrUser.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "User"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("User", attrUser); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } // Resolve and apply required Container reference if (scopeObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj"); } else if (scopeObj instanceof ICFBamTSecGroupObj) { refGroup = (ICFBamTSecGroupObj) scopeObj; editBuff.setRequiredContainerGroup(refGroup); refTenant = (ICFBamTenantObj) editBuff.getRequiredOwnerTenant(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFBamTSecGroupObj"); } // Resolve and apply Owner reference if (refTenant == null) { if (scopeObj instanceof ICFBamTenantObj) { refTenant = (ICFBamTenantObj) scopeObj; editBuff.setRequiredOwnerTenant(refTenant); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>"); } } // Lookup refUser by key name value attr if ((attrUser != null) && (attrUser.length() > 0)) { refUser = (ICFBamSecUserObj) schemaObj.getSecUserTableObj().readSecUserByULoginIdx(attrUser); if (refUser == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve User reference named \"" + attrUser + "\" to table SecUser"); } } else { refUser = null; } editBuff.setRequiredParentUser(refUser); ICFBamTSecGroupMemberObj origTSecGroupMember; ICFBamTSecGroupMemberEditObj editTSecGroupMember = editBuff; origTSecGroupMember = (ICFBamTSecGroupMemberObj) editTSecGroupMember.create(); editTSecGroupMember.endEdit(); curContext.putNamedValue("Object", origTSecGroupMember); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // Value Attributes String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrGenerateId = null; String attrDefaultVisibility = null; String attrDefSchema = null; String attrDataScope = null; String attrVAccSec = null; String attrEAccSec = null; String attrVAccFreq = null; String attrEAccFreq = null; // Value References ICFBamTenantObj refTenant = null; ICFBamScopeObj refScope = null; ICFBamSchemaDefObj refDefSchema = null; ICFBamDataScopeObj refDataScope = null; ICFBamAccessSecurityObj refVAccSec = null; ICFBamAccessSecurityObj refEAccSec = null; ICFBamAccessFrequencyObj refVAccFreq = null; ICFBamAccessFrequencyObj refEAccFreq = null; // Atom Attributes String attrDbName = null; // Atom References // NumberDef Attributes String attrDigits = null; String attrPrecis = null; String attrInitValue = null; String attrDefaultValue = null; String attrMinValue = null; String attrMaxValue = null; String attrNullValue = null; String attrUnknownValue = null; // NumberDef References // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("NumberDef"); CFBamSaxLoader saxLoader = (CFBamSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFBamNumberDefEditObj editBuff = (ICFBamNumberDefEditObj) schemaObj.getNumberDefTableObj().newInstance().beginEdit(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenerateId")) { if (attrGenerateId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerateId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchema")) { if (attrDefSchema != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchema = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DataScope")) { if (attrDataScope != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScope = attrs.getValue(idxAttr); } else if (attrLocalName.equals("VAccSec")) { if (attrVAccSec != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrVAccSec = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EAccSec")) { if (attrEAccSec != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEAccSec = attrs.getValue(idxAttr); } else if (attrLocalName.equals("VAccFreq")) { if (attrVAccFreq != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrVAccFreq = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EAccFreq")) { if (attrEAccFreq != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEAccFreq = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Digits")) { if (attrDigits != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDigits = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Precis")) { if (attrPrecis != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrecis = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InitValue")) { if (attrInitValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInitValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultValue")) { if (attrDefaultValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MinValue")) { if (attrMinValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMinValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxValue")) { if (attrMaxValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NullValue")) { if (attrNullValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNullValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnknownValue")) { if (attrUnknownValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnknownValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } if ((attrDigits == null) || (attrDigits.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Digits"); } if ((attrPrecis == null) || (attrPrecis.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Precis"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("Name", attrName); curContext.putNamedValue("ShortName", attrShortName); curContext.putNamedValue("Label", attrLabel); curContext.putNamedValue("ShortDescription", attrShortDescription); curContext.putNamedValue("Description", attrDescription); curContext.putNamedValue("IsNullable", attrIsNullable); curContext.putNamedValue("GenerateId", attrGenerateId); curContext.putNamedValue("DefaultVisibility", attrDefaultVisibility); curContext.putNamedValue("DefSchema", attrDefSchema); curContext.putNamedValue("DataScope", attrDataScope); curContext.putNamedValue("VAccSec", attrVAccSec); curContext.putNamedValue("EAccSec", attrEAccSec); curContext.putNamedValue("VAccFreq", attrVAccFreq); curContext.putNamedValue("EAccFreq", attrEAccFreq); curContext.putNamedValue("DbName", attrDbName); curContext.putNamedValue("Digits", attrDigits); curContext.putNamedValue("Precis", attrPrecis); curContext.putNamedValue("InitValue", attrInitValue); curContext.putNamedValue("DefaultValue", attrDefaultValue); curContext.putNamedValue("MinValue", attrMinValue); curContext.putNamedValue("MaxValue", attrMaxValue); curContext.putNamedValue("NullValue", attrNullValue); curContext.putNamedValue("UnknownValue", attrUnknownValue); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } String natName = attrName; editBuff.setRequiredName(natName); String natShortName = attrShortName; editBuff.setOptionalShortName(natShortName); String natLabel = attrLabel; editBuff.setOptionalLabel(natLabel); String natShortDescription = attrShortDescription; editBuff.setOptionalShortDescription(natShortDescription); String natDescription = attrDescription; editBuff.setOptionalDescription(natDescription); boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } editBuff.setRequiredIsNullable(natIsNullable); Boolean natGenerateId; if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) { natGenerateId = null; } else if (attrGenerateId.equals("true") || attrGenerateId.equals("yes") || attrGenerateId.equals("1")) { natGenerateId = true; } else if (attrGenerateId.equals("false") || attrGenerateId.equals("no") || attrGenerateId.equals("0")) { natGenerateId = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerateId + "\""); } editBuff.setOptionalGenerateId(natGenerateId); boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } editBuff.setRequiredDefaultVisibility(natDefaultVisibility); String natDbName = attrDbName; editBuff.setOptionalDbName(natDbName); short natDigits = Short.parseShort(attrDigits); editBuff.setRequiredDigits(natDigits); short natPrecis = Short.parseShort(attrPrecis); editBuff.setRequiredPrecis(natPrecis); BigDecimal natInitValue; if ((attrInitValue == null) || (attrInitValue.length() <= 0)) { natInitValue = null; } else { natInitValue = new BigDecimal(attrInitValue); } editBuff.setOptionalInitValue(natInitValue); BigDecimal natDefaultValue; if ((attrDefaultValue == null) || (attrDefaultValue.length() <= 0)) { natDefaultValue = null; } else { natDefaultValue = new BigDecimal(attrDefaultValue); } editBuff.setOptionalDefaultValue(natDefaultValue); BigDecimal natMinValue; if ((attrMinValue == null) || (attrMinValue.length() <= 0)) { natMinValue = null; } else { natMinValue = new BigDecimal(attrMinValue); } editBuff.setOptionalMinValue(natMinValue); BigDecimal natMaxValue; if ((attrMaxValue == null) || (attrMaxValue.length() <= 0)) { natMaxValue = null; } else { natMaxValue = new BigDecimal(attrMaxValue); } editBuff.setOptionalMaxValue(natMaxValue); BigDecimal natNullValue; if ((attrNullValue == null) || (attrNullValue.length() <= 0)) { natNullValue = null; } else { natNullValue = new BigDecimal(attrNullValue); } editBuff.setOptionalNullValue(natNullValue); BigDecimal natUnknownValue; if ((attrUnknownValue == null) || (attrUnknownValue.length() <= 0)) { natUnknownValue = null; } else { natUnknownValue = new BigDecimal(attrUnknownValue); } editBuff.setOptionalUnknownValue(natUnknownValue); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } // Resolve and apply required Container reference if (scopeObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj"); } else if (scopeObj instanceof ICFBamScopeObj) { refScope = (ICFBamScopeObj) scopeObj; editBuff.setRequiredContainerScope(refScope); refTenant = (ICFBamTenantObj) editBuff.getRequiredOwnerTenant(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFBamScopeObj"); } // Resolve and apply Owner reference if (refTenant == null) { if (scopeObj instanceof ICFBamTenantObj) { refTenant = (ICFBamTenantObj) scopeObj; editBuff.setRequiredOwnerTenant(refTenant); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>"); } } // Lookup refDefSchema by qualified name if ((attrDefSchema != null) && (attrDefSchema.length() > 0)) { refDefSchema = (ICFBamSchemaDefObj) (editBuff.getNamedObject( schemaObj.getSchemaDefTableObj().getObjQualifyingClass(), attrDefSchema)); if (refDefSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve DefSchema reference qualified name \"" + attrDefSchema + "\" to table SchemaDef"); } } else { refDefSchema = null; } editBuff.setOptionalLookupDefSchema(refDefSchema); // Lookup refDataScope by key name value attr if ((attrDataScope != null) && (attrDataScope.length() > 0)) { refDataScope = (ICFBamDataScopeObj) schemaObj.getDataScopeTableObj().readDataScopeByUNameIdx(attrDataScope); if (refDataScope == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve DataScope reference named \"" + attrDataScope + "\" to table DataScope"); } } else { refDataScope = null; } editBuff.setOptionalLookupDataScope(refDataScope); // Lookup refVAccSec by key name value attr if ((attrVAccSec != null) && (attrVAccSec.length() > 0)) { refVAccSec = (ICFBamAccessSecurityObj) schemaObj.getAccessSecurityTableObj().readAccessSecurityByUNameIdx(attrVAccSec); if (refVAccSec == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve VAccSec reference named \"" + attrVAccSec + "\" to table AccessSecurity"); } } else { refVAccSec = null; } editBuff.setOptionalLookupVAccSec(refVAccSec); // Lookup refEAccSec by key name value attr if ((attrEAccSec != null) && (attrEAccSec.length() > 0)) { refEAccSec = (ICFBamAccessSecurityObj) schemaObj.getAccessSecurityTableObj().readAccessSecurityByUNameIdx(attrEAccSec); if (refEAccSec == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve EAccSec reference named \"" + attrEAccSec + "\" to table AccessSecurity"); } } else { refEAccSec = null; } editBuff.setOptionalLookupEAccSec(refEAccSec); // Lookup refVAccFreq by key name value attr if ((attrVAccFreq != null) && (attrVAccFreq.length() > 0)) { refVAccFreq = (ICFBamAccessFrequencyObj) schemaObj.getAccessFrequencyTableObj().readAccessFrequencyByUNameIdx(attrVAccFreq); if (refVAccFreq == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve VAccFreq reference named \"" + attrVAccFreq + "\" to table AccessFrequency"); } } else { refVAccFreq = null; } editBuff.setOptionalLookupVAccFreq(refVAccFreq); // Lookup refEAccFreq by key name value attr if ((attrEAccFreq != null) && (attrEAccFreq.length() > 0)) { refEAccFreq = (ICFBamAccessFrequencyObj) schemaObj.getAccessFrequencyTableObj().readAccessFrequencyByUNameIdx(attrEAccFreq); if (refEAccFreq == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve EAccFreq reference named \"" + attrEAccFreq + "\" to table AccessFrequency"); } } else { refEAccFreq = null; } editBuff.setOptionalLookupEAccFreq(refEAccFreq); CFBamSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getNumberDefLoaderBehaviour(); ICFBamNumberDefEditObj editNumberDef = null; ICFBamNumberDefObj origNumberDef = (ICFBamNumberDefObj) schemaObj .getNumberDefTableObj() .readNumberDefByUNameIdx( refTenant.getRequiredId(), refScope.getRequiredId(), editBuff.getRequiredName()); if (origNumberDef == null) { editNumberDef = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editNumberDef = (ICFBamNumberDefEditObj) origNumberDef.beginEdit(); editNumberDef.setRequiredName(editBuff.getRequiredName()); editNumberDef.setOptionalShortName(editBuff.getOptionalShortName()); editNumberDef.setOptionalLabel(editBuff.getOptionalLabel()); editNumberDef.setOptionalShortDescription(editBuff.getOptionalShortDescription()); editNumberDef.setOptionalDescription(editBuff.getOptionalDescription()); editNumberDef.setRequiredIsNullable(editBuff.getRequiredIsNullable()); editNumberDef.setOptionalGenerateId(editBuff.getOptionalGenerateId()); editNumberDef.setRequiredDefaultVisibility(editBuff.getRequiredDefaultVisibility()); editNumberDef.setOptionalDbName(editBuff.getOptionalDbName()); editNumberDef.setRequiredDigits(editBuff.getRequiredDigits()); editNumberDef.setRequiredPrecis(editBuff.getRequiredPrecis()); editNumberDef.setOptionalInitValue(editBuff.getOptionalInitValue()); editNumberDef.setOptionalDefaultValue(editBuff.getOptionalDefaultValue()); editNumberDef.setOptionalMinValue(editBuff.getOptionalMinValue()); editNumberDef.setOptionalMaxValue(editBuff.getOptionalMaxValue()); editNumberDef.setOptionalNullValue(editBuff.getOptionalNullValue()); editNumberDef.setOptionalUnknownValue(editBuff.getOptionalUnknownValue()); editNumberDef.setOptionalLookupDefSchema(editBuff.getOptionalLookupDefSchema()); editNumberDef.setOptionalLookupDataScope(editBuff.getOptionalLookupDataScope()); editNumberDef.setOptionalLookupVAccSec(editBuff.getOptionalLookupVAccSec()); editNumberDef.setOptionalLookupEAccSec(editBuff.getOptionalLookupEAccSec()); editNumberDef.setOptionalLookupVAccFreq(editBuff.getOptionalLookupVAccFreq()); editNumberDef.setOptionalLookupEAccFreq(editBuff.getOptionalLookupEAccFreq()); break; case Replace: editNumberDef = (ICFBamNumberDefEditObj) origNumberDef.beginEdit(); editNumberDef.delete(); editNumberDef.endEdit(); origNumberDef = null; editNumberDef = editBuff; break; } } if (editNumberDef != null) { if (origNumberDef != null) { editNumberDef.update(); } else { origNumberDef = (ICFBamNumberDefObj) editNumberDef.create(); } editNumberDef.endEdit(); } curContext.putNamedValue("Object", origNumberDef); } 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); } }