Commit 5a63f002 by cjh

更新mapping配置文件映射关系

parent b0231d77
...@@ -23,23 +23,41 @@ public class Alias { ...@@ -23,23 +23,41 @@ public class Alias {
private Map<String, String> rel; private Map<String, String> rel;
private Map<String, String> revertRel = new HashMap<>(); private Map<String, String> revertRel = new HashMap<>();
private Map<String, String> lstRel;
private Map<String, String> revertLstRel = new HashMap<>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Alias(String mappingUrl) { public Alias(String mappingUrl,String flag) {
String[] mappingArgs = mappingUrl.split("/"); String[] mappingArgs = mappingUrl.split("/");
this.trnName = mappingArgs[mappingArgs.length - 2]; this.trnName = mappingArgs[mappingArgs.length - 2];
this.aliasActionUrl = mappingArgs[mappingArgs.length - 1]; this.aliasActionUrl = mappingArgs[mappingArgs.length - 1];
try { try {
this.rel = new HashMap<String, String>((Map) PropertyUtil.load(PRE + trnName + ".properties")); this.rel = new HashMap<String, String>((Map) PropertyUtil.load(PRE+flag+"_" + trnName + ".properties"));
for (String key : this.rel.keySet()) { for (String key : this.rel.keySet()) {
this.revertRel.put(this.rel.get(key), key); this.revertRel.put(this.rel.get(key), key);
} }
//添加lst字段映射
this.lstRel = new HashMap<String, String>((Map) PropertyUtil.load(PRE + trnName + "_lst.properties"));
for (String key : this.lstRel.keySet()) {
this.revertLstRel.put(this.lstRel.get(key), key);
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public String getLstRelPath(String alias){
return this.lstRel.get(alias);
}
public String getRevertLstRelPath(String alias){
return this.revertLstRel.get(alias);
}
public String getRelPath(String alias) { public String getRelPath(String alias) {
return this.rel.get(alias); return this.rel.get(alias);
} }
......
...@@ -21,4 +21,7 @@ public class Constants { ...@@ -21,4 +21,7 @@ public class Constants {
public final static String RESULT = "result"; public final static String RESULT = "result";
public final static String FILE_IN = "fileIn"; public final static String FILE_IN = "fileIn";
public final static String FILE_OUT = "fileOut"; public final static String FILE_OUT = "fileOut";
public final static String REQ = "req";
public final static String RESP = "resp";
} }
...@@ -60,8 +60,13 @@ public class NoUiPresentationUtil { ...@@ -60,8 +60,13 @@ public class NoUiPresentationUtil {
List<Map<String, Object>> valueList = (List<Map<String, Object>>) value; List<Map<String, Object>> valueList = (List<Map<String, Object>>) value;
for (Map<String, Object> m : valueList) { for (Map<String, Object> m : valueList) {
IModule module = moduleList.add(); IModule module = moduleList.add();
for (Map.Entry<String, Object> entry : m.entrySet()) for (Map.Entry<String, Object> entry : m.entrySet()){
handleDatafield(context, (IDatafield<Object>) module.get(entry.getKey()), entry.getValue()); if(alias.getLstRelPath(entry.getKey())==null){
handleDatafield(context, (IDatafield<Object>) module.get(entry.getKey()), entry.getValue());
}else{
handleDatafield(context, (IDatafield<Object>) module.get(alias.getLstRelPath(entry.getKey())), entry.getValue());
}
}
} }
} }
} }
...@@ -175,7 +180,7 @@ public class NoUiPresentationUtil { ...@@ -175,7 +180,7 @@ public class NoUiPresentationUtil {
} }
String realPath = alias.getRelPath(aliasKey); String realPath = alias.getRelPath(aliasKey);
IBaseObject baseObject = context.getSession().getBaseObject(context.getRoot(), realPath); IBaseObject baseObject = context.getSession().getBaseObject(context.getRoot(), realPath);
data.put(aliasKey, handIBaseObject(context, baseObject, realPath)); data.put(aliasKey, handIBaseObject(context, baseObject, realPath,alias));
} }
return data; return data;
} }
...@@ -188,7 +193,7 @@ public class NoUiPresentationUtil { ...@@ -188,7 +193,7 @@ public class NoUiPresentationUtil {
String aliasPath = aliasEntry.getValue(); String aliasPath = aliasEntry.getValue();
if (aliasPath.startsWith(modifyEntry.getKey())) { if (aliasPath.startsWith(modifyEntry.getKey())) {
Object val = modifyEntry.getValue(); Object val = modifyEntry.getValue();
data.put(aliasKey, handIBaseObject(context, val, aliasEntry.getValue())); data.put(aliasKey, handIBaseObject(context, val, aliasEntry.getValue(),alias));
} }
} }
...@@ -234,7 +239,7 @@ public class NoUiPresentationUtil { ...@@ -234,7 +239,7 @@ public class NoUiPresentationUtil {
return null; return null;
} }
public static Object handIBaseObject(IContext context, Object val, String path) { public static Object handIBaseObject(IContext context, Object val, String path,Alias alias) {
if (val == null) if (val == null)
return null; return null;
if (val instanceof IModuleList<?>) { if (val instanceof IModuleList<?>) {
...@@ -245,14 +250,18 @@ public class NoUiPresentationUtil { ...@@ -245,14 +250,18 @@ public class NoUiPresentationUtil {
IModule module = moduleList.get(index); IModule module = moduleList.get(index);
Collection<IDatafield> datafields = module.getDatafields(); Collection<IDatafield> datafields = module.getDatafields();
for (IDatafield<Object> datafield : datafields) { for (IDatafield<Object> datafield : datafields) {
map.put(datafield.getName(), handle(datafield.getValue(), datafield)); if(alias.getRevertLstRelPath(datafield.getName())==null){
map.put(datafield.getName(), handle(datafield.getValue(), datafield));
}else{
map.put(alias.getRevertLstRelPath(datafield.getName()), handle(datafield.getValue(), datafield));
}
} }
list.add(map); list.add(map);
} }
return list; return list;
} else if (val instanceof IModule) { } else if (val instanceof IModule) {
val = context.getSession().getBaseObject(context.getRoot(), path); val = context.getSession().getBaseObject(context.getRoot(), path);
return handIBaseObject(context, val, path); return handIBaseObject(context, val, path,alias);
} else if (val instanceof IDatafield) { } else if (val instanceof IDatafield) {
IDatafield datafield = (IDatafield) val; IDatafield datafield = (IDatafield) val;
return handle(datafield.getValue(), datafield); return handle(datafield.getValue(), datafield);
...@@ -263,14 +272,14 @@ public class NoUiPresentationUtil { ...@@ -263,14 +272,14 @@ public class NoUiPresentationUtil {
public static Map<String, Object> getWholeAliasData(IContext context, String mappingUrl) public static Map<String, Object> getWholeAliasData(IContext context, String mappingUrl)
{ {
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
Alias alias = new Alias(mappingUrl); Alias alias = new Alias(mappingUrl,Constants.RESP);
for (String aliasKey : alias.getRel().keySet()) { for (String aliasKey : alias.getRel().keySet()) {
if (aliasKey.startsWith(Constants.MAPPING_PRE)) { if (aliasKey.startsWith(Constants.MAPPING_PRE)) {
continue; continue;
} }
String realPath = alias.getRelPath(aliasKey); String realPath = alias.getRelPath(aliasKey);
IBaseObject baseObject = context.getSession().getBaseObject(context.getRoot(), realPath); IBaseObject baseObject = context.getSession().getBaseObject(context.getRoot(), realPath);
data.put(aliasKey, NoUiPresentationUtil.handIBaseObject(context, baseObject, realPath)); data.put(aliasKey, NoUiPresentationUtil.handIBaseObject(context, baseObject, realPath,alias));
} }
return data; return data;
} }
......
opnb_chnam=opnbchnam
\ No newline at end of file
_select=actp\\select _select=actp\\select
cur=actp\\cur cur=actp\\cur
actlst=\\actp\\actlst \ No newline at end of file
\ No newline at end of file
actlst=\\actp\\actlst
midratmmmmmmmmmmm=\\actgrp\\currat\\midrat
cur=\\actgrp\\currat\\cur
\ No newline at end of file
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