Commit fbb7e457 by chengzhuoshen

开发要素转MX功能,pacs008001,pacs009001,camt053001

parent c569b500
package com.brilliance.swift.element2mx;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.*;
public abstract class AbstractElement2MxCreator implements Element2MxCreator{
protected Map<String, Object> jsonMaps = new HashMap<>();
/**
* 目标xml
*/
protected String xmlStr;
protected Properties properties;
public String getXmlStr() {
return xmlStr;
}
public void setXmlStr(String xmlStr) {
this.xmlStr = xmlStr;
}
protected Map<String, Object> elementMaps = new HashMap<>();
public Map<String, Object> getElementMaps() {
return elementMaps;
}
public void setElementMaps(Map<String, Object> elementMaps) {
this.elementMaps = elementMaps;
}
protected boolean isArray(String key) {
return false;
}
protected void rebuildProperties() {
}
private void invokeHere(String methodName, Object where, Map<String, Object> maps, Object value) {
try {
Method method = getClass().getMethod(methodName, maps.getClass(), new Object().getClass());
method.invoke(where, maps, value);
} catch (NoSuchMethodException e) {
throw new SwiftException("Method " + methodName + " does not exist in " + getClass());
} catch (Exception e) {
throw new SwiftException(e.getMessage());
}
}
@Override
public void preProcess() {
String identifier = (String) elementMaps.get("messageType");
jsonMaps.put("identifier", identifier);
String fileName = "/template/"+identifier+".properties";
InputStream resourceAsStream = AbstractElement2MxCreator.class.getResourceAsStream(fileName);
if (resourceAsStream == null) {
fileName = "/template/"+identifier.substring(0, 10)+".properties";
resourceAsStream = AbstractElement2MxCreator.class.getResourceAsStream(fileName);
}
try {
properties = new Properties();
properties.load(resourceAsStream);
//重新编辑配置文件
rebuildProperties();
} catch (IOException e) {
throw new SwiftException(e.getMessage());
}
}
@Override
public void build() {
buildMap(jsonMaps, elementMaps, properties);
}
protected void buildMap(Map<String, Object> sourceMap, Map<String, Object> targetMap, Properties properties) {
//循环遍历elementMaps
Set<String> keys = targetMap.keySet();
for (String key : keys) {
if (properties.get(key) != null) {
String keyPath = (String) properties.get(key);
if (keyPath.startsWith("@")) {
String methodName = keyPath.substring(1);
String[] methodNames = methodName.split("&");
List<Object> obj = new ArrayList<>();
obj.add(targetMap.get(key));
if (methodNames.length > 1) {
for (int i=1; i<methodNames.length; i++) {
obj.add(methodNames[i]);
}
}
invokeHere(methodNames[0], this, sourceMap, obj);
continue;
}
//以 ?分隔
String[] keyPaths = keyPath.split("\\?");
for (String path : keyPaths) {
//过滤数据类型&
if (path.indexOf("&") > -1) {
path = path.substring(0, path.indexOf("&"));
}
if (path.indexOf("#") > -1) {
String[] paths = path.split("#");
String subPropName = paths[1];
String fileName = "/template/"+subPropName+".properties";
InputStream resourceAsStream = AbstractElement2MxCreator.class.getResourceAsStream(fileName);
if (resourceAsStream != null) { //读取子配置文件
try {
Properties subProperties = new Properties();
subProperties.load(resourceAsStream);
Object obj = processSubProperties(targetMap.get(key), subProperties);
if (obj != null) {
putObj(sourceMap, paths[0], obj);
}
} catch (IOException e) {
throw new SwiftException(e.getMessage());
}
}
} else {
putObj(sourceMap, path, targetMap.get(key));
}
}
}
}
}
/**
* 处理子配置文件逻辑
*/
protected Object processSubProperties(Object keyV, Properties subProperties) {
if (keyV instanceof JSONArray) {
JSONArray jsonArray = new JSONArray();
JSONArray keyVJsonArray = (JSONArray)keyV;
for (int i=0; i<keyVJsonArray.size(); i++) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> keyVMap = (Map<String, Object>)keyVJsonArray.get(i);
buildMap(map, keyVMap, subProperties);
jsonArray.add(map);
}
return jsonArray;
} else /*if (keyV instanceof JSONObject)*/ {
Map<String, Object> map = new HashMap<>();
Map<String, Object> keyVMap = (Map<String, Object>)keyV;
buildMap(map, keyVMap, subProperties);
return map;
}
}
/**
* 源map中通过指定的路径存放对象
* @param fullPath - 全路径, 以 . 分隔
* @param object - 目标对象
*/
protected void putObj(Map<String, Object> sourceMap, String fullPath, Object object) {
if (sourceMap == null || StringUtil.isEmpty(fullPath)) {
return;
}
String[] fullPaths = fullPath.split("\\.");
String parentPath = "";
Map<String, Object> map = sourceMap;
for (int i=0; i<fullPaths.length; i++) {
if (i > 0) parentPath = fullPaths[i-1];
String path = fullPaths[i];
if (i == fullPaths.length-1) {
map.put(path, object);
} else {
if (map.containsKey(path)) {
if (isArray(path) || isArray(parentPath+"."+path)) {
JSONArray jsonArray = (JSONArray)map.get(path);
map = (Map<String, Object>)jsonArray.get(0);
} else {
map = (Map<String, Object>)map.get(path);
}
} else {
if (isArray(path)|| isArray(parentPath+"."+path)) {
JSONArray jsonArray = new JSONArray();
map.put(path, jsonArray);
Map<String, Object> subMap = new HashMap<>();
jsonArray.add(subMap);
map = subMap;
} else {
Map<String, Object> subMap = new HashMap<>();
map.put(path, subMap);
map = subMap;
}
}
}
}
}
protected Object getObj(Map<String, Object> sourceMap, String fullPath) {
if (sourceMap == null || StringUtil.isEmpty(fullPath)) {
return null;
}
String[] fullPaths = fullPath.split("\\.");
String parentPath = "";
Map<String, Object> map = sourceMap;
for (int i=0; i<fullPaths.length; i++) {
if (i > 0) parentPath = fullPaths[i-1];
String path = fullPaths[i];
if (i == fullPaths.length-1) {
return map.get(path);
} else {
if (map.containsKey(path)) {
if (isArray(path) || isArray(parentPath+"."+path)) {
JSONArray jsonArray = (JSONArray)map.get(path);
map = (Map<String, Object>)jsonArray.get(0);
} else {
map = (Map<String, Object>)map.get(path);
}
} else {
if (isArray(path)|| isArray(parentPath+"."+path)) {
JSONArray jsonArray = new JSONArray();
map.put(path, jsonArray);
Map<String, Object> subMap = new HashMap<>();
jsonArray.add(subMap);
map = subMap;
} else {
Map<String, Object> subMap = new HashMap<>();
map.put(path, subMap);
map = subMap;
}
}
}
}
return null;
}
@Override
public void postProcess() {
String swiftGsonStr = new JSONObject(jsonMaps).toJSONString();
AbstractMX abstractMX = AbstractMX.fromJson(swiftGsonStr);
xmlStr = abstractMX.message();
}
}
package com.brilliance.swift.element2mx;
public interface Element2MxCreator {
/**
* 前置处理
*/
void preProcess();
void build();
/**
* 后置处理
*/
void postProcess();
}
package com.brilliance.swift.element2mx;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.swift.element2mx.camt053001.Element2MxCamt053001Creator;
import com.brilliance.swift.element2mx.pacs008001.Element2MxPacs008001Creator;
import com.brilliance.swift.element2mx.pacs009001.Element2MxPacs009001Creator;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.StringUtil;
import java.util.Map;
public class Element2MxCreatorManager {
public String element2Mx(String jsonStr) throws SwiftException {
Map<String, Object> elementMaps = (Map<String, Object>)JSONObject.parse(jsonStr);
String messageType = (String)elementMaps.get("messageType");
if (StringUtil.isEmpty(messageType)) {
throw new SwiftException("找不到MX类型");
}
AbstractElement2MxCreator creator = getCreator(messageType);
creator.setElementMaps(elementMaps);
creator.preProcess();
creator.build();
creator.postProcess();
return creator.getXmlStr();
}
public AbstractElement2MxCreator getCreator(String messageType) {
if (messageType.matches("pacs008001[0-9]{2}")) {
return new Element2MxPacs008001Creator();
} else if (messageType.matches("pacs009001[0-9]{2}")) {
return new Element2MxPacs009001Creator();
} else if (messageType.matches("camt053001[0-9]{2}")) {
return new Element2MxCamt053001Creator();
} else {
throw new SwiftException("无效的MX类型:" + messageType);
}
}
}
package com.brilliance.swift.element2mx.camt053001;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.swift.element2mx.AbstractElement2MxCreator;
import com.brilliance.swift.util.StringUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class Element2MxCamt053001Creator extends AbstractElement2MxCreator {
@Override
protected boolean isArray(String key) {
if ("stmt".equals(key) || "ntryDtls".equals(key)
|| "txDtls".equals(key)) {
return true;
}
return false;
}
@Override
protected void rebuildProperties() {
Set<Object> sets = properties.keySet();
for (Object obj : sets) {
String keyValue = properties.getProperty((String) obj);
if (keyValue.indexOf("(") > -1 && keyValue.indexOf(")") > -1) {
String condition = keyValue.substring(keyValue.indexOf("(")+1, keyValue.indexOf(")"));
String type = "";
if (StringUtil.isNotEmpty(condition)) {
type = condition.split(":")[1];
}
String path = keyValue.substring(keyValue.indexOf(")")+2);
if (StringUtil.isNotEmpty(path) && path.indexOf("&") > -1) {
path = path.substring(0, path.indexOf("&"));
}
if (StringUtil.isNotEmpty(type) && StringUtil.isNotEmpty(path)) {
properties.put(obj, "@addBal&"+type+"&"+path);
}
}
}
}
public void addBal(HashMap<String,Object> maps, Object obj) {
List<Object> objList = (List<Object>)obj;
Object value = objList.get(0);
String balanceType = (String) objList.get(1);
String valuePath = (String) objList.get(2);
Object balObj = getObj(maps, "bkToCstmrStmt.stmt.bal");
if (balObj == null) {
JSONArray jsonArray = new JSONArray();
putObj(maps, "bkToCstmrStmt.stmt.bal", jsonArray);
balObj = jsonArray;
}
if (balObj != null) {
JSONArray jsonArray = (JSONArray)balObj;
Map<String, Object> balMap = null;
for (int i=0; i<jsonArray.size(); i++) {
Map<String, Object> balTmpMaps = (Map<String, Object>)jsonArray.get(i);
if (balanceType.equals(getObj(balTmpMaps, "tp.cdOrPrtry.cd"))) {
balMap = balTmpMaps;
break;
}
}
if (balMap == null) {
balMap = new HashMap<>();
putObj(balMap, "tp.cdOrPrtry.cd", balanceType);
jsonArray.add(balMap);
}
putObj(balMap, valuePath, value);
}
}
}
package com.brilliance.swift.element2mx.pacs008001;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.element2mx.AbstractElement2MxCreator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Element2MxPacs008001Creator extends AbstractElement2MxCreator {
@Override
protected boolean isArray(String key) {
if ("cdtTrfTxInf".equals(key) || "orgId.othr".equals(key)
|| "prvtId.othr".equals(key) || "finInstnId.othr".equals(key)) {
return true;
}
return false;
}
@Override
protected void rebuildProperties() {
properties.setProperty("rltdRmtInf", "@buildRltdRmtInf");
}
public void buildRgltryRptg(HashMap<String,Object> maps, Object obj) {
List<Object> objList = (List<Object>)obj;
JSONArray jsonArray = (JSONArray)objList.get(0);
List<String> list = new ArrayList<>();
for (int i=0; i<jsonArray.size(); i++) {
list.add((String) jsonArray.get(i));
}
JSONArray rgltryRptgJsonArray = new JSONArray();
Map<String, Object> rgltryRptgMap = new HashMap<>();
rgltryRptgJsonArray.add(rgltryRptgMap);
JSONArray dtlsJsonArray = new JSONArray();
rgltryRptgMap.put("dtls", dtlsJsonArray);
Map<String, Object> dtlsRptgMap = new HashMap<>();
dtlsJsonArray.add(dtlsRptgMap);
dtlsRptgMap.put("inf", list);
putObj(maps, "fiToFICstmrCdtTrf.cdtTrfTxInf.rgltryRptg", rgltryRptgJsonArray);
}
public void buildStrdAddtlRmtInf(HashMap<String,Object> maps, Object obj) {
List<Object> objList = (List<Object>)obj;
JSONArray sourceJsonArray = new JSONArray();
JSONArray jsonArray = (JSONArray)objList.get(0);
List<String> list1 = null;
for (int i=0; i<jsonArray.size(); i++) {
if (i % 3 == 0) {
list1 = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("addtlRmtInf", list1);
sourceJsonArray.add(map);
}
list1.add((String) jsonArray.get(i));
}
putObj(maps, "fiToFICstmrCdtTrf.cdtTrfTxInf.rmtInf.strd", sourceJsonArray);
}
public void buildRltdRmtInf(HashMap<String,Object> maps, Object obj) {
List<Object> objList = (List<Object>)obj;
JSONArray rltdRmtInfJsonArray = new JSONArray();
JSONArray jsonArray = (JSONArray)objList.get(0);
for (int i=0; i<jsonArray.size(); i++) {
Map<String, Object> rltdRmtInfMap = new HashMap<>();
rltdRmtInfMap.put("rmtId", jsonArray.get(i));
rltdRmtInfJsonArray.add(rltdRmtInfMap);
}
putObj(maps, "fiToFICstmrCdtTrf.cdtTrfTxInf.rltdRmtInf", rltdRmtInfJsonArray);
}
@Override
public void postProcess() {
putObj(jsonMaps, "fiToFICstmrCdtTrf.grpHdr.nbOfTxs", 1);
super.postProcess();
}
}
package com.brilliance.swift.element2mx.pacs009001;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.element2mx.AbstractElement2MxCreator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Element2MxPacs009001Creator extends AbstractElement2MxCreator {
@Override
protected boolean isArray(String key) {
if ("cdtTrfTxInf".equals(key) || "orgId.othr".equals(key)
|| "prvtId.othr".equals(key) || "finInstnId.othr".equals(key)) {
return true;
}
return false;
}
public void buildStrdAddtlRmtInf(HashMap<String,Object> maps, Object obj) {
List<Object> objList = (List<Object>)obj;
JSONArray sourceJsonArray = new JSONArray();
JSONArray jsonArray = (JSONArray)objList.get(0);
List<String> list1 = null;
for (int i=0; i<jsonArray.size(); i++) {
if (i % 3 == 0) {
list1 = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("addtlRmtInf", list1);
sourceJsonArray.add(map);
}
list1.add((String) jsonArray.get(i));
}
putObj(maps, "rmtInf.strd", sourceJsonArray);
}
@Override
public void postProcess() {
putObj(jsonMaps, "fiCdtTrf.grpHdr.nbOfTxs", 1);
super.postProcess();
}
}
......@@ -43,7 +43,7 @@ public abstract class AbstractMx2ElementCreator implements Mx2ElementCreator{
try {
Method method = getClass().getMethod(methodName);
return method.invoke(where);
} catch (final NoSuchMethodException e) {
} catch (NoSuchMethodException e) {
throw new SwiftException("Method " + methodName + " does not exist in " + getClass());
} catch (Exception e) {
throw new SwiftException(e.getMessage());
......
......@@ -77,6 +77,9 @@ public class Field60Generate extends AbstractMx2MtTagsGenerate {
}
String balanceDate = "";
String dateStr = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Dt.Dt");
if (StringUtil.isEmpty(dateStr)) {
dateStr = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Dt.DtTm");
}
if (StringUtil.isNotEmpty(dateStr)) {
XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateStr);
balanceDate = DateUtil.format(date, "yyMMdd");
......
......@@ -74,6 +74,9 @@ public class Field62Generate extends AbstractMx2MtTagsGenerate {
}
String balanceDate = "";
String dateStr = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Dt.Dt");
if (StringUtil.isEmpty(dateStr)) {
dateStr = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Dt.DtTm");
}
if (StringUtil.isNotEmpty(dateStr)) {
XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateStr);
balanceDate = DateUtil.format(date, "yyMMdd");
......
......@@ -58,6 +58,9 @@ public class Field64Generate extends AbstractMx2MtTagsGenerate {
}
String balanceDate = "";
String dateStr = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Dt.Dt");
if (StringUtil.isEmpty(dateStr)) {
dateStr = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Dt.DtTm");
}
if (StringUtil.isNotEmpty(dateStr)) {
XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateStr);
balanceDate = DateUtil.format(date, "yyMMdd");
......
......@@ -160,8 +160,12 @@ public class DateUtil {
* @return
*/
public static String format(XMLGregorianCalendar xgc, String pattern) {
Date date = parseDate(xgc);
return DateUtil.format(date, pattern);
Calendar calendar = xgc.toGregorianCalendar();
DateFormat dateFormat = new SimpleDateFormat(pattern);
dateFormat.setTimeZone(calendar.getTimeZone());
return dateFormat.format(calendar.getTime());
/*Date date = xgc.toGregorianCalendar().getTime();
return DateUtil.format(date, pattern);*/
}
/**
......
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi?appHdr.fr.orgId.id.orgId.anyBIC
toBic=appHdr.to.fiId.finInstnId.bicfi?appHdr.to.orgId.id.orgId.anyBIC
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=rsltnOfInvstgtn.assgnmt.id?rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsId?appHdr.bizMsgIdr?rsltnOfInvstgtn.assgnmt.id
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
......
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi?appHdr.fr.orgId.id.orgId.anyBIC
toBic=appHdr.to.fiId.finInstnId.bicfi?appHdr.to.orgId.id.orgId.anyBIC
bizMsgIdr=bkToCstmrStmt.stmt.Id?bkToCstmrStmt.grpHdr.msgId?appHdr.bizMsgIdr
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=bkToCstmrStmt.stmt.id?bkToCstmrStmt.grpHdr.msgId?appHdr.bizMsgIdr
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
creDt=bkToCstmrStmt.grpHdr.creDtTm?appHdr.creDt
creDt=bkToCstmrStmt.stmt.creDtTm?bkToCstmrStmt.grpHdr.creDtTm?appHdr.creDt
priority=appHdr.prty
#BODY
#25
......@@ -27,6 +27,7 @@ opbdBalAmt=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:OPBD).amt.value&bigdecimal
opbdBalCcy=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:OPBD).amt.ccy
opbdBalCdtDbtInd=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:OPBD).cdtDbtInd
opbdBalDt=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:OPBD).dt.dt
opbdBalDtTm=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:OPBD).dt.dtTm
#61
ntry=bkToCstmrStmt.stmt.ntry#entry
#62
......@@ -36,6 +37,7 @@ clbdBalAmt=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLBD).amt.value&bigdecimal
clbdBalCcy=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLBD).amt.ccy
clbdBalCdtDbtInd=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLBD).cdtDbtInd
clbdBalDt=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLBD).dt.dt
clbdBalDtTm=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLBD).dt.dtTm
#64
clavBalSubType=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLAV).tp.subTp.cd
clavBalSubTypePrtry=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLAV).tp.subTp.prtry
......@@ -43,3 +45,4 @@ clavBalAmt=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLAV).amt.value&bigdecimal
clavBalCcy=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLAV).amt.ccy
clavBalCdtDbtInd=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLAV).cdtDbtInd
clavBalDt=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLAV).dt.dt
clavBalDtTm=bkToCstmrStmt.stmt.bal(tp.cdOrPrtry.cd:CLAV).dt.dtTm
\ No newline at end of file
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi?appHdr.fr.orgId.id.orgId.anyBIC
toBic=appHdr.to.fiId.finInstnId.bicfi?appHdr.to.orgId.id.orgId.anyBIC
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=bkToCstmrDbtCdtNtfctn.grpHdr.msgId?appHdr.bizMsgIdr
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
......
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi?appHdr.fr.orgId.id.orgId.anyBIC
toBic=appHdr.to.fiId.finInstnId.bicfi?appHdr.to.orgId.id.orgId.anyBIC
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=fiToFIPmtCxlReq.undrlyg.txInf._case.id?appHdr.bizMsgIdr?fiToFIPmtCxlReq.assgnmt.id
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
......
amt=amt.value&bigdecimal
ccy=amt.ccy
bicfi=agt.finInstnId.bicfi
\ No newline at end of file
ntryRef=ntryRef
ntryAmt=amt.value&bigdecimal
ntryCcy=amt.ccy
ntryCdtDbtInd=cdtDbtInd
ntryAmt=amt.value&bigdecimal?ntryDtls.txDtls.amt.value&bigdecimal
ntryCcy=amt.ccy?ntryDtls.txDtls.amt.ccy
ntryCdtDbtInd=cdtDbtInd?ntryDtls.txDtls.cdtDbtInd
ntryRvslInd=rvslInd&boolean
ntrySts=sts.cd
ntryStsPrtry=sts.prtry
ntryBookgDt=bookgDt.dt?bookgDt.dtTm
ntryValDt=valDt.dt?valDt.dtTm
ntryBookgDt=bookgDt.dt
ntryBookgDtTm=bookgDt.dtTm
ntryValDt=valDt.dt
ntryValDtTm=valDt.dtTm
ntryAcctSvcrRef=acctSvcrRef
ntryBkTxCdDomnCd=bkTxCd.domn.cd
ntryBkTxCdFmlyCd=bkTxCd.domn.fmly.cd
......@@ -15,3 +17,5 @@ ntryBkTxCdPrtryCd=bkTxCd.prtry.cd
endToEndId=ntryDtls.txDtls.refs.endToEndId
addtlTxInf=ntryDtls.txDtls.addtlTxInf
instrId=ntryDtls.txDtls.refs.instrId
ntryUetr=ntryDtls.txDtls.refs.uetr
ntryTxId=ntryDtls.txDtls.refs.txId
\ No newline at end of file
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi?appHdr.fr.orgId.id.orgId.anyBIC
toBic=appHdr.to.fiId.finInstnId.bicfi?appHdr.to.orgId.id.orgId.anyBIC
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=fiToFICstmrCdtTrf.cdtTrfTxInf.pmtId.instrId?fiToFICstmrCdtTrf.grpHdr.msgId?appHdr.bizMsgIdr
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
......@@ -222,7 +222,7 @@ cdtrAgtBrnchPstlAdrDstrctNm=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgt.brnchId.pstlAd
cdtrAgtBrnchPstlAdrTwnLctnNm=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgt.brnchId.pstlAdr.twnLctnNm
cdtrAgtBrnchAdrLines=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgt.brnchId.pstlAdr.adrLine
cdtrAgtAcctIdIban=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.iban
cdtrAgtAcctId=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgtAcctid.othr.id
cdtrAgtAcctId=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.othr.id
cdtrAgtAcctIdType=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.othr.schmeNm.cd
cdtrAgtAcctIdTypePrtry=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.othr.schmeNm.prtry
cdtrAgtAcctType=fiToFICstmrCdtTrf.cdtTrfTxInf.cdtrAgtAcct.tp.cd
......
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi?appHdr.fr.orgId.id.orgId.anyBIC
toBic=appHdr.to.fiId.finInstnId.bicfi?appHdr.to.orgId.id.orgId.anyBIC
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=fiCdtTrf.cdtTrfTxInf.pmtId.instrId?fiCdtTrf.grpHdr.msgId?appHdr.bizMsgIdr
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
......@@ -289,7 +289,7 @@ cdtrAgtBrnchPstlAdrDstrctNm=fiCdtTrf.cdtTrfTxInf.cdtrAgt.brnchId.pstlAdr.dstrctN
cdtrAgtBrnchPstlAdrTwnLctnNm=fiCdtTrf.cdtTrfTxInf.cdtrAgt.brnchId.pstlAdr.twnLctnNm
cdtrAgtBrnchAdrLines=fiCdtTrf.cdtTrfTxInf.cdtrAgt.brnchId.pstlAdr.adrLine
cdtrAgtAcctIdIban=fiCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.iban
cdtrAgtAcctId=fiCdtTrf.cdtTrfTxInf.cdtrAgtAcctid.othr.id
cdtrAgtAcctId=fiCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.othr.id
cdtrAgtAcctIdType=fiCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.othr.schmeNm.cd
cdtrAgtAcctIdTypePrtry=fiCdtTrf.cdtTrfTxInf.cdtrAgtAcct.id.othr.schmeNm.prtry
cdtrAgtAcctType=fiCdtTrf.cdtTrfTxInf.cdtrAgtAcct.tp.cd
......@@ -341,7 +341,7 @@ cdtrBrnchPstlAdrDstrctNm=fiCdtTrf.cdtTrfTxInf.cdtr.brnchId.pstlAdr.dstrctNm
cdtrBrnchPstlAdrTwnLctnNm=fiCdtTrf.cdtTrfTxInf.cdtr.brnchId.pstlAdr.twnLctnNm
cdtrBrnchAdrLines=fiCdtTrf.cdtTrfTxInf.cdtr.brnchId.pstlAdr.adrLine
cdtrAcctIdIban=fiCdtTrf.cdtTrfTxInf.cdtrAcct.id.iban
cdtrAcctId=fiCdtTrf.cdtTrfTxInf.cdtrAcctid.othr.id
cdtrAcctId=fiCdtTrf.cdtTrfTxInf.cdtrAcct.id.othr.id
cdtrAcctIdType=fiCdtTrf.cdtTrfTxInf.cdtrAcct.id.othr.schmeNm.cd
cdtrAcctIdTypePrtry=fiCdtTrf.cdtTrfTxInf.cdtrAcct.id.othr.schmeNm.prtry
cdtrAcctType=fiCdtTrf.cdtTrfTxInf.cdtrAcct.tp.cd
......@@ -619,10 +619,98 @@ dbtrAgtBrnchPstlAdrDstrctNm=fiCdtTrf.cdtTrfTxInf.dbtrAgt.brnchId.pstlAdr.dstrctN
dbtrAgtBrnchPstlAdrTwnLctnNm=fiCdtTrf.cdtTrfTxInf.dbtrAgt.brnchId.pstlAdr.twnLctnNm
dbtrAgtBrnchAdrLines=fiCdtTrf.cdtTrfTxInf.dbtrAgt.brnchId.pstlAdr.adrLine
dbtrAgtAcctIdIban=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.id.iban
dbtrAgtAcctId=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcctid.othr.id
dbtrAgtAcctId=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.id.othr.id
dbtrAgtAcctIdType=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.id.othr.schmeNm.cd
dbtrAgtAcctIdTypePrtry=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.id.othr.schmeNm.prtry
dbtrAgtAcctType=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.tp.cd
dbtrAgtAcctTypePrtry=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.tp.prtry
dbtrAgtAcctCcy=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.ccy
dbtrAgtAcctNm=fiCdtTrf.cdtTrfTxInf.dbtrAgtAcct.nm
instgAgtBicfi=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.bicfi
instgAgtClrSysId=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.clrSysMmbId.mmbId
instgAgtClrSysIdType=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.clrSysMmbId.clrSysId.cd
instgAgtClrSysIdTypePrtry=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.clrSysMmbId.clrSysId.prtry
instgAgtLei=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.lei
instgAgtNm=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.nm
instgAgtPstlAdrType=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.adrTp.cd
instgAgtPstlAdrCtry=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.ctry
instgAgtPstlAdrDept=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.dept
instgAgtPstlAdrSubDept=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.subDept
instgAgtPstlAdrStrtNm=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.strtNm
instgAgtPstlAdrBldgNb=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.bldgNb
instgAgtPstlAdrBldgNm=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.bldgNm
instgAgtPstlAdrFlr=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.flr
instgAgtPstlAdrRoom=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.room
instgAgtPstlAdrTwnNm=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.twnNm
instgAgtPstlAdrPstBx=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.pstBx
instgAgtPstlAdrPstCd=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.pstCd
instgAgtPstlAdrCtrySubDvsn=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.ctrySubDvsn
instgAgtPstlAdrDstrctNm=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.dstrctNm
instgAgtPstlAdrTwnLctnNm=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.twnLctnNm
instgAgtAdrLines=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.pstlAdr.AdrLine
instgAgtOthrId=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.othr.id
instgAgtOthrIdType=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.othr.schmeNm.cd
instgAgtOthrIdTypePrtry=fiCdtTrf.cdtTrfTxInf.instgAgt.finInstnId.othr.schmeNm.prtry
instgAgtBrnchId=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.id
instgAgtBrnchLei=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.lei
instgAgtBrnchNm=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.nm
instgAgtBrnchPstlAdrType=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.adrTp.cd
instgAgtBrnchPstlAdrCtry=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.ctry
instgAgtBrnchPstlAdrDept=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.dept
instgAgtBrnchPstlAdrSubDept=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.subDept
instgAgtBrnchPstlAdrStrtNm=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.strtNm
instgAgtBrnchPstlAdrBldgNb=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.bldgNb
instgAgtBrnchPstlAdrBldgNm=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.bldgNm
instgAgtBrnchPstlAdrFlr=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.flr
instgAgtBrnchPstlAdrRoom=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.room
instgAgtBrnchPstlAdrTwnNm=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.twnNm
instgAgtBrnchPstlAdrPstBx=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.pstBx
instgAgtBrnchPstlAdrPstCd=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.pstCd
instgAgtBrnchPstlAdrCtrySubDvsn=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.ctrySubDvsn
instgAgtBrnchPstlAdrDstrctNm=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.dstrctNm
instgAgtBrnchPstlAdrTwnLctnNm=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.twnLctnNm
instgAgtBrnchAdrLines=fiCdtTrf.cdtTrfTxInf.instgAgt.brnchId.pstlAdr.AdrLine
instdAgtBicfi=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.bicfi
instdAgtClrSysId=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.clrSysMmbId.mmbId
instdAgtClrSysIdType=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.clrSysMmbId.clrSysId.cd
instdAgtClrSysIdTypePrtry=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.clrSysMmbId.clrSysId.prtry
instdAgtLei=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.lei
instdAgtNm=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.nm
instdAgtPstlAdrType=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.adrTp.cd
instdAgtPstlAdrCtry=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.ctry
instdAgtPstlAdrDept=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.dept
instdAgtPstlAdrSubDept=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.subDept
instdAgtPstlAdrStrtNm=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.strtNm
instdAgtPstlAdrBldgNb=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.bldgNb
instdAgtPstlAdrBldgNm=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.bldgNm
instdAgtPstlAdrFlr=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.flr
instdAgtPstlAdrRoom=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.room
instdAgtPstlAdrTwnNm=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.twnNm
instdAgtPstlAdrPstBx=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.pstBx
instdAgtPstlAdrPstCd=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.pstCd
instdAgtPstlAdrCtrySubDvsn=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.ctrySubDvsn
instdAgtPstlAdrDstrctNm=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.dstrctNm
instdAgtPstlAdrTwnLctnNm=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.twnLctnNm
instdAgtAdrLines=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.pstlAdr.AdrLine
instdAgtOthrId=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.othr.id
instdAgtOthrIdType=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.othr.schmeNm.cd
instdAgtOthrIdTypePrtry=fiCdtTrf.cdtTrfTxInf.instdAgt.finInstnId.othr.schmeNm.prtry
instdAgtBrnchId=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.id
instdAgtBrnchLei=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.lei
instdAgtBrnchNm=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.nm
instdAgtBrnchPstlAdrType=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.adrTp.cd
instdAgtBrnchPstlAdrCtry=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.ctry
instdAgtBrnchPstlAdrDept=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.dept
instdAgtBrnchPstlAdrSubDept=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.subDept
instdAgtBrnchPstlAdrStrtNm=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.strtNm
instdAgtBrnchPstlAdrBldgNb=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.bldgNb
instdAgtBrnchPstlAdrBldgNm=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.bldgNm
instdAgtBrnchPstlAdrFlr=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.flr
instdAgtBrnchPstlAdrRoom=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.room
instdAgtBrnchPstlAdrTwnNm=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.twnNm
instdAgtBrnchPstlAdrPstBx=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.pstBx
instdAgtBrnchPstlAdrPstCd=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.pstCd
instdAgtBrnchPstlAdrCtrySubDvsn=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.ctrySubDvsn
instdAgtBrnchPstlAdrDstrctNm=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.dstrctNm
instdAgtBrnchPstlAdrTwnLctnNm=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.twnLctnNm
instdAgtBrnchAdrLines=fiCdtTrf.cdtTrfTxInf.instdAgt.brnchId.pstlAdr.AdrLine
\ No newline at end of file
package com.brilliance;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.element2mx.Element2MxCreatorManager;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import java.io.File;
public class Element2MxTest {
@Test
public void test() {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05300108_950.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00800108.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00900108.xml"));
String elementStr = SwiftTransfer.mx2Element(file);
String xmlStr = new Element2MxCreatorManager().element2Mx(elementStr);
System.out.println(xmlStr);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment