public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // FSSFProfileDomain Attributes String attrTenantId = null; String attrFSSFProfileDomainId = null; String attrFSSFProfileId = null; String attrName = null; String attrAlias = null; String attrParse = 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("RspnFSSFProfileDomainLocked"); 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("FSSFProfileDomainId")) { if (attrFSSFProfileDomainId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFProfileDomainId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FSSFProfileId")) { if (attrFSSFProfileId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFSSFProfileId = 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("Alias")) { if (attrAlias != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrAlias = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Parse")) { if (attrParse != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrParse = 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 ((attrFSSFProfileDomainId == null) || (attrFSSFProfileDomainId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFProfileDomainId"); } if ((attrFSSFProfileId == null) || (attrFSSFProfileId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FSSFProfileId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrAlias == null) || (attrAlias.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Alias"); } if ((attrParse == null) || (attrParse.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Parse"); } 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 natFSSFProfileDomainId = Long.parseLong(attrFSSFProfileDomainId); long natFSSFProfileId = Long.parseLong(attrFSSFProfileId); String natName = attrName; boolean natAlias; if (attrAlias.equals("true") || attrAlias.equals("yes") || attrAlias.equals("1")) { natAlias = true; } else if (attrAlias.equals("false") || attrAlias.equals("no") || attrAlias.equals("0")) { natAlias = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected Alias value, must be one of true, false, yes, no, 1, or 0, not \"" + attrAlias + "\""); } boolean natParse; if (attrParse.equals("true") || attrParse.equals("yes") || attrParse.equals("1")) { natParse = true; } else if (attrParse.equals("false") || attrParse.equals("no") || attrParse.equals("0")) { natParse = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected Parse value, must be one of true, false, yes, no, 1, or 0, not \"" + attrParse + "\""); } 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 ICFFreeSwitchFSSFProfileDomainObj obj = (ICFFreeSwitchFSSFProfileDomainObj) schemaObj.getFSSFProfileDomainTableObj().newInstance(); CFFreeSwitchFSSFProfileDomainBuff dataBuff = obj.getFSSFProfileDomainBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredFSSFProfileDomainId(natFSSFProfileDomainId); dataBuff.setRequiredFSSFProfileId(natFSSFProfileId); dataBuff.setRequiredName(natName); dataBuff.setRequiredAlias(natAlias); dataBuff.setRequiredParse(natParse); 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(); ICFFreeSwitchFSSFProfileDomainObj realized = (ICFFreeSwitchFSSFProfileDomainObj) 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 createFSSFProfileDomain( CFSecurityAuthorization Authorization, CFFreeSwitchFSSFProfileDomainBuff Buff) { final String S_ProcName = "createFSSFProfileDomain"; String rqst = CFFreeSwitchXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgFSSFProfileDomainMessageFormatter.formatFSSFProfileDomainRqstCreate( "\n\t\t\t", Buff) + "\n" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); try { schema.getCFTipClientHandler().issueAppRequest(rqst); } catch (BadPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught BadPaddingException - " + e.getMessage(), e); } catch (IllegalBlockSizeException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught IllegalBlockSizeException - " + e.getMessage(), e); } catch (InvalidKeyException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidKeyException - " + e.getMessage(), e); } catch (NoSuchAlgorithmException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchAlgorithmException - " + e.getMessage(), e); } catch (InvalidAlgorithmParameterException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidAlgorithmParameterException - " + e.getMessage(), e); } catch (NoSuchPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchPaddingException - " + e.getMessage(), e); } ICFTipResponseHandler responseHandler = schema.getCFTipClientHandler().getResponseHandler(); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFFreeSwitchFSSFProfileDomainObj realized = null; if (lastObjectProcessed instanceof ICFFreeSwitchFSSFProfileDomainObj) { realized = (ICFFreeSwitchFSSFProfileDomainObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFFreeSwitchFSSFProfileDomainObj"); } if (realized != null) { Buff.set(realized.getFSSFProfileDomainBuff()); } } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "responseHandler.getLastObjectProcessed()"); } }