private void addAdditionalXmlSchema(ClientResponse response, String requestedEntity) { if (response.appData.getElementsByTagNameNS(null, "ResponseTemplate").getLength() > 0) { Node responseTemplateNode = response.appData.getElementsByTagNameNS("", "ResponseTemplate").item(0); Node typeAttr = responseTemplateNode .getAttributes() .getNamedItemNS("http://www.w3.org/2001/XMLSchema-instance", "type"); String attributeValue = typeAttr.getNodeValue(); String schemaURI = EXPORT_ENTITY_SCHEMA_MAP.get(requestedEntity); response.appData.setAttributeNS( "http://www.w3.org/2000/xmlns/", "xmlns:" + attributeValue.split(":")[0], schemaURI); } }
static { PERSON_DOCUMENT_ID_MAP = new HashMap<String, String>(); PERSON_DOCUMENT_ID_MAP.put("01", "payerPersonDocumentID2"); PERSON_DOCUMENT_ID_MAP.put("02", "payerPersonDocumentID3"); PERSON_DOCUMENT_ID_MAP.put("03", "payerPersonDocumentID4"); PERSON_DOCUMENT_ID_MAP.put("04", "payerPersonDocumentID5"); PERSON_DOCUMENT_ID_MAP.put("05", "payerPersonDocumentID6"); PERSON_DOCUMENT_ID_MAP.put("06", "payerPersonDocumentID7"); PERSON_DOCUMENT_ID_MAP.put("07", "payerPersonDocumentID8"); PERSON_DOCUMENT_ID_MAP.put("08", "payerPersonDocumentID9"); PERSON_DOCUMENT_ID_MAP.put("09", "payerPersonDocumentID10"); PERSON_DOCUMENT_ID_MAP.put("10", "payerPersonDocumentID11"); PERSON_DOCUMENT_ID_MAP.put("11", "payerPersonDocumentID12"); PERSON_DOCUMENT_ID_MAP.put("12", "payerPersonDocumentID13"); PERSON_DOCUMENT_ID_MAP.put("13", "payerPersonDocumentID14"); PERSON_DOCUMENT_ID_MAP.put("21", "payerPersonDocumentID15"); PERSON_DOCUMENT_ID_MAP.put("22", "payerPersonDocumentID16"); PERSON_DOCUMENT_ID_MAP.put("23", "payerPersonDocumentID17"); PERSON_DOCUMENT_ID_MAP.put("24", "payerPersonDocumentID18"); EXPORT_ENTITY_SCHEMA_MAP = new HashMap<String, String>(); EXPORT_ENTITY_SCHEMA_MAP.put("QUITTANCE", "http://roskazna.ru/xsd/ExportQuittanceResponse"); EXPORT_ENTITY_SCHEMA_MAP.put("CHARGE", "http://roskazna.ru/xsd/PGU_ChargesResponse"); EXPORT_ENTITY_SCHEMA_MAP.put("CHARGESTATUS", "http://roskazna.ru/xsd/PGU_ChargesResponse"); EXPORT_ENTITY_SCHEMA_MAP.put( "CHARGENOTFULLMATCHED", "http://roskazna.ru/xsd/PGU_ChargesResponse"); EXPORT_ENTITY_SCHEMA_MAP.put("PAYMENT", "http://roskazna.ru/xsd/ExportPaymentsResponse"); EXPORT_ENTITY_SCHEMA_MAP.put( "PAYMENTUNMATCHED", "http://roskazna.ru/xsd/ExportPaymentsResponse"); EXPORT_ENTITY_SCHEMA_MAP.put( "PAYMENTMODIFIED", "http://roskazna.ru/xsd/ExportPaymentsResponse"); }
private String getPersonDocumentId(ExchangeContext ctx, String suffix, String payerType) { String documentVarName = PERSON_DOCUMENT_ID_MAP.get(payerType); documentVarName = documentVarName + suffix; return getStringFromContext(ctx, documentVarName, "").replace("-", "").toUpperCase(); }