Commit b1ccd7a7 by Nepxion

重构类结构

parent 8a90fbe2
...@@ -89,24 +89,7 @@ public class ConfigEndpoint { ...@@ -89,24 +89,7 @@ public class ConfigEndpoint {
@ResponseBody @ResponseBody
@ManagedOperation @ManagedOperation
public ResponseEntity<List<String>> view() { public ResponseEntity<List<String>> view() {
List<String> ruleList = new ArrayList<String>(2); return view(false);
String localRuleContent = StringUtils.EMPTY;
RuleEntity localRuleEntity = pluginAdapter.getLocalRule();
if (localRuleEntity != null && StringUtils.isNotEmpty(localRuleEntity.getContent())) {
localRuleContent = localRuleEntity.getContent();
}
String dynamicRuleContent = StringUtils.EMPTY;
RuleEntity dynamicRuleEntity = pluginAdapter.getDynamicRule();
if (dynamicRuleEntity != null && StringUtils.isNotEmpty(dynamicRuleEntity.getContent())) {
dynamicRuleContent = dynamicRuleEntity.getContent();
}
ruleList.add(localRuleContent);
ruleList.add(dynamicRuleContent);
return ResponseEntity.ok().body(ruleList);
} }
private ResponseEntity<?> update(String config, boolean async) { private ResponseEntity<?> update(String config, boolean async) {
...@@ -145,6 +128,27 @@ public class ConfigEndpoint { ...@@ -145,6 +128,27 @@ public class ConfigEndpoint {
return ResponseEntity.ok().body("OK"); return ResponseEntity.ok().body("OK");
} }
private ResponseEntity<List<String>> view(boolean async) {
List<String> ruleList = new ArrayList<String>(2);
String localRuleContent = StringUtils.EMPTY;
RuleEntity localRuleEntity = pluginAdapter.getLocalRule();
if (localRuleEntity != null && StringUtils.isNotEmpty(localRuleEntity.getContent())) {
localRuleContent = localRuleEntity.getContent();
}
String dynamicRuleContent = StringUtils.EMPTY;
RuleEntity dynamicRuleEntity = pluginAdapter.getDynamicRule();
if (dynamicRuleEntity != null && StringUtils.isNotEmpty(dynamicRuleEntity.getContent())) {
dynamicRuleContent = dynamicRuleEntity.getContent();
}
ruleList.add(localRuleContent);
ruleList.add(dynamicRuleContent);
return ResponseEntity.ok().body(ruleList);
}
protected ResponseEntity<String> toExceptionResponseEntity(Exception e, boolean showDetail) { protected ResponseEntity<String> toExceptionResponseEntity(Exception e, boolean showDetail) {
String message = null; String message = null;
if (showDetail) { if (showDetail) {
......
...@@ -88,15 +88,7 @@ public class VersionEndpoint { ...@@ -88,15 +88,7 @@ public class VersionEndpoint {
@ResponseBody @ResponseBody
@ManagedOperation @ManagedOperation
public ResponseEntity<List<String>> view() { public ResponseEntity<List<String>> view() {
List<String> versionList = new ArrayList<String>(2); return view(false);
String localVersion = pluginAdapter.getLocalVersion();
String dynamicVersion = pluginAdapter.getDynamicVersion();
versionList.add(StringUtils.isNotEmpty(localVersion) ? localVersion : StringUtils.EMPTY);
versionList.add(StringUtils.isNotEmpty(dynamicVersion) ? dynamicVersion : StringUtils.EMPTY);
return ResponseEntity.ok().body(versionList);
} }
private ResponseEntity<?> update(String version, boolean async) { private ResponseEntity<?> update(String version, boolean async) {
...@@ -141,4 +133,16 @@ public class VersionEndpoint { ...@@ -141,4 +133,16 @@ public class VersionEndpoint {
return ResponseEntity.ok().body("OK"); return ResponseEntity.ok().body("OK");
} }
private ResponseEntity<List<String>> view(boolean async) {
List<String> versionList = new ArrayList<String>(2);
String localVersion = pluginAdapter.getLocalVersion();
String dynamicVersion = pluginAdapter.getDynamicVersion();
versionList.add(StringUtils.isNotEmpty(localVersion) ? localVersion : StringUtils.EMPTY);
versionList.add(StringUtils.isNotEmpty(dynamicVersion) ? dynamicVersion : StringUtils.EMPTY);
return ResponseEntity.ok().body(versionList);
}
} }
\ 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