public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter 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("RqstBlobColReadAll"); 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("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<ICFBamBlobColObj> list = schemaObj.getBlobColTableObj().readAllBlobCol(true); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgBlobColMessageFormatter.formatBlobColRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFBamBlobColObj> iter = list.iterator(); ICFBamBlobColObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFBamXMsgBlobColMessageFormatter.formatBlobColRspnDerivedRec( "\n\t\t", cur.getBlobColBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFBamXMsgBlobColMessageFormatter.formatBlobColRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTenantId = null; String attrTableId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstBlobColDeleteByTableIdx"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TableId")) { if (attrTableId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTableId = 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 ((attrTableId == null) || (attrTableId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TableId"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId; natTenantId = Long.parseLong(attrTenantId); long natTableId; natTableId = Long.parseLong(attrTableId); // Delete the objects schemaObj.getBlobColTableObj().deleteBlobColByTableIdx(natTenantId, natTableId); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgBlobColMessageFormatter.formatBlobColRspnDeleted() + "\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 static String formatValueRspnDerivedRec(String separator, CFBamValueBuff buff) { String retval; final String S_ProcName = "formatValueRspnDerivedRec"; String classCode = buff.getClassCode(); if (classCode.equals("VALU")) { retval = formatValueRspnRec(separator, buff); } else if (classCode.equals("TBLC")) { retval = CFBamXMsgTableColMessageFormatter.formatTableColRspnRec( separator, (CFBamTableColBuff) buff); } else if (classCode.equals("ATOM")) { retval = CFBamXMsgAtomMessageFormatter.formatAtomRspnRec(separator, (CFBamAtomBuff) buff); } else if (classCode.equals("BLBD")) { retval = CFBamXMsgBlobDefMessageFormatter.formatBlobDefRspnRec(separator, (CFBamBlobDefBuff) buff); } else if (classCode.equals("BLBC")) { retval = CFBamXMsgBlobColMessageFormatter.formatBlobColRspnRec(separator, (CFBamBlobColBuff) buff); } else if (classCode.equals("BLBT")) { retval = CFBamXMsgBlobTypeMessageFormatter.formatBlobTypeRspnRec( separator, (CFBamBlobTypeBuff) buff); } else if (classCode.equals("BOLD")) { retval = CFBamXMsgBoolDefMessageFormatter.formatBoolDefRspnRec(separator, (CFBamBoolDefBuff) buff); } else if (classCode.equals("BOLC")) { retval = CFBamXMsgBoolColMessageFormatter.formatBoolColRspnRec(separator, (CFBamBoolColBuff) buff); } else if (classCode.equals("BOLT")) { retval = CFBamXMsgBoolTypeMessageFormatter.formatBoolTypeRspnRec( separator, (CFBamBoolTypeBuff) buff); } else if (classCode.equals("I16D")) { retval = CFBamXMsgInt16DefMessageFormatter.formatInt16DefRspnRec( separator, (CFBamInt16DefBuff) buff); } else if (classCode.equals("I16C")) { retval = CFBamXMsgInt16ColMessageFormatter.formatInt16ColRspnRec( separator, (CFBamInt16ColBuff) buff); } else if (classCode.equals("I16T")) { retval = CFBamXMsgInt16TypeMessageFormatter.formatInt16TypeRspnRec( separator, (CFBamInt16TypeBuff) buff); } else if (classCode.equals("IG16")) { retval = CFBamXMsgId16GenMessageFormatter.formatId16GenRspnRec(separator, (CFBamId16GenBuff) buff); } else if (classCode.equals("ENMD")) { retval = CFBamXMsgEnumDefMessageFormatter.formatEnumDefRspnRec(separator, (CFBamEnumDefBuff) buff); } else if (classCode.equals("ENMC")) { retval = CFBamXMsgEnumColMessageFormatter.formatEnumColRspnRec(separator, (CFBamEnumColBuff) buff); } else if (classCode.equals("ENMT")) { retval = CFBamXMsgEnumTypeMessageFormatter.formatEnumTypeRspnRec( separator, (CFBamEnumTypeBuff) buff); } else if (classCode.equals("I32D")) { retval = CFBamXMsgInt32DefMessageFormatter.formatInt32DefRspnRec( separator, (CFBamInt32DefBuff) buff); } else if (classCode.equals("I32C")) { retval = CFBamXMsgInt32ColMessageFormatter.formatInt32ColRspnRec( separator, (CFBamInt32ColBuff) buff); } else if (classCode.equals("I32T")) { retval = CFBamXMsgInt32TypeMessageFormatter.formatInt32TypeRspnRec( separator, (CFBamInt32TypeBuff) buff); } else if (classCode.equals("IG32")) { retval = CFBamXMsgId32GenMessageFormatter.formatId32GenRspnRec(separator, (CFBamId32GenBuff) buff); } else if (classCode.equals("I64D")) { retval = CFBamXMsgInt64DefMessageFormatter.formatInt64DefRspnRec( separator, (CFBamInt64DefBuff) buff); } else if (classCode.equals("I64C")) { retval = CFBamXMsgInt64ColMessageFormatter.formatInt64ColRspnRec( separator, (CFBamInt64ColBuff) buff); } else if (classCode.equals("I64T")) { retval = CFBamXMsgInt64TypeMessageFormatter.formatInt64TypeRspnRec( separator, (CFBamInt64TypeBuff) buff); } else if (classCode.equals("IG64")) { retval = CFBamXMsgId64GenMessageFormatter.formatId64GenRspnRec(separator, (CFBamId64GenBuff) buff); } else if (classCode.equals("U16D")) { retval = CFBamXMsgUInt16DefMessageFormatter.formatUInt16DefRspnRec( separator, (CFBamUInt16DefBuff) buff); } else if (classCode.equals("U16C")) { retval = CFBamXMsgUInt16ColMessageFormatter.formatUInt16ColRspnRec( separator, (CFBamUInt16ColBuff) buff); } else if (classCode.equals("U16T")) { retval = CFBamXMsgUInt16TypeMessageFormatter.formatUInt16TypeRspnRec( separator, (CFBamUInt16TypeBuff) buff); } else if (classCode.equals("U32D")) { retval = CFBamXMsgUInt32DefMessageFormatter.formatUInt32DefRspnRec( separator, (CFBamUInt32DefBuff) buff); } else if (classCode.equals("U32C")) { retval = CFBamXMsgUInt32ColMessageFormatter.formatUInt32ColRspnRec( separator, (CFBamUInt32ColBuff) buff); } else if (classCode.equals("U32T")) { retval = CFBamXMsgUInt32TypeMessageFormatter.formatUInt32TypeRspnRec( separator, (CFBamUInt32TypeBuff) buff); } else if (classCode.equals("U64D")) { retval = CFBamXMsgUInt64DefMessageFormatter.formatUInt64DefRspnRec( separator, (CFBamUInt64DefBuff) buff); } else if (classCode.equals("U64C")) { retval = CFBamXMsgUInt64ColMessageFormatter.formatUInt64ColRspnRec( separator, (CFBamUInt64ColBuff) buff); } else if (classCode.equals("U64T")) { retval = CFBamXMsgUInt64TypeMessageFormatter.formatUInt64TypeRspnRec( separator, (CFBamUInt64TypeBuff) buff); } else if (classCode.equals("FLTD")) { retval = CFBamXMsgFloatDefMessageFormatter.formatFloatDefRspnRec( separator, (CFBamFloatDefBuff) buff); } else if (classCode.equals("FLTC")) { retval = CFBamXMsgFloatColMessageFormatter.formatFloatColRspnRec( separator, (CFBamFloatColBuff) buff); } else if (classCode.equals("FLTT")) { retval = CFBamXMsgFloatTypeMessageFormatter.formatFloatTypeRspnRec( separator, (CFBamFloatTypeBuff) buff); } else if (classCode.equals("DBLD")) { retval = CFBamXMsgDoubleDefMessageFormatter.formatDoubleDefRspnRec( separator, (CFBamDoubleDefBuff) buff); } else if (classCode.equals("DBLC")) { retval = CFBamXMsgDoubleColMessageFormatter.formatDoubleColRspnRec( separator, (CFBamDoubleColBuff) buff); } else if (classCode.equals("DBLT")) { retval = CFBamXMsgDoubleTypeMessageFormatter.formatDoubleTypeRspnRec( separator, (CFBamDoubleTypeBuff) buff); } else if (classCode.equals("NUMD")) { retval = CFBamXMsgNumberDefMessageFormatter.formatNumberDefRspnRec( separator, (CFBamNumberDefBuff) buff); } else if (classCode.equals("NUMC")) { retval = CFBamXMsgNumberColMessageFormatter.formatNumberColRspnRec( separator, (CFBamNumberColBuff) buff); } else if (classCode.equals("NUMT")) { retval = CFBamXMsgNumberTypeMessageFormatter.formatNumberTypeRspnRec( separator, (CFBamNumberTypeBuff) buff); } else if (classCode.equals("STRD")) { retval = CFBamXMsgStringDefMessageFormatter.formatStringDefRspnRec( separator, (CFBamStringDefBuff) buff); } else if (classCode.equals("STRC")) { retval = CFBamXMsgStringColMessageFormatter.formatStringColRspnRec( separator, (CFBamStringColBuff) buff); } else if (classCode.equals("STRT")) { retval = CFBamXMsgStringTypeMessageFormatter.formatStringTypeRspnRec( separator, (CFBamStringTypeBuff) buff); } else if (classCode.equals("TXTD")) { retval = CFBamXMsgTextDefMessageFormatter.formatTextDefRspnRec(separator, (CFBamTextDefBuff) buff); } else if (classCode.equals("TXTC")) { retval = CFBamXMsgTextColMessageFormatter.formatTextColRspnRec(separator, (CFBamTextColBuff) buff); } else if (classCode.equals("TXTT")) { retval = CFBamXMsgTextTypeMessageFormatter.formatTextTypeRspnRec( separator, (CFBamTextTypeBuff) buff); } else if (classCode.equals("NTKD")) { retval = CFBamXMsgNmTokenDefMessageFormatter.formatNmTokenDefRspnRec( separator, (CFBamNmTokenDefBuff) buff); } else if (classCode.equals("NTKC")) { retval = CFBamXMsgNmTokenColMessageFormatter.formatNmTokenColRspnRec( separator, (CFBamNmTokenColBuff) buff); } else if (classCode.equals("NTKT")) { retval = CFBamXMsgNmTokenTypeMessageFormatter.formatNmTokenTypeRspnRec( separator, (CFBamNmTokenTypeBuff) buff); } else if (classCode.equals("NTSD")) { retval = CFBamXMsgNmTokensDefMessageFormatter.formatNmTokensDefRspnRec( separator, (CFBamNmTokensDefBuff) buff); } else if (classCode.equals("NTSC")) { retval = CFBamXMsgNmTokensColMessageFormatter.formatNmTokensColRspnRec( separator, (CFBamNmTokensColBuff) buff); } else if (classCode.equals("NTST")) { retval = CFBamXMsgNmTokensTypeMessageFormatter.formatNmTokensTypeRspnRec( separator, (CFBamNmTokensTypeBuff) buff); } else if (classCode.equals("TKND")) { retval = CFBamXMsgTokenDefMessageFormatter.formatTokenDefRspnRec( separator, (CFBamTokenDefBuff) buff); } else if (classCode.equals("TKNC")) { retval = CFBamXMsgTokenColMessageFormatter.formatTokenColRspnRec( separator, (CFBamTokenColBuff) buff); } else if (classCode.equals("TKNT")) { retval = CFBamXMsgTokenTypeMessageFormatter.formatTokenTypeRspnRec( separator, (CFBamTokenTypeBuff) buff); } else if (classCode.equals("DATD")) { retval = CFBamXMsgDateDefMessageFormatter.formatDateDefRspnRec(separator, (CFBamDateDefBuff) buff); } else if (classCode.equals("DATC")) { retval = CFBamXMsgDateColMessageFormatter.formatDateColRspnRec(separator, (CFBamDateColBuff) buff); } else if (classCode.equals("DATT")) { retval = CFBamXMsgDateTypeMessageFormatter.formatDateTypeRspnRec( separator, (CFBamDateTypeBuff) buff); } else if (classCode.equals("TIMD")) { retval = CFBamXMsgTimeDefMessageFormatter.formatTimeDefRspnRec(separator, (CFBamTimeDefBuff) buff); } else if (classCode.equals("TIMC")) { retval = CFBamXMsgTimeColMessageFormatter.formatTimeColRspnRec(separator, (CFBamTimeColBuff) buff); } else if (classCode.equals("TIMT")) { retval = CFBamXMsgTimeTypeMessageFormatter.formatTimeTypeRspnRec( separator, (CFBamTimeTypeBuff) buff); } else if (classCode.equals("TSPD")) { retval = CFBamXMsgTimestampDefMessageFormatter.formatTimestampDefRspnRec( separator, (CFBamTimestampDefBuff) buff); } else if (classCode.equals("TSPC")) { retval = CFBamXMsgTimestampColMessageFormatter.formatTimestampColRspnRec( separator, (CFBamTimestampColBuff) buff); } else if (classCode.equals("TSPT")) { retval = CFBamXMsgTimestampTypeMessageFormatter.formatTimestampTypeRspnRec( separator, (CFBamTimestampTypeBuff) buff); } else if (classCode.equals("DAZD")) { retval = CFBamXMsgTZDateDefMessageFormatter.formatTZDateDefRspnRec( separator, (CFBamTZDateDefBuff) buff); } else if (classCode.equals("DAZC")) { retval = CFBamXMsgTZDateColMessageFormatter.formatTZDateColRspnRec( separator, (CFBamTZDateColBuff) buff); } else if (classCode.equals("DAZT")) { retval = CFBamXMsgTZDateTypeMessageFormatter.formatTZDateTypeRspnRec( separator, (CFBamTZDateTypeBuff) buff); } else if (classCode.equals("TMZD")) { retval = CFBamXMsgTZTimeDefMessageFormatter.formatTZTimeDefRspnRec( separator, (CFBamTZTimeDefBuff) buff); } else if (classCode.equals("TMZC")) { retval = CFBamXMsgTZTimeColMessageFormatter.formatTZTimeColRspnRec( separator, (CFBamTZTimeColBuff) buff); } else if (classCode.equals("TMZT")) { retval = CFBamXMsgTZTimeTypeMessageFormatter.formatTZTimeTypeRspnRec( separator, (CFBamTZTimeTypeBuff) buff); } else if (classCode.equals("ZSTD")) { retval = CFBamXMsgTZTimestampDefMessageFormatter.formatTZTimestampDefRspnRec( separator, (CFBamTZTimestampDefBuff) buff); } else if (classCode.equals("ZSTC")) { retval = CFBamXMsgTZTimestampColMessageFormatter.formatTZTimestampColRspnRec( separator, (CFBamTZTimestampColBuff) buff); } else if (classCode.equals("ZSTT")) { retval = CFBamXMsgTZTimestampTypeMessageFormatter.formatTZTimestampTypeRspnRec( separator, (CFBamTZTimestampTypeBuff) buff); } else if (classCode.equals("UIDD")) { retval = CFBamXMsgUuidDefMessageFormatter.formatUuidDefRspnRec(separator, (CFBamUuidDefBuff) buff); } else if (classCode.equals("UIDC")) { retval = CFBamXMsgUuidColMessageFormatter.formatUuidColRspnRec(separator, (CFBamUuidColBuff) buff); } else if (classCode.equals("UIDT")) { retval = CFBamXMsgUuidTypeMessageFormatter.formatUuidTypeRspnRec( separator, (CFBamUuidTypeBuff) buff); } else if (classCode.equals("IGUU")) { retval = CFBamXMsgUuidGenMessageFormatter.formatUuidGenRspnRec(separator, (CFBamUuidGenBuff) buff); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( CFBamXMsgValueMessageFormatter.class, S_ProcName, "buff", buff, "derivative of Value"); } return (retval); }