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; 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 attrRevision = null; // Value Attributes String attrTenantId = null; String attrScopeId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrGenerateId = null; String attrDataScopeId = null; String attrViewAccessSecurityId = null; String attrEditAccessSecurityId = null; String attrViewAccessFrequencyId = null; String attrEditAccessFrequencyId = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = null; String attrDefaultVisibility = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Atom Attributes String attrDbName = null; // BlobDef Attributes String attrMaxLen = null; String attrInitValue = null; String attrDefaultValue = null; String attrNullValue = null; String attrUnknownValue = null; // BlobType Attributes String attrSchemaDefId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstBlobTypeCreate"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFBamBlobTypeEditObj editBuff = (ICFBamBlobTypeEditObj) schemaObj.getBlobTypeTableObj().newInstance().beginEdit(); CFBamBlobTypeBuff dataBuff = (CFBamBlobTypeBuff) editBuff.getBlobTypeBuff(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenerateId")) { if (attrGenerateId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerateId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DataScopeId")) { if (attrDataScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessSecurityId")) { if (attrViewAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessSecurityId")) { if (attrEditAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessFrequencyId")) { if (attrViewAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessFrequencyId")) { if (attrEditAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxLen")) { if (attrMaxLen != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxLen = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InitValue")) { if (attrInitValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInitValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultValue")) { if (attrDefaultValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NullValue")) { if (attrNullValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNullValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnknownValue")) { if (attrUnknownValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnknownValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SchemaDefId")) { if (attrSchemaDefId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSchemaDefId = attrs.getValue(idxAttr); } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } if ((attrMaxLen == null) || (attrMaxLen.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MaxLen"); } if ((attrSchemaDefId == null) || (attrSchemaDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaDefId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId = Long.parseLong(attrTenantId); dataBuff.setRequiredTenantId(natTenantId); long natScopeId = Long.parseLong(attrScopeId); dataBuff.setRequiredScopeId(natScopeId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } dataBuff.setOptionalDefSchemaId(natDefSchemaId); String natName = attrName; dataBuff.setRequiredName(natName); String natShortName = attrShortName; dataBuff.setOptionalShortName(natShortName); String natLabel = attrLabel; dataBuff.setOptionalLabel(natLabel); String natShortDescription = attrShortDescription; dataBuff.setOptionalShortDescription(natShortDescription); String natDescription = attrDescription; dataBuff.setOptionalDescription(natDescription); boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } dataBuff.setRequiredIsNullable(natIsNullable); Boolean natGenerateId; if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) { natGenerateId = null; } else if (attrGenerateId.equals("true") || attrGenerateId.equals("yes") || attrGenerateId.equals("1")) { natGenerateId = true; } else if (attrGenerateId.equals("false") || attrGenerateId.equals("no") || attrGenerateId.equals("0")) { natGenerateId = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerateId + "\""); } dataBuff.setOptionalGenerateId(natGenerateId); Short natDataScopeId; if ((attrDataScopeId == null) || (attrDataScopeId.length() <= 0)) { natDataScopeId = null; } else { natDataScopeId = new Short(Short.parseShort(attrDataScopeId)); } dataBuff.setOptionalDataScopeId(natDataScopeId); Short natViewAccessSecurityId; if ((attrViewAccessSecurityId == null) || (attrViewAccessSecurityId.length() <= 0)) { natViewAccessSecurityId = null; } else { natViewAccessSecurityId = new Short(Short.parseShort(attrViewAccessSecurityId)); } dataBuff.setOptionalViewAccessSecurityId(natViewAccessSecurityId); Short natEditAccessSecurityId; if ((attrEditAccessSecurityId == null) || (attrEditAccessSecurityId.length() <= 0)) { natEditAccessSecurityId = null; } else { natEditAccessSecurityId = new Short(Short.parseShort(attrEditAccessSecurityId)); } dataBuff.setOptionalEditAccessSecurityId(natEditAccessSecurityId); Short natViewAccessFrequencyId; if ((attrViewAccessFrequencyId == null) || (attrViewAccessFrequencyId.length() <= 0)) { natViewAccessFrequencyId = null; } else { natViewAccessFrequencyId = new Short(Short.parseShort(attrViewAccessFrequencyId)); } dataBuff.setOptionalViewAccessFrequencyId(natViewAccessFrequencyId); Short natEditAccessFrequencyId; if ((attrEditAccessFrequencyId == null) || (attrEditAccessFrequencyId.length() <= 0)) { natEditAccessFrequencyId = null; } else { natEditAccessFrequencyId = new Short(Short.parseShort(attrEditAccessFrequencyId)); } dataBuff.setOptionalEditAccessFrequencyId(natEditAccessFrequencyId); Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } dataBuff.setOptionalPrevTenantId(natPrevTenantId); Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } dataBuff.setOptionalPrevId(natPrevId); Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } dataBuff.setOptionalNextTenantId(natNextTenantId); Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } dataBuff.setOptionalNextId(natNextId); boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } String natDbName = attrDbName; dataBuff.setOptionalDbName(natDbName); int natMaxLen = Integer.parseInt(attrMaxLen); dataBuff.setRequiredMaxLen(natMaxLen); byte[] natInitValue; if (attrInitValue == null) { natInitValue = null; } else if (attrInitValue.length() <= 0) { natInitValue = new byte[0]; } else { natInitValue = Base64.decodeBase64(attrInitValue.getBytes()); } dataBuff.setOptionalInitValue(natInitValue); byte[] natDefaultValue; if (attrDefaultValue == null) { natDefaultValue = null; } else if (attrDefaultValue.length() <= 0) { natDefaultValue = new byte[0]; } else { natDefaultValue = Base64.decodeBase64(attrDefaultValue.getBytes()); } dataBuff.setOptionalDefaultValue(natDefaultValue); byte[] natNullValue; if (attrNullValue == null) { natNullValue = null; } else if (attrNullValue.length() <= 0) { natNullValue = new byte[0]; } else { natNullValue = Base64.decodeBase64(attrNullValue.getBytes()); } dataBuff.setOptionalNullValue(natNullValue); byte[] natUnknownValue; if (attrUnknownValue == null) { natUnknownValue = null; } else if (attrUnknownValue.length() <= 0) { natUnknownValue = new byte[0]; } else { natUnknownValue = Base64.decodeBase64(attrUnknownValue.getBytes()); } dataBuff.setOptionalUnknownValue(natUnknownValue); long natSchemaDefId = Long.parseLong(attrSchemaDefId); dataBuff.setRequiredSchemaDefId(natSchemaDefId); // Attempt the create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFBamBlobTypeObj created = (ICFBamBlobTypeObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgBlobTypeMessageFormatter.formatBlobTypeRspnCreated( "\n\t\t\t", created.getBlobTypeBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { 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("RspnSecSessionLocked"); 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("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 if (attrLocalName.equals("schemaLocation")) { // ignored } 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"); } 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 UUID natSecSessionId = UUID.fromString(attrSecSessionId); UUID natSecUserId = UUID.fromString(attrSecUserId); String natSecDevName = attrSecDevName; Calendar natStart; try { natStart = CFLibXmlUtil.parseTimestamp(attrStart); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException(getClass(), S_ProcName, 0, "Start", attrStart, e); } 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); } } UUID natSecProxyId; if ((attrSecProxyId == null) || (attrSecProxyId.length() <= 0)) { natSecProxyId = null; } else { natSecProxyId = UUID.fromString(attrSecProxyId); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFFreeSwitchSecSessionObj obj = (ICFFreeSwitchSecSessionObj) schemaObj.getSecSessionTableObj().newInstance(); CFSecuritySecSessionBuff dataBuff = obj.getSecSessionBuff(); dataBuff.setRequiredSecSessionId(natSecSessionId); dataBuff.setRequiredSecUserId(natSecUserId); dataBuff.setOptionalSecDevName(natSecDevName); dataBuff.setRequiredStart(natStart); dataBuff.setOptionalFinish(natFinish); dataBuff.setOptionalSecProxyId(natSecProxyId); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFFreeSwitchSecSessionObj realized = (ICFFreeSwitchSecSessionObj) 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 { CFCrmXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrSecSessionId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecSessionDelete"); 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 CFSecuritySecSessionPKey pkey = ((ICFCrmSchema) schemaObj.getBackingStore()).getFactorySecSession().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("SecSessionId")) { if (attrSecSessionId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecSessionId = 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 ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecSessionId"); } 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. UUID natSecSessionId; if ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) { natSecSessionId = null; } else { natSecSessionId = UUID.fromString(attrSecSessionId); } pkey.setRequiredSecSessionId(natSecSessionId); pkey.setRequiredSecSessionId(natSecSessionId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFCrmSecSessionObj read = ((ICFCrmSecSessionObj) schemaObj.getSecSessionTableObj().readSecSession(pkey)); if (read != null) { if (read.getSecSessionBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete SecSession"); } else { ICFCrmSecSessionEditObj editBuff = (ICFCrmSecSessionEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecSessionMessageFormatter.formatSecSessionRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFCrmXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFCrmXMsgRqstHandler) getParser()).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 { 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 { 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 { 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 { 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 { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // FSSFConferenceProfile Attributes String attrTenantId = null; String attrFSSFConferenceProfileId = null; String attrFSSFConferenceId = null; String attrName = null; String attrSoundPrefix = null; String attrAckSound = null; String attrAloneSound = null; String attrBadPinSound = null; String attrEnterSound = null; String attrExitSound = null; String attrIsLockedSound = null; String attrKickedSound = null; String attrLockedSound = null; String attrMaxMembersSound = null; String attrMOHSound = null; String attrMuteDetectSound = null; String attrMutedSound = null; String attrNackSound = null; String attrPerpetualSound = null; String attrPinSound = null; String attrPin = null; String attrUnmutedSound = null; String attrRate = null; String attrAutoRecord = null; String attrValInterval = null; String attrEnergyLevel = null; String attrMemberFlags = null; String attrConferenceFlags = null; String attrCallerControls = null; String attrTTSEngine = null; String attrTTSVoice = null; String attrMaxMembers = null; String attrComfortNoise = null; String attrAnnounceCount = null; String attrSuppressEvents = null; String attrVerboseEvents = null; String attrCallerIdName = null; String attrCallerIdNumber = 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("RqstFSSFConferenceProfileCreate"); CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFFreeSwitchFSSFConferenceProfileEditObj editBuff = (ICFFreeSwitchFSSFConferenceProfileEditObj) schemaObj.getFSSFConferenceProfileTableObj().newInstance().beginEdit(); CFFreeSwitchFSSFConferenceProfileBuff dataBuff = (CFFreeSwitchFSSFConferenceProfileBuff) editBuff.getFSSFConferenceProfileBuff(); // 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("FSSFConferenceProfileId")) { if (attrFSSFConferenceProfileId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFConferenceProfileId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FSSFConferenceId")) { if (attrFSSFConferenceId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFConferenceId = 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("SoundPrefix")) { if (attrSoundPrefix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSoundPrefix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AckSound")) { if (attrAckSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAckSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AloneSound")) { if (attrAloneSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAloneSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("BadPinSound")) { if (attrBadPinSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrBadPinSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EnterSound")) { if (attrEnterSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEnterSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ExitSound")) { if (attrExitSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrExitSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsLockedSound")) { if (attrIsLockedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsLockedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("KickedSound")) { if (attrKickedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrKickedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("LockedSound")) { if (attrLockedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLockedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxMembersSound")) { if (attrMaxMembersSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxMembersSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MOHSound")) { if (attrMOHSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMOHSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MuteDetectSound")) { if (attrMuteDetectSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMuteDetectSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MutedSound")) { if (attrMutedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMutedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NackSound")) { if (attrNackSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNackSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PerpetualSound")) { if (attrPerpetualSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPerpetualSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PinSound")) { if (attrPinSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPinSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Pin")) { if (attrPin != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPin = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnmutedSound")) { if (attrUnmutedSound != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnmutedSound = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Rate")) { if (attrRate != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AutoRecord")) { if (attrAutoRecord != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAutoRecord = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ValInterval")) { if (attrValInterval != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrValInterval = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EnergyLevel")) { if (attrEnergyLevel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEnergyLevel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MemberFlags")) { if (attrMemberFlags != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMemberFlags = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ConferenceFlags")) { if (attrConferenceFlags != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrConferenceFlags = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CallerControls")) { if (attrCallerControls != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCallerControls = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TTSEngine")) { if (attrTTSEngine != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTTSEngine = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TTSVoice")) { if (attrTTSVoice != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTTSVoice = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxMembers")) { if (attrMaxMembers != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxMembers = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ComfortNoise")) { if (attrComfortNoise != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrComfortNoise = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AnnounceCount")) { if (attrAnnounceCount != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAnnounceCount = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SuppressEvents")) { if (attrSuppressEvents != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSuppressEvents = attrs.getValue(idxAttr); } else if (attrLocalName.equals("VerboseEvents")) { if (attrVerboseEvents != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrVerboseEvents = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CallerIdName")) { if (attrCallerIdName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCallerIdName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CallerIdNumber")) { if (attrCallerIdNumber != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCallerIdNumber = 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 ((attrFSSFConferenceProfileId == null) || (attrFSSFConferenceProfileId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFConferenceProfileId"); } if ((attrFSSFConferenceId == null) || (attrFSSFConferenceId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFConferenceId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if (attrSoundPrefix == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SoundPrefix"); } if ((attrRate == null) || (attrRate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Rate"); } if (attrAutoRecord == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AutoRecord"); } if ((attrValInterval == null) || (attrValInterval.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ValInterval"); } if ((attrEnergyLevel == null) || (attrEnergyLevel.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "EnergyLevel"); } if (attrMemberFlags == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MemberFlags"); } if (attrConferenceFlags == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ConferenceFlags"); } if (attrCallerControls == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CallerControls"); } if (attrTTSEngine == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TTSEngine"); } if (attrTTSVoice == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TTSVoice"); } if ((attrMaxMembers == null) || (attrMaxMembers.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MaxMembers"); } if ((attrComfortNoise == null) || (attrComfortNoise.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ComfortNoise"); } if ((attrAnnounceCount == null) || (attrAnnounceCount.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AnnounceCount"); } if (attrSuppressEvents == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SuppressEvents"); } if (attrVerboseEvents == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "VerboseEvents"); } // 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 natFSSFConferenceProfileId = Long.parseLong(attrFSSFConferenceProfileId); dataBuff.setRequiredFSSFConferenceProfileId(natFSSFConferenceProfileId); long natFSSFConferenceId = Long.parseLong(attrFSSFConferenceId); dataBuff.setRequiredFSSFConferenceId(natFSSFConferenceId); String natName = attrName; dataBuff.setRequiredName(natName); String natSoundPrefix = attrSoundPrefix; dataBuff.setRequiredSoundPrefix(natSoundPrefix); String natAckSound = attrAckSound; dataBuff.setOptionalAckSound(natAckSound); String natAloneSound = attrAloneSound; dataBuff.setOptionalAloneSound(natAloneSound); String natBadPinSound = attrBadPinSound; dataBuff.setOptionalBadPinSound(natBadPinSound); String natEnterSound = attrEnterSound; dataBuff.setOptionalEnterSound(natEnterSound); String natExitSound = attrExitSound; dataBuff.setOptionalExitSound(natExitSound); String natIsLockedSound = attrIsLockedSound; dataBuff.setOptionalIsLockedSound(natIsLockedSound); String natKickedSound = attrKickedSound; dataBuff.setOptionalKickedSound(natKickedSound); String natLockedSound = attrLockedSound; dataBuff.setOptionalLockedSound(natLockedSound); String natMaxMembersSound = attrMaxMembersSound; dataBuff.setOptionalMaxMembersSound(natMaxMembersSound); String natMOHSound = attrMOHSound; dataBuff.setOptionalMOHSound(natMOHSound); String natMuteDetectSound = attrMuteDetectSound; dataBuff.setOptionalMuteDetectSound(natMuteDetectSound); String natMutedSound = attrMutedSound; dataBuff.setOptionalMutedSound(natMutedSound); String natNackSound = attrNackSound; dataBuff.setOptionalNackSound(natNackSound); String natPerpetualSound = attrPerpetualSound; dataBuff.setOptionalPerpetualSound(natPerpetualSound); String natPinSound = attrPinSound; dataBuff.setOptionalPinSound(natPinSound); String natPin = attrPin; dataBuff.setOptionalPin(natPin); String natUnmutedSound = attrUnmutedSound; dataBuff.setOptionalUnmutedSound(natUnmutedSound); int natRate = Integer.parseInt(attrRate); dataBuff.setRequiredRate(natRate); String natAutoRecord = attrAutoRecord; dataBuff.setRequiredAutoRecord(natAutoRecord); int natValInterval = Integer.parseInt(attrValInterval); dataBuff.setRequiredValInterval(natValInterval); int natEnergyLevel = Integer.parseInt(attrEnergyLevel); dataBuff.setRequiredEnergyLevel(natEnergyLevel); String natMemberFlags = attrMemberFlags; dataBuff.setRequiredMemberFlags(natMemberFlags); String natConferenceFlags = attrConferenceFlags; dataBuff.setRequiredConferenceFlags(natConferenceFlags); String natCallerControls = attrCallerControls; dataBuff.setRequiredCallerControls(natCallerControls); String natTTSEngine = attrTTSEngine; dataBuff.setRequiredTTSEngine(natTTSEngine); String natTTSVoice = attrTTSVoice; dataBuff.setRequiredTTSVoice(natTTSVoice); int natMaxMembers = Integer.parseInt(attrMaxMembers); dataBuff.setRequiredMaxMembers(natMaxMembers); int natComfortNoise = Integer.parseInt(attrComfortNoise); dataBuff.setRequiredComfortNoise(natComfortNoise); int natAnnounceCount = Integer.parseInt(attrAnnounceCount); dataBuff.setRequiredAnnounceCount(natAnnounceCount); String natSuppressEvents = attrSuppressEvents; dataBuff.setRequiredSuppressEvents(natSuppressEvents); String natVerboseEvents = attrVerboseEvents; dataBuff.setRequiredVerboseEvents(natVerboseEvents); String natCallerIdName = attrCallerIdName; dataBuff.setOptionalCallerIdName(natCallerIdName); String natCallerIdNumber = attrCallerIdNumber; dataBuff.setOptionalCallerIdNumber(natCallerIdNumber); 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 ICFFreeSwitchFSSFConferenceProfileObj created = (ICFFreeSwitchFSSFConferenceProfileObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgFSSFConferenceProfileMessageFormatter .formatFSSFConferenceProfileRspnCreated( "\n\t\t\t", created.getFSSFConferenceProfileBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.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; // Param Attributes String attrTenantId = null; String attrServerMethodId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrTypeTenantId = null; String attrTypeId = 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; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("Param"); 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("ServerMethodId")) { if (attrServerMethodId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrServerMethodId = 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("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("TypeTenantId")) { if (attrTypeTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTypeTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TypeId")) { if (attrTypeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTypeId = 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("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 ((attrServerMethodId == null) || (attrServerMethodId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ServerMethodId"); } 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"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natServerMethodId = Long.parseLong(attrServerMethodId); 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 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 + "\""); } Long natTypeTenantId; if ((attrTypeTenantId == null) || (attrTypeTenantId.length() <= 0)) { natTypeTenantId = null; } else { natTypeTenantId = new Long(Long.parseLong(attrTypeTenantId)); } Long natTypeId; if ((attrTypeId == null) || (attrTypeId.length() <= 0)) { natTypeId = null; } else { natTypeId = new Long(Long.parseLong(attrTypeId)); } 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)); } 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 ICFBamParamObj obj = (ICFBamParamObj) (schemaObj.getParamTableObj().newInstance()); CFBamParamBuff dataBuff = obj.getParamBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredServerMethodId(natServerMethodId); dataBuff.setRequiredId(natId); dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); dataBuff.setOptionalDefSchemaId(natDefSchemaId); dataBuff.setRequiredName(natName); dataBuff.setOptionalShortDescription(natShortDescription); dataBuff.setOptionalDescription(natDescription); dataBuff.setRequiredIsNullable(natIsNullable); dataBuff.setOptionalTypeTenantId(natTypeTenantId); dataBuff.setOptionalTypeId(natTypeId); dataBuff.setOptionalPrevTenantId(natPrevTenantId); dataBuff.setOptionalPrevId(natPrevId); dataBuff.setOptionalNextTenantId(natNextTenantId); dataBuff.setOptionalNextId(natNextId); 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<ICFBamParamObj> list = (List<ICFBamParamObj>) xmsgRspnHandler.getListOfObjects(); ICFBamParamObj realized = (ICFBamParamObj) 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 { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // FSSofia Attributes String attrTenantId = null; String attrFSSofiaId = null; String attrName = null; String attrLogLevel = null; String attrAutoRestart = null; String attrDebugPresence = 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("RqstFSSofiaCreate"); CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFFreeSwitchFSSofiaEditObj editBuff = (ICFFreeSwitchFSSofiaEditObj) schemaObj.getFSSofiaTableObj().newInstance().beginEdit(); CFFreeSwitchFSSofiaBuff dataBuff = (CFFreeSwitchFSSofiaBuff) editBuff.getFSSofiaBuff(); // 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("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("LogLevel")) { if (attrLogLevel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLogLevel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("AutoRestart")) { if (attrAutoRestart != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAutoRestart = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DebugPresence")) { if (attrDebugPresence != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDebugPresence = 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 ((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 ((attrLogLevel == null) || (attrLogLevel.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "LogLevel"); } if ((attrAutoRestart == null) || (attrAutoRestart.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "AutoRestart"); } if ((attrDebugPresence == null) || (attrDebugPresence.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DebugPresence"); } // 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); String natName = attrName; dataBuff.setRequiredName(natName); short natLogLevel = Short.parseShort(attrLogLevel); dataBuff.setRequiredLogLevel(natLogLevel); boolean natAutoRestart; if (attrAutoRestart.equals("true") || attrAutoRestart.equals("yes") || attrAutoRestart.equals("1")) { natAutoRestart = true; } else if (attrAutoRestart.equals("false") || attrAutoRestart.equals("no") || attrAutoRestart.equals("0")) { natAutoRestart = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected AutoRestart value, must be one of true, false, yes, no, 1, or 0, not \"" + attrAutoRestart + "\""); } dataBuff.setRequiredAutoRestart(natAutoRestart); int natDebugPresence = Integer.parseInt(attrDebugPresence); dataBuff.setRequiredDebugPresence(natDebugPresence); 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 ICFFreeSwitchFSSofiaObj created = (ICFFreeSwitchFSSofiaObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgFSSofiaMessageFormatter.formatFSSofiaRspnCreated( "\n\t\t\t", created.getFSSofiaBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.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 attrSecUserId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecDeviceReadByUserIdx"); 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("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 ((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. UUID natSecUserId; if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { natSecUserId = null; } else { natSecUserId = UUID.fromString(attrSecUserId); } // Read the objects List<ICFSecuritySecDeviceObj> list = schemaObj.getSecDeviceTableObj().readSecDeviceByUserIdx(natSecUserId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFDbTestXMsgSecDeviceMessageFormatter.formatSecDeviceRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecuritySecDeviceObj> iter = list.iterator(); ICFSecuritySecDeviceObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFDbTestXMsgSecDeviceMessageFormatter.formatSecDeviceRspnDerivedRec( "\n\t\t", cur.getSecDeviceBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFDbTestXMsgSecDeviceMessageFormatter.formatSecDeviceRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } 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 { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Request Attributes String attrSecSessionId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstLogOut"); CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFFreeSwitchSchemaObj 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("SecSessionId")) { if (attrSecSessionId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecSessionId = 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 ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecSessionId"); } UUID secSessionId = UUID.fromString(attrSecSessionId); if (secSessionId == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "converted-secSessionId"); } if (schemaObj.getAuthorization() == null) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException(getClass(), S_ProcName, "Already disconnected from the database"); } ICFSecuritySecSessionObj secSession = schemaObj.getSecSession(); if (secSession == null) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Security session does not exist for this schema"); } if (!secSessionId.equals(secSession.getRequiredSecSessionId())) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Security session id does not match the one established by this schema"); } if (secSession.getOptionalFinish() == null) { schemaObj.rollback(); schemaObj.beginTransaction(); ICFSecuritySecSessionEditObj editSecSession = secSession.beginEdit(); editSecSession.setOptionalFinish(Calendar.getInstance()); editSecSession.update(); editSecSession.endEdit(); schemaObj.commit(); } schemaObj.disconnect(false); schemaObj.setAuthorization(null); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnLoggedOut("\n\t\t\t", secSessionId) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.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; 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); } }
private boolean importRecord(DataRecord r, ArrayList<String> fieldsInInport) { try { if (Logger.isDebugLogging()) { Logger.log(Logger.DEBUG, Logger.MSG_DEBUG_DATA, "importing " + r.toString()); } DataRecord[] otherVersions = null; if (importMode.equals(IMPORTMODE_ADD) && logbookEntryNoHandling != null && logbookEntryNoHandling.equals(ENTRYNO_ALWAYS_ADDEND)) { // determine new EntryId for logbook r.set(keyFields[0], ((Logbook) storageObject).getNextEntryNo()); } if (isLogbook && (importMode.equals(IMPORTMODE_ADD) || importMode.equals(IMPORTMODE_ADDUPD))) { LogbookRecord lr = ((LogbookRecord) r); if (lr.getEntryId() == null || !lr.getEntryId().isSet() || lr.getEntryId().toString().length() == 0) { r.set(keyFields[0], ((Logbook) storageObject).getNextEntryNo()); } } DataKey key = r.getKey(); if (key.getKeyPart1() == null || overrideKeyField != null) { // first key field is *not* set, or we're overriding the default key field DataKey[] keys = null; if (overrideKeyField == null) { // -> search for record by QualifiedName keys = dataAccess.getByFields( r.getQualifiedNameFields(), r.getQualifiedNameValues(r.getQualifiedName()), (versionized ? validAt : -1)); } else { // -> search for record by user-specified key field keys = dataAccess.getByFields( new String[] {overrideKeyField}, new String[] {r.getAsString(overrideKeyField)}, (versionized ? validAt : -1)); } if (keys != null && keys.length > 0) { for (int i = 0; i < keyFields.length; i++) { if (!keyFields[i].equals(DataRecord.VALIDFROM)) { r.set(keyFields[i], keys[0].getKeyPart(i)); } } } else { for (int i = 0; i < keyFields.length; i++) { if (!keyFields[i].equals(DataRecord.VALIDFROM) && r.get(keyFields[i]) == null) { if (dataAccess.getMetaData().getFieldType(keyFields[i]) == IDataAccess.DATA_UUID) { r.set(keyFields[i], UUID.randomUUID()); } else { logImportFailed(r, "KeyField(s) not set", null); return false; } } } } } key = r.getKey(); if (versionized) { otherVersions = dataAccess.getValidAny(key); } else { DataRecord r1 = dataAccess.get(key); otherVersions = (r1 != null ? new DataRecord[] {r1} : null); } if (importMode.equals(IMPORTMODE_ADD) && otherVersions != null && otherVersions.length > 0 && logbookEntryNoHandling != null && logbookEntryNoHandling.equals(ENTRYNO_DUPLICATE_ADDEND)) { r.set(keyFields[0], ((Logbook) storageObject).getNextEntryNo()); otherVersions = null; } if (importMode.equals(IMPORTMODE_ADD)) { if (otherVersions != null && otherVersions.length > 0) { logImportFailed(r, International.getString("Datensatz existiert bereits"), null); return false; } else { addRecord(r); return true; } } if (importMode.equals(IMPORTMODE_UPD)) { if (otherVersions == null || otherVersions.length == 0) { logImportFailed(r, International.getString("Datensatz nicht gefunden"), null); return false; } else { updateRecord(r, fieldsInInport); return true; } } if (importMode.equals(IMPORTMODE_ADDUPD)) { if (otherVersions != null && otherVersions.length > 0) { updateRecord(r, fieldsInInport); } else { addRecord(r); } return true; } } catch (Exception e) { logImportFailed(r, e.getMessage(), e); } return false; }
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 { 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 { CFSecurityXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = 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("RqstSecSessionDeleteBySecProxyIdx"); 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()"); } // 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("SecProxyId")) { if (attrSecProxyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecProxyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types UUID natSecProxyId; if ((attrSecProxyId == null) || (attrSecProxyId.length() <= 0)) { natSecProxyId = null; } else { natSecProxyId = UUID.fromString(attrSecProxyId); } // Delete the objects schemaObj.getSecSessionTableObj().deleteSecSessionBySecProxyIdx(natSecProxyId); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFSecurityXMsgSecSessionMessageFormatter.formatSecSessionRspnDeleted() + "\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; 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 { try { // Common XML Attributes String attrId = null; // SecUser Attributes String attrLoginId = null; String attrEMailAddress = null; String attrEMailConfirmationUuid = null; String attrPasswordHash = null; String attrPasswordResetUuid = null; String attrDefDev = null; // SecUser References ICFSecuritySecDeviceObj refDefDev = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("SecUser"); CFSecuritySaxLoader saxLoader = (CFSecuritySaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFSecuritySchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFSecuritySecUserEditObj editBuff = (ICFSecuritySecUserEditObj) schemaObj.getSecUserTableObj().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("LoginId")) { if (attrLoginId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLoginId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EMailAddress")) { if (attrEMailAddress != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEMailAddress = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EMailConfirmationUuid")) { if (attrEMailConfirmationUuid != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEMailConfirmationUuid = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PasswordHash")) { if (attrPasswordHash != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPasswordHash = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PasswordResetUuid")) { if (attrPasswordResetUuid != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPasswordResetUuid = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefDev")) { if (attrDefDev != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefDev = 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 (attrLoginId == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "LoginId"); } if (attrEMailAddress == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "EMailAddress"); } if (attrPasswordHash == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "PasswordHash"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("LoginId", attrLoginId); curContext.putNamedValue("EMailAddress", attrEMailAddress); curContext.putNamedValue("EMailConfirmationUuid", attrEMailConfirmationUuid); curContext.putNamedValue("PasswordHash", attrPasswordHash); curContext.putNamedValue("PasswordResetUuid", attrPasswordResetUuid); curContext.putNamedValue("DefDev", attrDefDev); // 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 natLoginId = attrLoginId; editBuff.setRequiredLoginId(natLoginId); String natEMailAddress = attrEMailAddress; editBuff.setRequiredEMailAddress(natEMailAddress); UUID natEMailConfirmationUuid; if ((attrEMailConfirmationUuid == null) || (attrEMailConfirmationUuid.length() <= 0)) { natEMailConfirmationUuid = null; } else { natEMailConfirmationUuid = UUID.fromString(attrEMailConfirmationUuid); } editBuff.setOptionalEMailConfirmationUuid(natEMailConfirmationUuid); String natPasswordHash = attrPasswordHash; editBuff.setRequiredPasswordHash(natPasswordHash); UUID natPasswordResetUuid; if ((attrPasswordResetUuid == null) || (attrPasswordResetUuid.length() <= 0)) { natPasswordResetUuid = null; } else { natPasswordResetUuid = UUID.fromString(attrPasswordResetUuid); } editBuff.setOptionalPasswordResetUuid(natPasswordResetUuid); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } // Lookup refDefDev by key name value attr if ((attrDefDev != null) && (attrDefDev.length() > 0)) { refDefDev = (ICFSecuritySecDeviceObj) schemaObj .getSecDeviceTableObj() .readSecDeviceByIdIdx(editBuff.getOptionalDefaultDevSecUserId(), attrDefDev); if (refDefDev == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve DefDev reference named \"" + attrDefDev + "\" to table SecDevice"); } } else { refDefDev = null; } editBuff.setOptionalLookupDefDev(refDefDev); CFSecuritySaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getSecUserLoaderBehaviour(); ICFSecuritySecUserEditObj editSecUser = null; ICFSecuritySecUserObj origSecUser = (ICFSecuritySecUserObj) schemaObj.getSecUserTableObj().readSecUserByULoginIdx(editBuff.getRequiredLoginId()); if (origSecUser == null) { editSecUser = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editSecUser = (ICFSecuritySecUserEditObj) origSecUser.beginEdit(); editSecUser.setRequiredLoginId(editBuff.getRequiredLoginId()); editSecUser.setRequiredEMailAddress(editBuff.getRequiredEMailAddress()); editSecUser.setOptionalEMailConfirmationUuid( editBuff.getOptionalEMailConfirmationUuid()); editSecUser.setRequiredPasswordHash(editBuff.getRequiredPasswordHash()); editSecUser.setOptionalPasswordResetUuid(editBuff.getOptionalPasswordResetUuid()); editSecUser.setOptionalLookupDefDev(editBuff.getOptionalLookupDefDev()); break; case Replace: editSecUser = (ICFSecuritySecUserEditObj) origSecUser.beginEdit(); editSecUser.delete(); editSecUser.endEdit(); origSecUser = null; editSecUser = editBuff; break; } } if (editSecUser != null) { if (origSecUser != null) { editSecUser.update(); } else { origSecUser = (ICFSecuritySecUserObj) editSecUser.create(); } editSecUser.endEdit(); } curContext.putNamedValue("Object", origSecUser); } 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); } }