public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support String attrTenantId = null; String attrTSecGroupId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTSecGroupLock"); 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 a PKey buffer for the parsed information CFSecurityTSecGroupPKey pkey = ((ICFFreeSwitchSchema) schemaObj.getBackingStore()).getFactoryTSecGroup().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TSecGroupId")) { if (attrTSecGroupId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTSecGroupId = 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"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); pkey.setRequiredTenantId(natTenantId); int natTSecGroupId; natTSecGroupId = Integer.parseInt(attrTSecGroupId); pkey.setRequiredTSecGroupId(natTSecGroupId); pkey.setRequiredTSecGroupId(natTSecGroupId); // Lock the object ICFFreeSwitchTSecGroupObj locked = ((ICFFreeSwitchTSecGroupObj) schemaObj.getTSecGroupTableObj().lockTSecGroup(pkey)); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgTSecGroupMessageFormatter.formatTSecGroupRspnLocked( "\n\t\t\t", locked.getTSecGroupBuff()) + "\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 { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTenantId = null; String attrFSSofiaId = 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("RqstFSSFVMailDeleteByUNameIdx"); 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("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("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 ((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"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId; natTenantId = Long.parseLong(attrTenantId); long natFSSofiaId; natFSSofiaId = Long.parseLong(attrFSSofiaId); String natName; natName = attrName; // Delete the objects schemaObj .getFSSFVMailTableObj() .deleteFSSFVMailByUNameIdx(natTenantId, natFSSofiaId, natName); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgFSSFVMailMessageFormatter.formatFSSFVMailRspnDeleted() + "\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 { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTSecGroupIncludeReadAll"); 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("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Read the objects and prepare the response XML List<ICFSecurityTSecGroupIncludeObj> list = schemaObj.getTSecGroupIncludeTableObj().readAllTSecGroupInclude(true); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgTSecGroupIncludeMessageFormatter .formatTSecGroupIncludeRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecurityTSecGroupIncludeObj> iter = list.iterator(); ICFSecurityTSecGroupIncludeObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFFreeSwitchXMsgTSecGroupIncludeMessageFormatter.formatTSecGroupIncludeRspnDerivedRec( "\n\t\t", cur.getTSecGroupIncludeBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFFreeSwitchXMsgTSecGroupIncludeMessageFormatter .formatTSecGroupIncludeRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } 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 { 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 { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrTenantId = null; String attrFSSFDirectoryId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstFSSFDirectoryDelete"); 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 a PKey buffer for the parsed information CFFreeSwitchFSSFDirectoryPKey pkey = ((ICFFreeSwitchSchema) schemaObj.getBackingStore()).getFactoryFSSFDirectory().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FSSFDirectoryId")) { if (attrFSSFDirectoryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFDirectoryId = 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 ((attrFSSFDirectoryId == null) || (attrFSSFDirectoryId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFDirectoryId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); pkey.setRequiredTenantId(natTenantId); long natFSSFDirectoryId; natFSSFDirectoryId = Long.parseLong(attrFSSFDirectoryId); pkey.setRequiredFSSFDirectoryId(natFSSFDirectoryId); pkey.setRequiredFSSFDirectoryId(natFSSFDirectoryId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFFreeSwitchFSSFDirectoryObj read = ((ICFFreeSwitchFSSFDirectoryObj) schemaObj.getFSSFDirectoryTableObj().readFSSFDirectory(pkey)); if (read != null) { if (read.getFSSFDirectoryBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete FSSFDirectory"); } else { ICFFreeSwitchFSSFDirectoryEditObj editBuff = (ICFFreeSwitchFSSFDirectoryEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgFSSFDirectoryMessageFormatter.formatFSSFDirectoryRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\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); } }