提交 574c763f 编写于 作者: O o2null

Merge branch 'fix/删除clientInit配置' into 'wrdp'

[平台配置]删除clientInit配置

See merge request o2oa/o2oa!2601
{
"enable": true,
"enable": false,
"mq":"kafka",
"kafka":{
"bootstrap_servers": "localhost:9092",
......
......@@ -33,7 +33,6 @@ public class CreateConfigSample {
List<Class<?>> classes = new ArrayList<Class<?>>();
classes.add(AppStyle.class);
classes.add(CenterServer.class);
classes.add(ClientInit.class);
classes.add(Collect.class);
classes.add(Communicate.class);
classes.add(Components.class);
......
package com.x.base.core.project.config;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.BooleanUtils;
import com.x.base.core.project.annotation.FieldDescribe;
public class ClientInit extends ConfigObject {
@FieldDescribe("是否启用.")
private Boolean enable;
@FieldDescribe("center节点信息.")
private List<CenterAddress> center;
@FieldDescribe("网页底部说明.")
private String footer = "";
@FieldDescribe("网页头部说明.")
private String title = "";
@FieldDescribe("APP使用协议,auto,http,https.")
private String app_protocol = "auto";
@FieldDescribe("登录页面配置.")
private LoginPage loginPage;
@FieldDescribe("是否启用webSocket")
private Boolean webSocketEnable;
public ClientInit() {
this.enable = DEFAULT_ENABLE;
this.center = new ArrayList<>();
this.loginPage = new LoginPage();
}
public static ClientInit defaultInstance() {
return new ClientInit();
}
public static final Boolean DEFAULT_ENABLE = false;
public static class LoginPage extends ConfigObject {
public static LoginPage defaultInstance() {
return new LoginPage();
}
@FieldDescribe("是否启用定制的登录页面.")
private Boolean enable;
@FieldDescribe("登录的门户.")
private String portal;
@FieldDescribe("登录页面.")
private String page;
public Boolean getEnable() {
return enable;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public String getPortal() {
return portal;
}
public void setPortal(String portal) {
this.portal = portal;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
}
public static class CenterAddress extends ConfigObject {
public static CenterAddress defaultInstance() {
return new CenterAddress();
}
private String port;
private String host;
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}
public Boolean getEnable() {
return BooleanUtils.isTrue(this.enable);
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public List<CenterAddress> getCenter() {
return center;
}
public void setCenter(List<CenterAddress> center) {
this.center = center;
}
public String getFooter() {
return footer;
}
public void setFooter(String footer) {
this.footer = footer;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getApp_protocol() {
return app_protocol;
}
public void setApp_protocol(String app_protocol) {
this.app_protocol = app_protocol;
}
public LoginPage getLoginPage() {
return loginPage;
}
public void setLoginPage(LoginPage loginPage) {
this.loginPage = loginPage;
}
public Boolean getWebSocketEnable() {
return webSocketEnable;
}
public void setWebSocketEnable(Boolean webSocketEnable) {
this.webSocketEnable = webSocketEnable;
}
}
\ No newline at end of file
......@@ -1050,19 +1050,6 @@ public class Config {
return instance().logLevel;
}
private ClientInit clientInit;
public static synchronized ClientInit clientInit() throws Exception {
if (null == instance().clientInit) {
ClientInit obj = BaseTools.readConfigObject(PATH_CONFIG_CLIENTINIT, ClientInit.class);
if (null == obj) {
obj = ClientInit.defaultInstance();
}
instance().clientInit = obj;
}
return instance().clientInit;
}
private byte[] bindLogo;
public static synchronized byte[] bindLogo() throws Exception {
......
......@@ -178,9 +178,7 @@ public class WebServerTools extends JettySeverTools {
File file = new File(dir, "config.json");
Gson gson = XGsonBuilder.instance();
if (Config.clientInit().getEnable()) {
FileUtils.write(file, gson.toJson(Config.clientInit()), DefaultCharset.charset);
} else {
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
/** 覆盖掉配置的参数 */
com.x.base.core.project.config.CenterServer centerServerConfig = Config.nodes().centerServers().first()
......@@ -257,7 +255,6 @@ public class WebServerTools extends JettySeverTools {
}
FileUtils.writeStringToFile(file, gson.toJson(map), DefaultCharset.charset);
}
}
private static void createIndexPage() throws Exception {
if (null != Config.nodes().webServers()) {
......
......@@ -16,6 +16,9 @@ class ActionValidateDirect extends BaseAction {
ActionResult<Wo> execute(JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
if (!Config.nodes().centerServers().first().getValue().getConfigApiEnable()) {
throw new ExceptionModifyConfig();
}
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
Wo wo = new Wo();
wo.setValue(true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册