public static Enum<?> setUpEnumAttribute(Scanner scan, Attributes.AttributeEnum attribute) { int num; Attributes.printEnumNValuesOfEnumAttribute(attribute); num = makeSureValInRange( scan, 1, Attributes.getEnumAttrValues(attribute).length, attribute.toString(), ValType.INTEGER, true, true) .intValue(); Enum<?> attr = Attributes.getEnumAttrByVal(num, attribute); System.out.println( inputString(attr.getClass().getSimpleName(), attr.toString(), StringOption.SELECTED, true)); return attr; }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFInternetXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // SecSession Attributes String attrSecSessionId = null; String attrSecUserId = null; String attrSecDevName = null; String attrStart = null; String attrFinish = null; String attrSecProxyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecSessionCreate"); CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFInternetSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFInternetSecSessionEditObj editBuff = (ICFInternetSecSessionEditObj) schemaObj.getSecSessionTableObj().newInstance().beginEdit(); CFSecuritySecSessionBuff dataBuff = (CFSecuritySecSessionBuff) editBuff.getSecSessionBuff(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecSessionId")) { if (attrSecSessionId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecSessionId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecUserId")) { if (attrSecUserId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecUserId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecDevName")) { if (attrSecDevName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecDevName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Start")) { if (attrStart != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrStart = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Finish")) { if (attrFinish != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFinish = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecProxyId")) { if (attrSecProxyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecProxyId = attrs.getValue(idxAttr); } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecSessionId"); } if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecUserId"); } if ((attrStart == null) || (attrStart.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Start"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natSecUserId = UUID.fromString(attrSecUserId); dataBuff.setRequiredSecUserId(natSecUserId); String natSecDevName = attrSecDevName; dataBuff.setOptionalSecDevName(natSecDevName); Calendar natStart; try { natStart = CFLibXmlUtil.parseTimestamp(attrStart); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException(getClass(), S_ProcName, 0, "Start", attrStart, e); } dataBuff.setRequiredStart(natStart); Calendar natFinish; if ((attrFinish == null) || (attrFinish.length() <= 0)) { natFinish = null; } else { try { natFinish = CFLibXmlUtil.parseTimestamp(attrFinish); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException(getClass(), S_ProcName, 0, "Finish", attrFinish, e); } } dataBuff.setOptionalFinish(natFinish); UUID natSecProxyId; if ((attrSecProxyId == null) || (attrSecProxyId.length() <= 0)) { natSecProxyId = null; } else { natSecProxyId = UUID.fromString(attrSecProxyId); } dataBuff.setOptionalSecProxyId(natSecProxyId); // Attempt the create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFInternetSecSessionObj created = (ICFInternetSecSessionObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSecSessionMessageFormatter.formatSecSessionRspnCreated( "\n\t\t\t", created.getSecSessionBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrTenantId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstInt64ColDelete"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFBamValuePKey pkey = schemaObj.getBackingStore().getFactoryValue().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); pkey.setRequiredId(natId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFBamInt64ColObj read = schemaObj.getInt64ColTableObj().readInt64Col(pkey); if (read != null) { if (read.getInt64ColBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete Int64Col"); } else { ICFBamInt64ColEditObj editBuff = (ICFBamInt64ColEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgInt64ColMessageFormatter.formatInt64ColRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnRelationDeleted"); CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("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); // Convert string attributes to native Java types xmsgRspnHandler.setDeleted(true); } 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; // SecApp Attributes String attrJEEMountName = null; // SecApp References ICFDbTestClusterObj refCluster = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("SecApp"); CFDbTestSaxLoader saxLoader = (CFDbTestSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFDbTestSecAppEditObj editBuff = (ICFDbTestSecAppEditObj) schemaObj.getSecAppTableObj().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("JEEMountName")) { if (attrJEEMountName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrJEEMountName = 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 (attrJEEMountName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "JEEMountName"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("JEEMountName", attrJEEMountName); // 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 natJEEMountName = attrJEEMountName; editBuff.setRequiredJEEMountName(natJEEMountName); // 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 ICFDbTestClusterObj) { refCluster = (ICFDbTestClusterObj) scopeObj; editBuff.setRequiredContainerCluster(refCluster); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFDbTestClusterObj"); } CFDbTestSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getSecAppLoaderBehaviour(); ICFDbTestSecAppEditObj editSecApp = null; ICFDbTestSecAppObj origSecApp = (ICFDbTestSecAppObj) schemaObj .getSecAppTableObj() .readSecAppByUJEEMountIdx( refCluster.getRequiredId(), editBuff.getRequiredJEEMountName()); if (origSecApp == null) { editSecApp = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editSecApp = (ICFDbTestSecAppEditObj) origSecApp.beginEdit(); editSecApp.setRequiredJEEMountName(editBuff.getRequiredJEEMountName()); break; case Replace: editSecApp = (ICFDbTestSecAppEditObj) origSecApp.beginEdit(); editSecApp.delete(); editSecApp.endEdit(); origSecApp = null; editSecApp = editBuff; break; } } if (editSecApp != null) { if (origSecApp != null) { editSecApp.update(); } else { origSecApp = (ICFDbTestSecAppObj) editSecApp.create(); } editSecApp.endEdit(); } curContext.putNamedValue("Object", origSecApp); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstAccessFrequencyLock"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFBamAccessFrequencyPKey pkey = schemaObj.getBackingStore().getFactoryAccessFrequency().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natId; natId = Short.parseShort(attrId); pkey.setRequiredId(natId); pkey.setRequiredId(natId); // Lock the object ICFBamAccessFrequencyObj locked = schemaObj.getAccessFrequencyTableObj().lockAccessFrequency(pkey); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgAccessFrequencyMessageFormatter.formatAccessFrequencyRspnLocked( "\n\t\t\t", locked.getAccessFrequencyBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFSecurityXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // ISOCountryLanguage Attributes String attrISOCountryId = null; String attrISOLanguageId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstISOCountryLanguageCreate"); CFSecurityXMsgRqstHandler xmsgRqstHandler = (CFSecurityXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFSecuritySchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFSecurityISOCountryLanguageEditObj editBuff = (ICFSecurityISOCountryLanguageEditObj) schemaObj.getISOCountryLanguageTableObj().newInstance().beginEdit(); CFSecurityISOCountryLanguageBuff dataBuff = (CFSecurityISOCountryLanguageBuff) editBuff.getISOCountryLanguageBuff(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOLanguageId")) { if (attrISOLanguageId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOLanguageId = attrs.getValue(idxAttr); } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCountryId"); } if ((attrISOLanguageId == null) || (attrISOLanguageId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOLanguageId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natISOCountryId = Short.parseShort(attrISOCountryId); dataBuff.setRequiredISOCountryId(natISOCountryId); short natISOLanguageId = Short.parseShort(attrISOLanguageId); dataBuff.setRequiredISOLanguageId(natISOLanguageId); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } // Attempt the create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFSecurityISOCountryLanguageObj created = (ICFSecurityISOCountryLanguageObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgISOCountryLanguageMessageFormatter .formatISOCountryLanguageRspnCreated( "\n\t\t\t", created.getISOCountryLanguageBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFSecurityXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFSecurityXMsgRqstHandler xmsgRqstHandler = ((CFSecurityXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFSecurityXMsgRqstHandler xmsgRqstHandler = ((CFSecurityXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // OptMaxValue Attributes String attrDescription = null; String attrTestInt16 = null; String attrTestInt32 = null; String attrTestInt64 = null; String attrTestUInt16 = null; String attrTestUInt32 = null; String attrTestUInt64 = null; String attrTestFloat = null; String attrTestDouble = null; String attrTestNumber = null; String attrTestDate = null; String attrTestTimestamp = null; String attrTestTZDate = null; String attrTestTZTimestamp = null; // OptMaxValue References ICFDbTestTenantObj refTenant = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("OptMaxValue"); CFDbTestSaxLoader saxLoader = (CFDbTestSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFDbTestOptMaxValueEditObj editBuff = (ICFDbTestOptMaxValueEditObj) schemaObj.getOptMaxValueTableObj().newInstance().beginEdit(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt16")) { if (attrTestInt16 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt16 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt32")) { if (attrTestInt32 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt32 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt64")) { if (attrTestInt64 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt64 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt16")) { if (attrTestUInt16 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt16 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt32")) { if (attrTestUInt32 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt32 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt64")) { if (attrTestUInt64 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt64 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestFloat")) { if (attrTestFloat != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestFloat = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestDouble")) { if (attrTestDouble != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestDouble = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestNumber")) { if (attrTestNumber != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestNumber = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestDate")) { if (attrTestDate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestDate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTimestamp")) { if (attrTestTimestamp != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTimestamp = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTZDate")) { if (attrTestTZDate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTZDate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTZTimestamp")) { if (attrTestTZTimestamp != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTZTimestamp = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("Description", attrDescription); curContext.putNamedValue("TestInt16", attrTestInt16); curContext.putNamedValue("TestInt32", attrTestInt32); curContext.putNamedValue("TestInt64", attrTestInt64); curContext.putNamedValue("TestUInt16", attrTestUInt16); curContext.putNamedValue("TestUInt32", attrTestUInt32); curContext.putNamedValue("TestUInt64", attrTestUInt64); curContext.putNamedValue("TestFloat", attrTestFloat); curContext.putNamedValue("TestDouble", attrTestDouble); curContext.putNamedValue("TestNumber", attrTestNumber); curContext.putNamedValue("TestDate", attrTestDate); curContext.putNamedValue("TestTimestamp", attrTestTimestamp); curContext.putNamedValue("TestTZDate", attrTestTZDate); curContext.putNamedValue("TestTZTimestamp", attrTestTZTimestamp); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } String natDescription = attrDescription; editBuff.setRequiredDescription(natDescription); Short natTestInt16; if ((attrTestInt16 == null) || (attrTestInt16.length() <= 0)) { natTestInt16 = null; } else { natTestInt16 = new Short(Short.parseShort(attrTestInt16)); } editBuff.setOptionalTestInt16(natTestInt16); Integer natTestInt32; if ((attrTestInt32 == null) || (attrTestInt32.length() <= 0)) { natTestInt32 = null; } else { natTestInt32 = new Integer(Integer.parseInt(attrTestInt32)); } editBuff.setOptionalTestInt32(natTestInt32); Long natTestInt64; if ((attrTestInt64 == null) || (attrTestInt64.length() <= 0)) { natTestInt64 = null; } else { natTestInt64 = new Long(Long.parseLong(attrTestInt64)); } editBuff.setOptionalTestInt64(natTestInt64); Integer natTestUInt16; if ((attrTestUInt16 == null) || (attrTestUInt16.length() <= 0)) { natTestUInt16 = null; } else { natTestUInt16 = new Integer(Integer.parseInt(attrTestUInt16)); } editBuff.setOptionalTestUInt16(natTestUInt16); Long natTestUInt32; if ((attrTestUInt32 == null) || (attrTestUInt32.length() <= 0)) { natTestUInt32 = null; } else { natTestUInt32 = new Long(Long.parseLong(attrTestUInt32)); } editBuff.setOptionalTestUInt32(natTestUInt32); BigDecimal natTestUInt64; if ((attrTestUInt64 == null) || (attrTestUInt64.length() <= 0)) { natTestUInt64 = null; } else { natTestUInt64 = CFLibBigDecimalUtil.parse("CFDbTest.OptMaxValue.TestUInt64", 19, 0, attrTestUInt64); } editBuff.setOptionalTestUInt64(natTestUInt64); Float natTestFloat; if ((attrTestFloat == null) || (attrTestFloat.length() <= 0)) { natTestFloat = null; } else { natTestFloat = new Float(Float.parseFloat(attrTestFloat)); } editBuff.setOptionalTestFloat(natTestFloat); Double natTestDouble; if ((attrTestDouble == null) || (attrTestDouble.length() <= 0)) { natTestDouble = null; } else { natTestDouble = new Double(Double.parseDouble(attrTestDouble)); } editBuff.setOptionalTestDouble(natTestDouble); BigDecimal natTestNumber; if ((attrTestNumber == null) || (attrTestNumber.length() <= 0)) { natTestNumber = null; } else { natTestNumber = CFLibBigDecimalUtil.parse("CFDbTest.OptMaxValue.TestNumber", 20, 0, attrTestNumber); } editBuff.setOptionalTestNumber(natTestNumber); Calendar natTestDate; if ((attrTestDate == null) || (attrTestDate.length() <= 0)) { natTestDate = null; } else { try { natTestDate = CFLibXmlUtil.parseDate(attrTestDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException(getClass(), S_ProcName, 0, "TestDate", attrTestDate, e); } } editBuff.setOptionalTestDate(natTestDate); Calendar natTestTimestamp; if ((attrTestTimestamp == null) || (attrTestTimestamp.length() <= 0)) { natTestTimestamp = null; } else { try { natTestTimestamp = CFLibXmlUtil.parseTimestamp(attrTestTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTimestamp", attrTestTimestamp, e); } } editBuff.setOptionalTestTimestamp(natTestTimestamp); Calendar natTestTZDate; if ((attrTestTZDate == null) || (attrTestTZDate.length() <= 0)) { natTestTZDate = null; } else { try { natTestTZDate = CFLibXmlUtil.parseTZDate(attrTestTZDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZDate", attrTestTZDate, e); } } editBuff.setOptionalTestTZDate(natTestTZDate); Calendar natTestTZTimestamp; if ((attrTestTZTimestamp == null) || (attrTestTZTimestamp.length() <= 0)) { natTestTZTimestamp = null; } else { try { natTestTZTimestamp = CFLibXmlUtil.parseTZTimestamp(attrTestTZTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZTimestamp", attrTestTZTimestamp, e); } } editBuff.setOptionalTestTZTimestamp(natTestTZTimestamp); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } // Resolve and apply required Container reference if (scopeObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj"); } else if (scopeObj instanceof ICFDbTestTenantObj) { refTenant = (ICFDbTestTenantObj) scopeObj; editBuff.setRequiredContainerTenant(refTenant); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFDbTestTenantObj"); } CFDbTestSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getOptMaxValueLoaderBehaviour(); ICFDbTestOptMaxValueEditObj editOptMaxValue = null; ICFDbTestOptMaxValueObj origOptMaxValue = (ICFDbTestOptMaxValueObj) schemaObj .getOptMaxValueTableObj() .readOptMaxValueByUDescrIdx( refTenant.getRequiredId(), editBuff.getRequiredDescription()); if (origOptMaxValue == null) { editOptMaxValue = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editOptMaxValue = (ICFDbTestOptMaxValueEditObj) origOptMaxValue.beginEdit(); editOptMaxValue.setRequiredDescription(editBuff.getRequiredDescription()); editOptMaxValue.setOptionalTestInt16(editBuff.getOptionalTestInt16()); editOptMaxValue.setOptionalTestInt32(editBuff.getOptionalTestInt32()); editOptMaxValue.setOptionalTestInt64(editBuff.getOptionalTestInt64()); editOptMaxValue.setOptionalTestUInt16(editBuff.getOptionalTestUInt16()); editOptMaxValue.setOptionalTestUInt32(editBuff.getOptionalTestUInt32()); editOptMaxValue.setOptionalTestUInt64(editBuff.getOptionalTestUInt64()); editOptMaxValue.setOptionalTestFloat(editBuff.getOptionalTestFloat()); editOptMaxValue.setOptionalTestDouble(editBuff.getOptionalTestDouble()); editOptMaxValue.setOptionalTestNumber(editBuff.getOptionalTestNumber()); editOptMaxValue.setOptionalTestDate(editBuff.getOptionalTestDate()); editOptMaxValue.setOptionalTestTimestamp(editBuff.getOptionalTestTimestamp()); editOptMaxValue.setOptionalTestTZDate(editBuff.getOptionalTestTZDate()); editOptMaxValue.setOptionalTestTZTimestamp(editBuff.getOptionalTestTZTimestamp()); break; case Replace: editOptMaxValue = (ICFDbTestOptMaxValueEditObj) origOptMaxValue.beginEdit(); editOptMaxValue.delete(); editOptMaxValue.endEdit(); origOptMaxValue = null; editOptMaxValue = editBuff; break; } } if (editOptMaxValue != null) { if (origOptMaxValue != null) { editOptMaxValue.update(); } else { origOptMaxValue = (ICFDbTestOptMaxValueObj) editOptMaxValue.create(); } editOptMaxValue.endEdit(); } curContext.putNamedValue("Object", origOptMaxValue); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public 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; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTableTestClassObjFuncWithArgExecuted"); CFDbTestXMsgRspnHandler xmsgRspnHandler = (CFDbTestXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // FSSFDialer Attributes String attrTenantId = null; String attrFSSFDialerId = null; String attrFSSofiaId = null; String attrName = null; String attrPrefix = null; String attrSuffix = null; String attrTimeout = null; String attrErlangNode = null; String attrLocalPrefix = null; String attrLocalSuffix = null; String attrMessageSeconds = null; String attrCallbackHandoffMinutes = null; String attrWelcomeMsg = null; String attrInvalidExtensionMsg = null; String attrInvalidPINMsg = null; String attrInvalidResultCodeMsg = null; String attrPleaseEnterResultCodeMsg = null; String attrThankYouMsg = null; String attrPleaseEnterPINMsg = null; String attrSpoolMsgDir = null; String attrSpoolMsgPrefix = null; String attrSpoolMsgType = null; String attrRecordAllCalls = null; String attrAreaCode = null; String attrOutboundLines = 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("RspnFSSFDialerUpdated"); CFFreeSwitchXMsgRspnHandler xmsgRspnHandler = (CFFreeSwitchXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFFreeSwitchSchemaObj 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("FSSFDialerId")) { if (attrFSSFDialerId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFDialerId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FSSofiaId")) { if (attrFSSofiaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSofiaId = 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("Prefix")) { if (attrPrefix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrefix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Suffix")) { if (attrSuffix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSuffix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Timeout")) { if (attrTimeout != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTimeout = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ErlangNode")) { if (attrErlangNode != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrErlangNode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("LocalPrefix")) { if (attrLocalPrefix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLocalPrefix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("LocalSuffix")) { if (attrLocalSuffix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLocalSuffix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MessageSeconds")) { if (attrMessageSeconds != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMessageSeconds = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CallbackHandoffMinutes")) { if (attrCallbackHandoffMinutes != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCallbackHandoffMinutes = attrs.getValue(idxAttr); } else if (attrLocalName.equals("WelcomeMsg")) { if (attrWelcomeMsg != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrWelcomeMsg = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InvalidExtensionMsg")) { if (attrInvalidExtensionMsg != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInvalidExtensionMsg = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InvalidPINMsg")) { if (attrInvalidPINMsg != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInvalidPINMsg = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InvalidResultCodeMsg")) { if (attrInvalidResultCodeMsg != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInvalidResultCodeMsg = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PleaseEnterResultCodeMsg")) { if (attrPleaseEnterResultCodeMsg != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPleaseEnterResultCodeMsg = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ThankYouMsg")) { if (attrThankYouMsg != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrThankYouMsg = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PleaseEnterPINMsg")) { if (attrPleaseEnterPINMsg != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPleaseEnterPINMsg = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SpoolMsgDir")) { if (attrSpoolMsgDir != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSpoolMsgDir = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SpoolMsgPrefix")) { if (attrSpoolMsgPrefix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSpoolMsgPrefix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SpoolMsgType")) { if (attrSpoolMsgType != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSpoolMsgType = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RecordAllCalls")) { if (attrRecordAllCalls != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRecordAllCalls = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AreaCode")) { if (attrAreaCode != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAreaCode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("OutboundLines")) { if (attrOutboundLines != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrOutboundLines = 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 ((attrFSSFDialerId == null) || (attrFSSFDialerId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFDialerId"); } if ((attrFSSofiaId == null) || (attrFSSofiaId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSofiaId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if (attrPrefix == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Prefix"); } if (attrSuffix == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Suffix"); } if ((attrTimeout == null) || (attrTimeout.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Timeout"); } if (attrErlangNode == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ErlangNode"); } if (attrLocalPrefix == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "LocalPrefix"); } if (attrLocalSuffix == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "LocalSuffix"); } if ((attrMessageSeconds == null) || (attrMessageSeconds.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MessageSeconds"); } if ((attrCallbackHandoffMinutes == null) || (attrCallbackHandoffMinutes.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CallbackHandoffMinutes"); } if (attrWelcomeMsg == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "WelcomeMsg"); } if (attrInvalidExtensionMsg == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "InvalidExtensionMsg"); } if (attrInvalidPINMsg == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "InvalidPINMsg"); } if (attrInvalidResultCodeMsg == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "InvalidResultCodeMsg"); } if (attrPleaseEnterResultCodeMsg == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "PleaseEnterResultCodeMsg"); } if (attrThankYouMsg == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ThankYouMsg"); } if (attrPleaseEnterPINMsg == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "PleaseEnterPINMsg"); } if (attrSpoolMsgDir == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SpoolMsgDir"); } if (attrSpoolMsgPrefix == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SpoolMsgPrefix"); } if (attrSpoolMsgType == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SpoolMsgType"); } if ((attrRecordAllCalls == null) || (attrRecordAllCalls.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "RecordAllCalls"); } if (attrAreaCode == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AreaCode"); } if ((attrOutboundLines == null) || (attrOutboundLines.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "OutboundLines"); } 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 natFSSFDialerId = Long.parseLong(attrFSSFDialerId); long natFSSofiaId = Long.parseLong(attrFSSofiaId); String natName = attrName; String natPrefix = attrPrefix; String natSuffix = attrSuffix; int natTimeout = Integer.parseInt(attrTimeout); String natErlangNode = attrErlangNode; String natLocalPrefix = attrLocalPrefix; String natLocalSuffix = attrLocalSuffix; int natMessageSeconds = Integer.parseInt(attrMessageSeconds); int natCallbackHandoffMinutes = Integer.parseInt(attrCallbackHandoffMinutes); String natWelcomeMsg = attrWelcomeMsg; String natInvalidExtensionMsg = attrInvalidExtensionMsg; String natInvalidPINMsg = attrInvalidPINMsg; String natInvalidResultCodeMsg = attrInvalidResultCodeMsg; String natPleaseEnterResultCodeMsg = attrPleaseEnterResultCodeMsg; String natThankYouMsg = attrThankYouMsg; String natPleaseEnterPINMsg = attrPleaseEnterPINMsg; String natSpoolMsgDir = attrSpoolMsgDir; String natSpoolMsgPrefix = attrSpoolMsgPrefix; String natSpoolMsgType = attrSpoolMsgType; boolean natRecordAllCalls; if (attrRecordAllCalls.equals("true") || attrRecordAllCalls.equals("yes") || attrRecordAllCalls.equals("1")) { natRecordAllCalls = true; } else if (attrRecordAllCalls.equals("false") || attrRecordAllCalls.equals("no") || attrRecordAllCalls.equals("0")) { natRecordAllCalls = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected RecordAllCalls value, must be one of true, false, yes, no, 1, or 0, not \"" + attrRecordAllCalls + "\""); } String natAreaCode = attrAreaCode; int natOutboundLines = Integer.parseInt(attrOutboundLines); 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 ICFFreeSwitchFSSFDialerObj obj = (ICFFreeSwitchFSSFDialerObj) schemaObj.getFSSFDialerTableObj().newInstance(); CFFreeSwitchFSSFDialerBuff dataBuff = obj.getFSSFDialerBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredFSSFDialerId(natFSSFDialerId); dataBuff.setRequiredFSSofiaId(natFSSofiaId); dataBuff.setRequiredName(natName); dataBuff.setRequiredPrefix(natPrefix); dataBuff.setRequiredSuffix(natSuffix); dataBuff.setRequiredTimeout(natTimeout); dataBuff.setRequiredErlangNode(natErlangNode); dataBuff.setRequiredLocalPrefix(natLocalPrefix); dataBuff.setRequiredLocalSuffix(natLocalSuffix); dataBuff.setRequiredMessageSeconds(natMessageSeconds); dataBuff.setRequiredCallbackHandoffMinutes(natCallbackHandoffMinutes); dataBuff.setRequiredWelcomeMsg(natWelcomeMsg); dataBuff.setRequiredInvalidExtensionMsg(natInvalidExtensionMsg); dataBuff.setRequiredInvalidPINMsg(natInvalidPINMsg); dataBuff.setRequiredInvalidResultCodeMsg(natInvalidResultCodeMsg); dataBuff.setRequiredPleaseEnterResultCodeMsg(natPleaseEnterResultCodeMsg); dataBuff.setRequiredThankYouMsg(natThankYouMsg); dataBuff.setRequiredPleaseEnterPINMsg(natPleaseEnterPINMsg); dataBuff.setRequiredSpoolMsgDir(natSpoolMsgDir); dataBuff.setRequiredSpoolMsgPrefix(natSpoolMsgPrefix); dataBuff.setRequiredSpoolMsgType(natSpoolMsgType); dataBuff.setRequiredRecordAllCalls(natRecordAllCalls); dataBuff.setRequiredAreaCode(natAreaCode); dataBuff.setRequiredOutboundLines(natOutboundLines); 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(); ICFFreeSwitchFSSFDialerObj realized = (ICFFreeSwitchFSSFDialerObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // AuditAction Attributes String attrAuditActionId = null; String attrDescription = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnAuditActionLocked"); CFAccXMsgRspnHandler xmsgRspnHandler = (CFAccXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AuditActionId")) { if (attrAuditActionId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAuditActionId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrAuditActionId == null) || (attrAuditActionId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AuditActionId"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types short natAuditActionId = Short.parseShort(attrAuditActionId); String natDescription = attrDescription; int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFAccAuditActionObj obj = (ICFAccAuditActionObj) schemaObj.getAuditActionTableObj().newInstance(); CFSecurityAuditActionBuff dataBuff = obj.getAuditActionBuff(); dataBuff.setRequiredAuditActionId(natAuditActionId); dataBuff.setRequiredDescription(natDescription); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFAccAuditActionObj realized = (ICFAccAuditActionObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // AttachmentTag Attributes String attrTagValue = null; String attrTag = null; // AttachmentTag References ICFAccTenantObj refTenant = null; ICFAccAttachmentObj refContactAttach = null; ICFAccTagObj refTag = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("AttachmentTag"); CFAccSaxLoader saxLoader = (CFAccSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFAccAttachmentTagEditObj editBuff = (ICFAccAttachmentTagEditObj) schemaObj.getAttachmentTagTableObj().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("TagValue")) { if (attrTagValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTagValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Tag")) { if (attrTag != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTag = 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 (attrTagValue == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TagValue"); } if ((attrTag == null) || (attrTag.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Tag"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("TagValue", attrTagValue); curContext.putNamedValue("Tag", attrTag); // 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 natTagValue = attrTagValue; editBuff.setRequiredTagValue(natTagValue); // 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 ICFAccAttachmentObj) { refContactAttach = (ICFAccAttachmentObj) scopeObj; editBuff.setRequiredContainerContactAttach(refContactAttach); refTenant = (ICFAccTenantObj) editBuff.getRequiredOwnerTenant(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFAccAttachmentObj"); } // Resolve and apply Owner reference if (refTenant == null) { if (scopeObj instanceof ICFAccTenantObj) { refTenant = (ICFAccTenantObj) scopeObj; editBuff.setRequiredOwnerTenant(refTenant); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>"); } } // Lookup refTag by qualified name if ((attrTag != null) && (attrTag.length() > 0)) { refTag = (ICFAccTagObj) (editBuff.getNamedObject( schemaObj.getTagTableObj().getObjQualifyingClass(), attrTag)); if (refTag == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve Tag reference qualified name \"" + attrTag + "\" to table Tag"); } } else { refTag = null; } editBuff.setRequiredParentTag(refTag); ICFAccAttachmentTagObj origAttachmentTag; ICFAccAttachmentTagEditObj editAttachmentTag = editBuff; origAttachmentTag = (ICFAccAttachmentTagObj) editAttachmentTag.create(); editAttachmentTag.endEdit(); curContext.putNamedValue("Object", origAttachmentTag); } 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 { CFDbTestXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrClusterId = null; String attrSecGroupId = null; String attrSecUserId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecGroupMemberReadByUUserIdx"); CFDbTestXMsgRqstHandler xmsgRqstHandler = (CFDbTestXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFDbTestSchemaObj 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("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecGroupId")) { if (attrSecGroupId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecGroupId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecUserId")) { if (attrSecUserId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecUserId = 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 ((attrClusterId == null) || (attrClusterId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId"); } if ((attrSecGroupId == null) || (attrSecGroupId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupId"); } if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecUserId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natClusterId; natClusterId = Long.parseLong(attrClusterId); int natSecGroupId; natSecGroupId = Integer.parseInt(attrSecGroupId); UUID natSecUserId; if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { natSecUserId = null; } else { natSecUserId = UUID.fromString(attrSecUserId); } // Read the object ICFDbTestSecGroupMemberObj read = ((ICFDbTestSecGroupMemberObj) schemaObj .getSecGroupMemberTableObj() .readSecGroupMemberByUUserIdx(natClusterId, natSecGroupId, natSecUserId, true)); if (read != null) { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSecGroupMemberMessageFormatter.formatSecGroupMemberRspnSingleOpenTag() + CFDbTestXMsgSecGroupMemberMessageFormatter.formatSecGroupMemberRspnDerivedRec( "\n\t\t", read.getSecGroupMemberBuff()) + "\n" + "\t" + CFDbTestXMsgSecGroupMemberMessageFormatter .formatSecGroupMemberRspnSingleCloseTag() + schemaFormatter.formatRspnXmlPostamble(); ((CFDbTestXMsgRqstHandler) getParser()).appendResponse(response); } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(response); } } catch (RuntimeException e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support // ISOLanguage Attributes String attrISOCode = null; String attrBaseLanguageCode = null; String attrISOCountryId = null; // ISOLanguage References // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("ISOLanguage"); CFDbTestSaxLoader saxLoader = (CFDbTestSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFDbTestISOLanguageEditObj editBuff = (ICFDbTestISOLanguageEditObj) schemaObj.getISOLanguageTableObj().newInstance().beginEdit(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCode")) { if (attrISOCode != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("BaseLanguageCode")) { if (attrBaseLanguageCode != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrBaseLanguageCode = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrISOCode == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCode"); } if (attrBaseLanguageCode == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "BaseLanguageCode"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("ISOCode", attrISOCode); curContext.putNamedValue("BaseLanguageCode", attrBaseLanguageCode); curContext.putNamedValue("ISOCountryId", attrISOCountryId); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natId; natId = Short.parseShort(attrId); editBuff.getPKey().setRequiredId(natId); editBuff.getISOLanguageBuff().setRequiredId(natId); String natISOCode = attrISOCode; editBuff.setRequiredISOCode(natISOCode); String natBaseLanguageCode = attrBaseLanguageCode; editBuff.setRequiredBaseLanguageCode(natBaseLanguageCode); Short natISOCountryId; if ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { natISOCountryId = null; } else { natISOCountryId = new Short(Short.parseShort(attrISOCountryId)); } editBuff.setOptionalISOCountryId(natISOCountryId); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } CFDbTestSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getISOLanguageLoaderBehaviour(); ICFDbTestISOLanguageEditObj editISOLanguage = null; ICFDbTestISOLanguageObj origISOLanguage = (ICFDbTestISOLanguageObj) schemaObj .getISOLanguageTableObj() .readISOLanguageByCodeIdx(editBuff.getRequiredISOCode()); editBuff.getPKey().setRequiredId(natId); editBuff.getISOLanguageBuff().setRequiredId(natId); if (origISOLanguage == null) { editISOLanguage = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editISOLanguage = (ICFDbTestISOLanguageEditObj) origISOLanguage.beginEdit(); editISOLanguage.setRequiredISOCode(editBuff.getRequiredISOCode()); editISOLanguage.setRequiredBaseLanguageCode(editBuff.getRequiredBaseLanguageCode()); editISOLanguage.setOptionalISOCountryId(editBuff.getOptionalISOCountryId()); break; case Replace: editISOLanguage = (ICFDbTestISOLanguageEditObj) origISOLanguage.beginEdit(); editISOLanguage.delete(); editISOLanguage.endEdit(); origISOLanguage = null; editISOLanguage = editBuff; break; } } if (editISOLanguage != null) { if (origISOLanguage != null) { editISOLanguage.update(); } else { origISOLanguage = (ICFDbTestISOLanguageObj) editISOLanguage.create(); } editISOLanguage.endEdit(); } curContext.putNamedValue("Object", origISOLanguage); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // SysCluster Attributes String attrSingletonId = null; String attrClusterId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSysClusterCreate"); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFAsteriskSysClusterEditObj editBuff = (ICFAsteriskSysClusterEditObj) schemaObj.getSysClusterTableObj().newInstance().beginEdit(); CFSecuritySysClusterBuff dataBuff = (CFSecuritySysClusterBuff) editBuff.getSysClusterBuff(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SingletonId")) { if (attrSingletonId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSingletonId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrSingletonId == null) || (attrSingletonId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SingletonId"); } if ((attrClusterId == null) || (attrClusterId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. int natSingletonId = Integer.parseInt(attrSingletonId); dataBuff.setRequiredSingletonId(natSingletonId); long natClusterId = Long.parseLong(attrClusterId); dataBuff.setRequiredClusterId(natClusterId); // Attempt the create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFAsteriskSysClusterObj created = (ICFAsteriskSysClusterObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSysClusterMessageFormatter.formatSysClusterRspnCreated( "\n\t\t\t", created.getSysClusterBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFAsteriskXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Scope Attributes String attrTenantId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // ClearDep Attributes String attrRelationId = null; // ClearSubDep3 Attributes String attrContClearDep2TenantId = null; String attrContClearDep2Id = null; String attrName = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstClearSubDep3Update"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("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("RelationId")) { if (attrRelationId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRelationId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContClearDep2TenantId")) { if (attrContClearDep2TenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContClearDep2TenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContClearDep2Id")) { if (attrContClearDep2Id != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContClearDep2Id = 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 ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt"); } if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy"); } if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt"); } if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy"); } if ((attrRelationId == null) || (attrRelationId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "RelationId"); } if ((attrContClearDep2TenantId == null) || (attrContClearDep2TenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2TenantId"); } if ((attrContClearDep2Id == null) || (attrContClearDep2Id.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFBamScopePKey pkey = ((ICFBamSchema) schemaObj.getBackingStore()).getFactoryScope().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); // Read the instance ICFBamClearSubDep3Obj origBuff = ((ICFBamClearSubDep3Obj) schemaObj.getClearSubDep3TableObj().readClearSubDep3(pkey)); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "getClearSubDep3TableObj().readClearSubDep3()"); } else { // Edit the instance ICFBamClearSubDep3EditObj editBuff = (ICFBamClearSubDep3EditObj) origBuff.beginEdit(); CFBamClearSubDep3Buff dataBuff = editBuff.getClearSubDep3Buff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. int natRevision = Integer.parseInt(attrRevision); dataBuff.setRequiredRevision(natRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } long natRelationId = Long.parseLong(attrRelationId); dataBuff.setRequiredRelationId(natRelationId); long natContClearDep2TenantId = Long.parseLong(attrContClearDep2TenantId); dataBuff.setRequiredContClearDep2TenantId(natContClearDep2TenantId); long natContClearDep2Id = Long.parseLong(attrContClearDep2Id); dataBuff.setRequiredContClearDep2Id(natContClearDep2Id); String natName = attrName; dataBuff.setRequiredName(natName); // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgClearSubDep3MessageFormatter.formatClearSubDep3RspnUpdated( "\n\t\t\t", origBuff.getClearSubDep3Buff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // ContactList Attributes String attrContactListId = null; String attrTenantId = null; String attrDescription = null; String attrStripDigits = 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("ContactList"); 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("ContactListId")) { if (attrContactListId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContactListId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("StripDigits")) { if (attrStripDigits != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrStripDigits = 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 ((attrContactListId == null) || (attrContactListId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContactListId"); } if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natContactListId = Long.parseLong(attrContactListId); long natTenantId = Long.parseLong(attrTenantId); String natDescription = attrDescription; Integer natStripDigits; if ((attrStripDigits == null) || (attrStripDigits.length() <= 0)) { natStripDigits = null; } else { natStripDigits = new Integer(Integer.parseInt(attrStripDigits)); } 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 ICFAccContactListObj obj = (ICFAccContactListObj) (schemaObj.getContactListTableObj().newInstance()); CFCrmContactListBuff dataBuff = obj.getContactListBuff(); dataBuff.setRequiredContactListId(natContactListId); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredDescription(natDescription); dataBuff.setOptionalStripDigits(natStripDigits); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFCrmContactListObj> list = (List<ICFCrmContactListObj>) xmsgRspnHandler.getListOfObjects(); ICFCrmContactListObj realized = (ICFCrmContactListObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(realized); } } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // Value Attributes String attrTenantId = null; String attrScopeId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrGenerateId = null; String attrDataScopeId = null; String attrViewAccessSecurityId = null; String attrEditAccessSecurityId = null; String attrViewAccessFrequencyId = null; String attrEditAccessFrequencyId = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = null; String attrDefaultVisibility = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Atom Attributes String attrDbName = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnAtomLocked"); CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenerateId")) { if (attrGenerateId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerateId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DataScopeId")) { if (attrDataScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessSecurityId")) { if (attrViewAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessSecurityId")) { if (attrEditAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessFrequencyId")) { if (attrViewAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessFrequencyId")) { if (attrEditAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natScopeId = Long.parseLong(attrScopeId); long natId = Long.parseLong(attrId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } String natName = attrName; String natShortName = attrShortName; String natLabel = attrLabel; String natShortDescription = attrShortDescription; String natDescription = attrDescription; boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } Boolean natGenerateId; if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) { natGenerateId = null; } else if (attrGenerateId.equals("true") || attrGenerateId.equals("yes") || attrGenerateId.equals("1")) { natGenerateId = true; } else if (attrGenerateId.equals("false") || attrGenerateId.equals("no") || attrGenerateId.equals("0")) { natGenerateId = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerateId + "\""); } Short natDataScopeId; if ((attrDataScopeId == null) || (attrDataScopeId.length() <= 0)) { natDataScopeId = null; } else { natDataScopeId = new Short(Short.parseShort(attrDataScopeId)); } Short natViewAccessSecurityId; if ((attrViewAccessSecurityId == null) || (attrViewAccessSecurityId.length() <= 0)) { natViewAccessSecurityId = null; } else { natViewAccessSecurityId = new Short(Short.parseShort(attrViewAccessSecurityId)); } Short natEditAccessSecurityId; if ((attrEditAccessSecurityId == null) || (attrEditAccessSecurityId.length() <= 0)) { natEditAccessSecurityId = null; } else { natEditAccessSecurityId = new Short(Short.parseShort(attrEditAccessSecurityId)); } Short natViewAccessFrequencyId; if ((attrViewAccessFrequencyId == null) || (attrViewAccessFrequencyId.length() <= 0)) { natViewAccessFrequencyId = null; } else { natViewAccessFrequencyId = new Short(Short.parseShort(attrViewAccessFrequencyId)); } Short natEditAccessFrequencyId; if ((attrEditAccessFrequencyId == null) || (attrEditAccessFrequencyId.length() <= 0)) { natEditAccessFrequencyId = null; } else { natEditAccessFrequencyId = new Short(Short.parseShort(attrEditAccessFrequencyId)); } Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } int natRevision = Integer.parseInt(attrRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } String natDbName = attrDbName; // Instantiate a buffer for the parsed information ICFBamAtomObj obj = (ICFBamAtomObj) schemaObj.getAtomTableObj().newInstance(); CFBamAtomBuff dataBuff = obj.getAtomBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredScopeId(natScopeId); dataBuff.setRequiredId(natId); dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); dataBuff.setOptionalDefSchemaId(natDefSchemaId); dataBuff.setRequiredName(natName); dataBuff.setOptionalShortName(natShortName); dataBuff.setOptionalLabel(natLabel); dataBuff.setOptionalShortDescription(natShortDescription); dataBuff.setOptionalDescription(natDescription); dataBuff.setRequiredIsNullable(natIsNullable); dataBuff.setOptionalGenerateId(natGenerateId); dataBuff.setOptionalDataScopeId(natDataScopeId); dataBuff.setOptionalViewAccessSecurityId(natViewAccessSecurityId); dataBuff.setOptionalEditAccessSecurityId(natEditAccessSecurityId); dataBuff.setOptionalViewAccessFrequencyId(natViewAccessFrequencyId); dataBuff.setOptionalEditAccessFrequencyId(natEditAccessFrequencyId); dataBuff.setOptionalPrevTenantId(natPrevTenantId); dataBuff.setOptionalPrevId(natPrevId); dataBuff.setOptionalNextTenantId(natNextTenantId); dataBuff.setOptionalNextId(natNextId); dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } dataBuff.setOptionalDbName(natDbName); obj.copyBuffToPKey(); ICFBamAtomObj realized = (ICFBamAtomObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // TSecGroup Attributes String attrTenantId = null; String attrTSecGroupId = null; String attrName = null; String attrIsVisible = 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("RspnTSecGroupLocked"); CFFreeSwitchXMsgRspnHandler xmsgRspnHandler = (CFFreeSwitchXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFFreeSwitchSchemaObj 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("TSecGroupId")) { if (attrTSecGroupId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTSecGroupId = 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("IsVisible")) { if (attrIsVisible != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsVisible = 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 ((attrTSecGroupId == null) || (attrTSecGroupId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TSecGroupId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsVisible == null) || (attrIsVisible.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsVisible"); } 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); int natTSecGroupId = Integer.parseInt(attrTSecGroupId); String natName = attrName; boolean natIsVisible; if (attrIsVisible.equals("true") || attrIsVisible.equals("yes") || attrIsVisible.equals("1")) { natIsVisible = true; } else if (attrIsVisible.equals("false") || attrIsVisible.equals("no") || attrIsVisible.equals("0")) { natIsVisible = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsVisible value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsVisible + "\""); } 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 ICFFreeSwitchTSecGroupObj obj = (ICFFreeSwitchTSecGroupObj) schemaObj.getTSecGroupTableObj().newInstance(); CFSecurityTSecGroupBuff dataBuff = obj.getTSecGroupBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredTSecGroupId(natTSecGroupId); dataBuff.setRequiredName(natName); dataBuff.setRequiredIsVisible(natIsVisible); 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(); ICFFreeSwitchTSecGroupObj realized = (ICFFreeSwitchTSecGroupObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFDbTestXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Value Attributes String attrTenantId = null; String attrScopeId = null; String attrName = null; String attrDefaultVisibility = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Atom Attributes // TokenDef Attributes // TokenType Attributes String attrSchemaDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTokenTypeUpdate"); CFDbTestXMsgRqstHandler xmsgRqstHandler = (CFDbTestXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFDbTestSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = 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("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SchemaDefId")) { if (attrSchemaDefId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSchemaDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt"); } if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy"); } if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt"); } if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy"); } if ((attrSchemaDefId == null) || (attrSchemaDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaDefId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFDbTestValuePKey pkey = ((ICFDbTestSchema) schemaObj.getBackingStore()).getFactoryValue().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); // Read the instance ICFDbTestTokenTypeObj origBuff = ((ICFDbTestTokenTypeObj) schemaObj.getTokenTypeTableObj().readTokenType(pkey)); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "getTokenTypeTableObj().readTokenType()"); } else { // Edit the instance ICFDbTestTokenTypeEditObj editBuff = (ICFDbTestTokenTypeEditObj) origBuff.beginEdit(); CFDbTestTokenTypeBuff dataBuff = editBuff.getTokenTypeBuff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natScopeId = Long.parseLong(attrScopeId); dataBuff.setRequiredScopeId(natScopeId); String natName = attrName; dataBuff.setRequiredName(natName); boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } dataBuff.setOptionalPrevTenantId(natPrevTenantId); Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } dataBuff.setOptionalPrevId(natPrevId); Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } dataBuff.setOptionalNextTenantId(natNextTenantId); Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } dataBuff.setOptionalNextId(natNextId); int natRevision = Integer.parseInt(attrRevision); dataBuff.setRequiredRevision(natRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } long natSchemaDefId = Long.parseLong(attrSchemaDefId); dataBuff.setRequiredSchemaDefId(natSchemaDefId); // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgTokenTypeMessageFormatter.formatTokenTypeRspnUpdated( "\n\t\t\t", origBuff.getTokenTypeBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFDbTestXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // ReqMinMaxValue Attributes String attrTenantId = null; String attrDescription = null; String attrTestInt16 = null; String attrTestInt32 = null; String attrTestInt64 = null; String attrTestUInt16 = null; String attrTestUInt32 = null; String attrTestUInt64 = null; String attrTestFloat = null; String attrTestDouble = null; String attrTestNumber = null; String attrTestDate = null; String attrTestTimestamp = null; String attrTestTZDate = null; String attrTestTZTimestamp = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("ReqMinMaxValue"); CFDbTestXMsgRspnHandler xmsgRspnHandler = (CFDbTestXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFDbTestSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt16")) { if (attrTestInt16 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt16 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt32")) { if (attrTestInt32 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt32 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestInt64")) { if (attrTestInt64 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestInt64 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt16")) { if (attrTestUInt16 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt16 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt32")) { if (attrTestUInt32 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt32 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestUInt64")) { if (attrTestUInt64 != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestUInt64 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestFloat")) { if (attrTestFloat != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestFloat = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestDouble")) { if (attrTestDouble != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestDouble = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestNumber")) { if (attrTestNumber != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestNumber = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestDate")) { if (attrTestDate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestDate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTimestamp")) { if (attrTestTimestamp != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTimestamp = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTZDate")) { if (attrTestTZDate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTZDate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TestTZTimestamp")) { if (attrTestTZTimestamp != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTestTZTimestamp = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } if ((attrTestInt16 == null) || (attrTestInt16.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestInt16"); } if ((attrTestInt32 == null) || (attrTestInt32.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestInt32"); } if ((attrTestInt64 == null) || (attrTestInt64.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestInt64"); } if ((attrTestUInt16 == null) || (attrTestUInt16.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestUInt16"); } if ((attrTestUInt32 == null) || (attrTestUInt32.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestUInt32"); } if ((attrTestUInt64 == null) || (attrTestUInt64.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestUInt64"); } if ((attrTestFloat == null) || (attrTestFloat.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestFloat"); } if ((attrTestDouble == null) || (attrTestDouble.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestDouble"); } if ((attrTestNumber == null) || (attrTestNumber.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestNumber"); } if ((attrTestDate == null) || (attrTestDate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestDate"); } if ((attrTestTimestamp == null) || (attrTestTimestamp.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestTimestamp"); } if ((attrTestTZDate == null) || (attrTestTZDate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestTZDate"); } if ((attrTestTZTimestamp == null) || (attrTestTZTimestamp.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TestTZTimestamp"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natId = Long.parseLong(attrId); String natDescription = attrDescription; short natTestInt16 = Short.parseShort(attrTestInt16); int natTestInt32 = Integer.parseInt(attrTestInt32); long natTestInt64 = Long.parseLong(attrTestInt64); int natTestUInt16 = Integer.parseInt(attrTestUInt16); long natTestUInt32 = Long.parseLong(attrTestUInt32); BigDecimal natTestUInt64 = new BigDecimal(attrTestUInt64); float natTestFloat = Float.parseFloat(attrTestFloat); double natTestDouble = Double.parseDouble(attrTestDouble); BigDecimal natTestNumber = new BigDecimal(attrTestNumber); Calendar natTestDate; try { natTestDate = CFLibXmlUtil.parseDate(attrTestDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException(getClass(), S_ProcName, 0, "TestDate", attrTestDate, e); } Calendar natTestTimestamp; try { natTestTimestamp = CFLibXmlUtil.parseTimestamp(attrTestTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTimestamp", attrTestTimestamp, e); } Calendar natTestTZDate; try { natTestTZDate = CFLibXmlUtil.parseTZDate(attrTestTZDate); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZDate", attrTestTZDate, e); } Calendar natTestTZTimestamp; try { natTestTZTimestamp = CFLibXmlUtil.parseTZTimestamp(attrTestTZTimestamp); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "TestTZTimestamp", attrTestTZTimestamp, e); } int natRevision = Integer.parseInt(attrRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFDbTestReqMinMaxValueObj obj = (ICFDbTestReqMinMaxValueObj) (schemaObj.getReqMinMaxValueTableObj().newInstance()); CFDbTestReqMinMaxValueBuff dataBuff = obj.getReqMinMaxValueBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredId(natId); dataBuff.setRequiredDescription(natDescription); dataBuff.setRequiredTestInt16(natTestInt16); dataBuff.setRequiredTestInt32(natTestInt32); dataBuff.setRequiredTestInt64(natTestInt64); dataBuff.setRequiredTestUInt16(natTestUInt16); dataBuff.setRequiredTestUInt32(natTestUInt32); dataBuff.setRequiredTestUInt64(natTestUInt64); dataBuff.setRequiredTestFloat(natTestFloat); dataBuff.setRequiredTestDouble(natTestDouble); dataBuff.setRequiredTestNumber(natTestNumber); dataBuff.setRequiredTestDate(natTestDate); dataBuff.setRequiredTestTimestamp(natTestTimestamp); dataBuff.setRequiredTestTZDate(natTestTZDate); dataBuff.setRequiredTestTZTimestamp(natTestTZTimestamp); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFDbTestReqMinMaxValueObj> list = (List<ICFDbTestReqMinMaxValueObj>) xmsgRspnHandler.getListOfObjects(); ICFDbTestReqMinMaxValueObj realized = (ICFDbTestReqMinMaxValueObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(realized); } } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTenantId = null; String attrScopeId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTimestampTypeReadByScopeIdx"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); long natScopeId; natScopeId = Long.parseLong(attrScopeId); // Read the objects List<ICFBamTimestampTypeObj> list = schemaObj.getTimestampTypeTableObj().readTimestampTypeByScopeIdx(natTenantId, natScopeId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFBamTimestampTypeObj> iter = list.iterator(); ICFBamTimestampTypeObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFBamXMsgValueMessageFormatter.formatValueRspnDerivedRec("\n\t\t", cur.getValueBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFCrmXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support String attrTenantId = null; String attrPhoneId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstPhoneRead"); CFCrmXMsgRqstHandler xmsgRqstHandler = (CFCrmXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFCrmSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFCrmPhonePKey pkey = ((ICFCrmSchema) schemaObj.getBackingStore()).getFactoryPhone().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PhoneId")) { if (attrPhoneId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPhoneId = 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 ((attrPhoneId == null) || (attrPhoneId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "PhoneId"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); pkey.setRequiredTenantId(natTenantId); long natPhoneId; natPhoneId = Long.parseLong(attrPhoneId); pkey.setRequiredPhoneId(natPhoneId); pkey.setRequiredPhoneId(natPhoneId); // Read the object and prepare the XML response ICFCrmPhoneObj read = ((ICFCrmPhoneObj) schemaObj.getPhoneTableObj().readPhone(pkey, true)); if (read != null) { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgPhoneMessageFormatter.formatPhoneRspnSingleOpenTag() + CFCrmXMsgPhoneMessageFormatter.formatPhoneRspnDerivedRec( "\n\t\t", read.getPhoneBuff()) + "\n" + "\t" + CFCrmXMsgPhoneMessageFormatter.formatPhoneRspnSingleCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(response); } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(response); } } catch (RuntimeException e) { CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // Cluster Attributes String attrFullDomainName = null; String attrDescription = 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("RspnClusterLocked"); CFSecurityXMsgRspnHandler xmsgRspnHandler = (CFSecurityXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFSecuritySchemaObj 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("FullDomainName")) { if (attrFullDomainName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFullDomainName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrFullDomainName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FullDomainName"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natId = Long.parseLong(attrId); String natFullDomainName = attrFullDomainName; String natDescription = attrDescription; 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 ICFSecurityClusterObj obj = (ICFSecurityClusterObj) schemaObj.getClusterTableObj().newInstance(); CFSecurityClusterBuff dataBuff = obj.getClusterBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredFullDomainName(natFullDomainName); dataBuff.setRequiredDescription(natDescription); 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(); ICFSecurityClusterObj realized = (ICFSecurityClusterObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAccXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstProjectBaseReadAll"); CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAccSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Read the objects and prepare the response XML List<ICFInternetProjectBaseObj> list = schemaObj.getProjectBaseTableObj().readAllProjectBase(true); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgProjectBaseMessageFormatter.formatProjectBaseRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFInternetProjectBaseObj> iter = list.iterator(); ICFInternetProjectBaseObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAccXMsgProjectBaseMessageFormatter.formatProjectBaseRspnDerivedRec( "\n\t\t", cur.getProjectBaseBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAccXMsgProjectBaseMessageFormatter.formatProjectBaseRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFDbTestXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTenantId = null; String attrSchemaDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstUInt16TypeDeleteBySchemaIdx"); CFDbTestXMsgRqstHandler xmsgRqstHandler = (CFDbTestXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFDbTestSchemaObj 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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SchemaDefId")) { if (attrSchemaDefId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSchemaDefId = attrs.getValue(idxAttr); } else 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 ((attrSchemaDefId == null) || (attrSchemaDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaDefId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId; natTenantId = Long.parseLong(attrTenantId); long natSchemaDefId; natSchemaDefId = Long.parseLong(attrSchemaDefId); // Delete the objects schemaObj.getUInt16TypeTableObj().deleteUInt16TypeBySchemaIdx(natTenantId, natSchemaDefId); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgUInt16TypeMessageFormatter.formatUInt16TypeRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFDbTestXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Value Attributes String attrTenantId = null; String attrScopeId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrGenerateId = null; String attrDataScopeId = null; String attrViewAccessSecurityId = null; String attrEditAccessSecurityId = null; String attrViewAccessFrequencyId = null; String attrEditAccessFrequencyId = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = null; String attrDefaultVisibility = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Atom Attributes String attrDbName = null; // BlobDef Attributes String attrMaxLen = null; String attrInitValue = null; String attrDefaultValue = null; String attrNullValue = null; String attrUnknownValue = null; // BlobType Attributes String attrSchemaDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstBlobTypeCreate"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFBamBlobTypeEditObj editBuff = (ICFBamBlobTypeEditObj) schemaObj.getBlobTypeTableObj().newInstance().beginEdit(); CFBamBlobTypeBuff dataBuff = (CFBamBlobTypeBuff) editBuff.getBlobTypeBuff(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenerateId")) { if (attrGenerateId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerateId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DataScopeId")) { if (attrDataScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessSecurityId")) { if (attrViewAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessSecurityId")) { if (attrEditAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessFrequencyId")) { if (attrViewAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessFrequencyId")) { if (attrEditAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxLen")) { if (attrMaxLen != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxLen = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InitValue")) { if (attrInitValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInitValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultValue")) { if (attrDefaultValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NullValue")) { if (attrNullValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNullValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnknownValue")) { if (attrUnknownValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnknownValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SchemaDefId")) { if (attrSchemaDefId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSchemaDefId = attrs.getValue(idxAttr); } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } if ((attrMaxLen == null) || (attrMaxLen.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MaxLen"); } if ((attrSchemaDefId == null) || (attrSchemaDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaDefId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId = Long.parseLong(attrTenantId); dataBuff.setRequiredTenantId(natTenantId); long natScopeId = Long.parseLong(attrScopeId); dataBuff.setRequiredScopeId(natScopeId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } dataBuff.setOptionalDefSchemaId(natDefSchemaId); String natName = attrName; dataBuff.setRequiredName(natName); String natShortName = attrShortName; dataBuff.setOptionalShortName(natShortName); String natLabel = attrLabel; dataBuff.setOptionalLabel(natLabel); String natShortDescription = attrShortDescription; dataBuff.setOptionalShortDescription(natShortDescription); String natDescription = attrDescription; dataBuff.setOptionalDescription(natDescription); boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } dataBuff.setRequiredIsNullable(natIsNullable); Boolean natGenerateId; if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) { natGenerateId = null; } else if (attrGenerateId.equals("true") || attrGenerateId.equals("yes") || attrGenerateId.equals("1")) { natGenerateId = true; } else if (attrGenerateId.equals("false") || attrGenerateId.equals("no") || attrGenerateId.equals("0")) { natGenerateId = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerateId + "\""); } dataBuff.setOptionalGenerateId(natGenerateId); Short natDataScopeId; if ((attrDataScopeId == null) || (attrDataScopeId.length() <= 0)) { natDataScopeId = null; } else { natDataScopeId = new Short(Short.parseShort(attrDataScopeId)); } dataBuff.setOptionalDataScopeId(natDataScopeId); Short natViewAccessSecurityId; if ((attrViewAccessSecurityId == null) || (attrViewAccessSecurityId.length() <= 0)) { natViewAccessSecurityId = null; } else { natViewAccessSecurityId = new Short(Short.parseShort(attrViewAccessSecurityId)); } dataBuff.setOptionalViewAccessSecurityId(natViewAccessSecurityId); Short natEditAccessSecurityId; if ((attrEditAccessSecurityId == null) || (attrEditAccessSecurityId.length() <= 0)) { natEditAccessSecurityId = null; } else { natEditAccessSecurityId = new Short(Short.parseShort(attrEditAccessSecurityId)); } dataBuff.setOptionalEditAccessSecurityId(natEditAccessSecurityId); Short natViewAccessFrequencyId; if ((attrViewAccessFrequencyId == null) || (attrViewAccessFrequencyId.length() <= 0)) { natViewAccessFrequencyId = null; } else { natViewAccessFrequencyId = new Short(Short.parseShort(attrViewAccessFrequencyId)); } dataBuff.setOptionalViewAccessFrequencyId(natViewAccessFrequencyId); Short natEditAccessFrequencyId; if ((attrEditAccessFrequencyId == null) || (attrEditAccessFrequencyId.length() <= 0)) { natEditAccessFrequencyId = null; } else { natEditAccessFrequencyId = new Short(Short.parseShort(attrEditAccessFrequencyId)); } dataBuff.setOptionalEditAccessFrequencyId(natEditAccessFrequencyId); Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } dataBuff.setOptionalPrevTenantId(natPrevTenantId); Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } dataBuff.setOptionalPrevId(natPrevId); Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } dataBuff.setOptionalNextTenantId(natNextTenantId); Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } dataBuff.setOptionalNextId(natNextId); boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } String natDbName = attrDbName; dataBuff.setOptionalDbName(natDbName); int natMaxLen = Integer.parseInt(attrMaxLen); dataBuff.setRequiredMaxLen(natMaxLen); byte[] natInitValue; if (attrInitValue == null) { natInitValue = null; } else if (attrInitValue.length() <= 0) { natInitValue = new byte[0]; } else { natInitValue = Base64.decodeBase64(attrInitValue.getBytes()); } dataBuff.setOptionalInitValue(natInitValue); byte[] natDefaultValue; if (attrDefaultValue == null) { natDefaultValue = null; } else if (attrDefaultValue.length() <= 0) { natDefaultValue = new byte[0]; } else { natDefaultValue = Base64.decodeBase64(attrDefaultValue.getBytes()); } dataBuff.setOptionalDefaultValue(natDefaultValue); byte[] natNullValue; if (attrNullValue == null) { natNullValue = null; } else if (attrNullValue.length() <= 0) { natNullValue = new byte[0]; } else { natNullValue = Base64.decodeBase64(attrNullValue.getBytes()); } dataBuff.setOptionalNullValue(natNullValue); byte[] natUnknownValue; if (attrUnknownValue == null) { natUnknownValue = null; } else if (attrUnknownValue.length() <= 0) { natUnknownValue = new byte[0]; } else { natUnknownValue = Base64.decodeBase64(attrUnknownValue.getBytes()); } dataBuff.setOptionalUnknownValue(natUnknownValue); long natSchemaDefId = Long.parseLong(attrSchemaDefId); dataBuff.setRequiredSchemaDefId(natSchemaDefId); // Attempt the create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFBamBlobTypeObj created = (ICFBamBlobTypeObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgBlobTypeMessageFormatter.formatBlobTypeRspnCreated( "\n\t\t\t", created.getBlobTypeBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }