Browse Source
* commit '5db04ec12542f105c71f9da6d797d13bffca6c2d': REPORT-77217 ConnectionProvider-修改之后数据连接信息无法保存 【问题原因】产生假保存的原因是,在保存的时候会判断现有的Connection与以前存储的Connection是否有不同,如果不同就代表需要更新。实际上插件中的Connection相关类没有写equals方法,然后新旧Connection被认为是相同了,就没有走后面的更新配置的逻辑 【改动方案】拉rinoux、vito、hugh一起沟通了下方案,暂时主代码里做个兼容,让主代码内置的两种Connection去判断是否要更新,其余的Connection(插件Connection)都必须更新 【review建议】 REPORT-74376 clone下map REPORT-74376 支持存储FVS设计器相关配置bugfix/11.0
superman
2 years ago
4 changed files with 157 additions and 1 deletions
@ -0,0 +1,72 @@ |
|||||||
|
package com.fr.design.mainframe.simple; |
||||||
|
|
||||||
|
import com.fr.stable.xml.XMLPrintWriter; |
||||||
|
import com.fr.stable.xml.XMLable; |
||||||
|
import com.fr.stable.xml.XMLableReader; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Wei |
||||||
|
* 一个简单属性(字符串)存储类,用于自定义简单属性的存储 |
||||||
|
* 如:getInstance("FVSDesignerConfig")可在FineReportEnv.xml中定义一个<FVSDesignerConfig></>存储FVS相关配置 |
||||||
|
*/ |
||||||
|
public class SimpleDesignerConfig implements XMLable { |
||||||
|
|
||||||
|
private static final HashMap<String, SimpleDesignerConfig> configs = new HashMap<>(); |
||||||
|
|
||||||
|
private SimpleDesignerConfig(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
public static SimpleDesignerConfig getInstance(String name) { |
||||||
|
SimpleDesignerConfig config = configs.get(name); |
||||||
|
if(config == null) { |
||||||
|
config = new SimpleDesignerConfig(name); |
||||||
|
configs.put(name, config); |
||||||
|
} |
||||||
|
return config; |
||||||
|
} |
||||||
|
|
||||||
|
private String name = ""; |
||||||
|
|
||||||
|
private HashMap<String, String> content = new HashMap<>(); |
||||||
|
|
||||||
|
public void addAttr(String key, String value) { |
||||||
|
content.put(key, value); |
||||||
|
} |
||||||
|
|
||||||
|
public Map<String, String> getContent() { |
||||||
|
return content; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void readXML(XMLableReader reader) { |
||||||
|
if (reader.isAttr()) { |
||||||
|
content.putAll(reader.getAttrs()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void writeXML(XMLPrintWriter writer) { |
||||||
|
writer.startTAG(name); |
||||||
|
content.forEach(writer::attr); |
||||||
|
writer.end(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object clone() throws CloneNotSupportedException { |
||||||
|
SimpleDesignerConfig cloned = (SimpleDesignerConfig) super.clone(); |
||||||
|
cloned.content = new HashMap<>(content); |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
public String getName() { |
||||||
|
return name; |
||||||
|
} |
||||||
|
|
||||||
|
public void setName(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue