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; // 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; // 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 // TZTimeDef Attributes String attrInitValue = null; String attrDefaultValue = null; String attrNullValue = null; String attrUnknownValue = null; // TZTimeDef References // TZTimeType Attributes // TZTimeType References ICFBamSchemaDefObj refSchemaDef = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("TZTimeType"); 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 ICFBamTZTimeTypeEditObj editBuff = (ICFBamTZTimeTypeEditObj) schemaObj.getTZTimeTypeTableObj().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("InitValue")) { if (attrInitValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInitValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultValue")) { if (attrDefaultValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NullValue")) { if (attrNullValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNullValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnknownValue")) { if (attrUnknownValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnknownValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("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"); } // 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("InitValue", attrInitValue); curContext.putNamedValue("DefaultValue", attrDefaultValue); 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); Calendar natInitValue; if ((attrInitValue == null) || (attrInitValue.length() <= 0)) { natInitValue = null; } else { try { natInitValue = CFLibXmlUtil.parseTZTime(attrInitValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "InitValue", attrInitValue, e); } } editBuff.setOptionalInitValue(natInitValue); Calendar natDefaultValue; if ((attrDefaultValue == null) || (attrDefaultValue.length() <= 0)) { natDefaultValue = null; } else { try { natDefaultValue = CFLibXmlUtil.parseTZTime(attrDefaultValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "DefaultValue", attrDefaultValue, e); } } editBuff.setOptionalDefaultValue(natDefaultValue); Calendar natNullValue; if ((attrNullValue == null) || (attrNullValue.length() <= 0)) { natNullValue = null; } else { try { natNullValue = CFLibXmlUtil.parseTZTime(attrNullValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "NullValue", attrNullValue, e); } } editBuff.setOptionalNullValue(natNullValue); Calendar natUnknownValue; if ((attrUnknownValue == null) || (attrUnknownValue.length() <= 0)) { natUnknownValue = null; } else { try { natUnknownValue = CFLibXmlUtil.parseTZTime(attrUnknownValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "UnknownValue", attrUnknownValue, e); } } 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 ICFBamSchemaDefObj) { refSchemaDef = (ICFBamSchemaDefObj) scopeObj; editBuff.setRequiredContainerSchemaDef(refSchemaDef); refTenant = (ICFBamTenantObj) editBuff.getRequiredOwnerTenant(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFBamSchemaDefObj"); } // 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>"); } } refScope = refSchemaDef; // 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.getTZTimeTypeLoaderBehaviour(); ICFBamTZTimeTypeEditObj editTZTimeType = null; ICFBamTZTimeTypeObj origTZTimeType = (ICFBamTZTimeTypeObj) schemaObj .getTZTimeTypeTableObj() .readTZTimeTypeByUNameIdx( refTenant.getRequiredId(), refScope.getRequiredId(), editBuff.getRequiredName()); if (origTZTimeType == null) { editTZTimeType = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editTZTimeType = (ICFBamTZTimeTypeEditObj) origTZTimeType.beginEdit(); editTZTimeType.setRequiredName(editBuff.getRequiredName()); editTZTimeType.setOptionalShortName(editBuff.getOptionalShortName()); editTZTimeType.setOptionalLabel(editBuff.getOptionalLabel()); editTZTimeType.setOptionalShortDescription(editBuff.getOptionalShortDescription()); editTZTimeType.setOptionalDescription(editBuff.getOptionalDescription()); editTZTimeType.setRequiredIsNullable(editBuff.getRequiredIsNullable()); editTZTimeType.setOptionalGenerateId(editBuff.getOptionalGenerateId()); editTZTimeType.setRequiredDefaultVisibility(editBuff.getRequiredDefaultVisibility()); editTZTimeType.setOptionalDbName(editBuff.getOptionalDbName()); editTZTimeType.setOptionalInitValue(editBuff.getOptionalInitValue()); editTZTimeType.setOptionalDefaultValue(editBuff.getOptionalDefaultValue()); editTZTimeType.setOptionalNullValue(editBuff.getOptionalNullValue()); editTZTimeType.setOptionalUnknownValue(editBuff.getOptionalUnknownValue()); editTZTimeType.setOptionalLookupDefSchema(editBuff.getOptionalLookupDefSchema()); editTZTimeType.setOptionalLookupDataScope(editBuff.getOptionalLookupDataScope()); editTZTimeType.setOptionalLookupVAccSec(editBuff.getOptionalLookupVAccSec()); editTZTimeType.setOptionalLookupEAccSec(editBuff.getOptionalLookupEAccSec()); editTZTimeType.setOptionalLookupVAccFreq(editBuff.getOptionalLookupVAccFreq()); editTZTimeType.setOptionalLookupEAccFreq(editBuff.getOptionalLookupEAccFreq()); break; case Replace: editTZTimeType = (ICFBamTZTimeTypeEditObj) origTZTimeType.beginEdit(); editTZTimeType.delete(); editTZTimeType.endEdit(); origTZTimeType = null; editTZTimeType = editBuff; break; } } if (editTZTimeType != null) { if (origTZTimeType != null) { editTZTimeType.update(); } else { origTZTimeType = (ICFBamTZTimeTypeObj) editTZTimeType.create(); } editTZTimeType.endEdit(); } curContext.putNamedValue("Object", origTZTimeType); } 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; // DomainBase Attributes String attrDescription = null; // DomainBase References ICFBamTenantObj refTenant = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("DomainBase"); 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 ICFBamDomainBaseEditObj editBuff = (ICFBamDomainBaseEditObj) schemaObj.getDomainBaseTableObj().newInstance().beginEdit(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("Description", attrDescription); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } String natDescription = attrDescription; editBuff.setOptionalDescription(natDescription); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } refTenant = null; // 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>"); } } ICFBamDomainBaseObj origDomainBase; ICFBamDomainBaseEditObj editDomainBase = editBuff; origDomainBase = (ICFBamDomainBaseObj) editDomainBase.create(); editDomainBase.endEdit(); curContext.putNamedValue("Object", origDomainBase); } 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; // Scope Attributes // Scope References ICFBamTenantObj refTenant = null; // DelDep Attributes String attrRelation = null; String attrDefSchema = null; // DelDep References ICFBamRelationObj refRelation = null; ICFBamSchemaDefObj refDefSchema = null; // DelSubDep2 Attributes String attrName = null; // DelSubDep2 References ICFBamDelSubDep1Obj refContDelSubDep1 = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("DelSubDep2"); 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 ICFBamDelSubDep2EditObj editBuff = (ICFBamDelSubDep2EditObj) schemaObj.getDelSubDep2TableObj().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("Relation")) { if (attrRelation != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRelation = 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("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 ((attrRelation == null) || (attrRelation.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Relation"); } 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("Relation", attrRelation); curContext.putNamedValue("DefSchema", attrDefSchema); curContext.putNamedValue("Name", attrName); // 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); // 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 ICFBamDelSubDep1Obj) { refContDelSubDep1 = (ICFBamDelSubDep1Obj) scopeObj; editBuff.setRequiredContainerContDelSubDep1(refContDelSubDep1); refTenant = (ICFBamTenantObj) editBuff.getRequiredOwnerTenant(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFBamDelSubDep1Obj"); } // 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 refRelation by qualified name if ((attrRelation != null) && (attrRelation.length() > 0)) { refRelation = (ICFBamRelationObj) (editBuff.getNamedObject( schemaObj.getRelationTableObj().getObjQualifyingClass(), attrRelation)); if (refRelation == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve Relation reference qualified name \"" + attrRelation + "\" to table Relation"); } } else { refRelation = null; } editBuff.setRequiredLookupRelation(refRelation); // 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); ICFBamDelSubDep2Obj origDelSubDep2; ICFBamDelSubDep2EditObj editDelSubDep2 = editBuff; origDelSubDep2 = (ICFBamDelSubDep2Obj) editDelSubDep2.create(); editDelSubDep2.endEdit(); curContext.putNamedValue("Object", origDelSubDep2); } 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); } }