Browse Source

后端发布: 8.2.14

前端发布: 8.2.71
main
wangshaoping 2 weeks ago
parent
commit
87c9b6de3b
  1. 4
      erm.frontend/package.json
  2. 4
      gradle.properties
  3. 4
      io.sc.engine.mv.frontend/package.json
  4. 122
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/WebRequest.java
  5. 10
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/processor/HttpRequest.java
  6. 3
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/enums/HttpAuthorizationType.java
  7. 136
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/lib/processor/HttpRequestIndicatorProcessor.java
  8. 136
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/model/processor/HttpRequestParameterProcessor.java
  9. 5
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/util/WebRequestUtil.java
  10. 4
      io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/dictionary_render.tpl
  11. 5
      io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/i18n/enums.properties
  12. 5
      io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/i18n/enums_tw_CN.properties
  13. 5
      io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/i18n/enums_zh_CN.properties
  14. 4
      io.sc.engine.rule.frontend/package.json
  15. 31
      io.sc.engine.rule.frontend/src/i18n/messages.json
  16. 31
      io.sc.engine.rule.frontend/src/i18n/messages_tw_CN.json
  17. 31
      io.sc.engine.rule.frontend/src/i18n/messages_zh_CN.json
  18. 102
      io.sc.engine.rule.frontend/src/utils/JsonParameterAndValueTypeParser.ts
  19. 37
      io.sc.engine.rule.frontend/src/utils/VariableUtil.ts
  20. 663
      io.sc.engine.rule.frontend/src/views/resources/designer/HttpRequestDialog.vue
  21. 17
      io.sc.engine.rule.frontend/src/views/resources/designer/Processor.vue
  22. 9
      io.sc.engine.rule.frontend/src/views/shared/AutoCompletionManager.ts
  23. 580
      io.sc.engine.rule.frontend/src/views/shared/processors/HttpRequest copy.ts
  24. 409
      io.sc.engine.rule.frontend/src/views/shared/processors/HttpRequest.ts
  25. 5
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/entity/DictionaryEntity.java
  26. 5
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/entity/UserDefinedJavaClassFieldEntity.java
  27. 3
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/function/entity/FunctionEntity.java
  28. 26
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/converter/IndicatorProcessorEntityConverter.java
  29. 5
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/entity/LibEntity.java
  30. 282
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/entity/processor/HttpRequestIndicatorProcessorEntity.java
  31. 154
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/vo/processor/HttpRequestIndicatorProcessorVo.java
  32. 26
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/converter/ParameterProcessorEntityConverter.java
  33. 280
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/entity/processor/HttpRequestParameterProcessorEntity.java
  34. 143
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/vo/processor/HttpRequestParameterProcessorVo.java
  35. 5
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/resource/entity/ResourceEntity.java
  36. 40
      io.sc.engine.rule.server/src/main/resources/liquibase/RE_1.0.0_20220515__Rule Engine Database Schema DDL.xml
  37. 4
      io.sc.engine.st.frontend/package.json
  38. 4
      io.sc.platform.ai.frontend/package.json
  39. 2
      io.sc.platform.core.frontend/package.json
  40. 9
      io.sc.platform.core.frontend/src/platform/utils/Tools.ts
  41. 4
      io.sc.platform.core.frontend/template-project/package.json
  42. 1
      io.sc.platform.core/src/main/java/io/sc/platform/core/Environment.java
  43. 12
      io.sc.platform.core/src/main/java/io/sc/platform/core/util/PinyinUtil.java
  44. 4
      io.sc.platform.developer.doc/package.json
  45. 4
      io.sc.platform.developer.frontend/package.json
  46. 4
      io.sc.platform.lcdp.frontend/package.json
  47. 4
      io.sc.platform.license.keygen.frontend/package.json
  48. 4
      io.sc.platform.mvc.frontend/package.json
  49. 4
      io.sc.platform.scheduler.manager.frontend/package.json
  50. 4
      io.sc.platform.system.frontend/package.json
  51. 4
      io.sc.standard.frontend/package.json
  52. 4
      io.sc.website/package.json

4
erm.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "erm.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
gradle.properties

@ -37,9 +37,9 @@ application_version=1.0.0
# platform
###########################################################
platform_group=io.sc
platform_version=8.2.13
platform_version=8.2.14
platform_plugin_version=8.2.10
platform_core_frontend_version=8.2.70
platform_core_frontend_version=8.2.71
###########################################################
# dependencies version

4
io.sc.engine.mv.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.engine.mv.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

122
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/WebRequest.java

@ -4,15 +4,23 @@ import io.sc.engine.rule.core.enums.HttpAuthorizationType;
import io.sc.engine.rule.core.enums.HttpMethodType;
public class WebRequest {
private HttpMethodType httpMethod;
private String httpUrl;
private HttpAuthorizationType httpAuthType;
private String httpAuthApikey;
private String httpAuthApiValue;
private String httpAuthBasicUsername;
private String httpAuthBasicPassword;
private String httpAuthBearerToken;
private String httpRequestBody;
private HttpMethodType httpMethod; // HTTP Method
private String httpUrl; // URL
private String httpUrlParameterValues; // URL 中参数的测试值
private HttpAuthorizationType httpAuthType; // 认证类型
private String httpAuthBasicUsername; // Basic 认证的用户名
private String httpAuthBasicPassword; // Basic 认证的用户密码
private String httpAuthBearerToken; // BearerToken
private String httpAuthParameterValues; // 认证中参数的测试值
private String httpRequestHeader; // 请求头
private String httpRequestHeaderParameterValues; // 请求头中参数的测试值
private String httpRequestBody; // 请求 body
private String httpRequestBodyParameterValues; // 请求 body 中参数的测试值
private int httpConnectTimeout; // 连接超时毫秒数
private int httpRetryCountOnFailure; // 失败重试次数
private boolean httpAsync; // 是否异步执行
private boolean httpCache; // 是否缓存
private String httpResponseMapping; // 响应
public HttpMethodType getHttpMethod() {
return httpMethod;
@ -30,28 +38,20 @@ public class WebRequest {
this.httpUrl = httpUrl;
}
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
public String getHttpUrlParameterValues() {
return httpUrlParameterValues;
}
public String getHttpAuthApikey() {
return httpAuthApikey;
public void setHttpUrlParameterValues(String httpUrlParameterValues) {
this.httpUrlParameterValues = httpUrlParameterValues;
}
public void setHttpAuthApikey(String httpAuthApikey) {
this.httpAuthApikey = httpAuthApikey;
}
public String getHttpAuthApiValue() {
return httpAuthApiValue;
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthApiValue(String httpAuthApiValue) {
this.httpAuthApiValue = httpAuthApiValue;
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthBasicUsername() {
@ -78,6 +78,30 @@ public class WebRequest {
this.httpAuthBearerToken = httpAuthBearerToken;
}
public String getHttpAuthParameterValues() {
return httpAuthParameterValues;
}
public void setHttpAuthParameterValues(String httpAuthParameterValues) {
this.httpAuthParameterValues = httpAuthParameterValues;
}
public String getHttpRequestHeader() {
return httpRequestHeader;
}
public void setHttpRequestHeader(String httpRequestHeader) {
this.httpRequestHeader = httpRequestHeader;
}
public String getHttpRequestHeaderParameterValues() {
return httpRequestHeaderParameterValues;
}
public void setHttpRequestHeaderParameterValues(String httpRequestHeaderParameterValues) {
this.httpRequestHeaderParameterValues = httpRequestHeaderParameterValues;
}
public String getHttpRequestBody() {
return httpRequestBody;
}
@ -85,4 +109,52 @@ public class WebRequest {
public void setHttpRequestBody(String httpRequestBody) {
this.httpRequestBody = httpRequestBody;
}
public String getHttpRequestBodyParameterValues() {
return httpRequestBodyParameterValues;
}
public void setHttpRequestBodyParameterValues(String httpRequestBodyParameterValues) {
this.httpRequestBodyParameterValues = httpRequestBodyParameterValues;
}
public int getHttpConnectTimeout() {
return httpConnectTimeout;
}
public void setHttpConnectTimeout(int httpConnectTimeout) {
this.httpConnectTimeout = httpConnectTimeout;
}
public int getHttpRetryCountOnFailure() {
return httpRetryCountOnFailure;
}
public void setHttpRetryCountOnFailure(int httpRetryCountOnFailure) {
this.httpRetryCountOnFailure = httpRetryCountOnFailure;
}
public boolean isHttpAsync() {
return httpAsync;
}
public void setHttpAsync(boolean httpAsync) {
this.httpAsync = httpAsync;
}
public boolean isHttpCache() {
return httpCache;
}
public void setHttpCache(boolean httpCache) {
this.httpCache = httpCache;
}
public String getHttpResponseMapping() {
return httpResponseMapping;
}
public void setHttpResponseMapping(String httpResponseMapping) {
this.httpResponseMapping = httpResponseMapping;
}
}

10
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/processor/HttpRequest.java

@ -19,12 +19,9 @@ public class HttpRequest {
sb.append("\trequest.setHttpUrl(").append(StringUtil.format("${0}", GroovyExpressionReplacer.groovy(processor.getHttpUrl(),String.class.getName()))).append(");\n");
if(processor.getHttpAuthType()!=null) {
sb.append("\trequest.setHttpAuthType(").append("io.sc.engine.rule.core.enums.HttpAuthorizationType.").append(processor.getHttpAuthType()).append(");\n");
if(HttpAuthorizationType.BASIC_AUTH.equals(processor.getHttpAuthType())){
if(HttpAuthorizationType.BASIC.equals(processor.getHttpAuthType())){
sb.append("\trequest.setHttpAuthBasicUsername(").append(processor.getHttpAuthBasicUsername()).append(");\n");
sb.append("\trequest.setHttpAuthBasicPassword(").append(processor.getHttpAuthBasicPassword()).append(");\n");
}else if(HttpAuthorizationType.API_KEY.equals(processor.getHttpAuthType())){
sb.append("\trequest.setHttpAuthApikey(").append(processor.getHttpAuthApikey()).append(");\n");
sb.append("\trequest.setHttpAuthApiValue(").append(processor.getHttpAuthApiValue()).append(");\n");
}else if(HttpAuthorizationType.BEARER.equals(processor.getHttpAuthType())){
sb.append("\trequest.setHttpAuthBearerToken(").append(StringUtil.format("${0}", GroovyExpressionReplacer.groovy(processor.getHttpAuthBearerToken(),String.class.getName()))).append(");\n");
}
@ -52,12 +49,9 @@ public class HttpRequest {
sb.append("\trequest.setHttpUrl(").append(StringUtil.format("${0}", GroovyExpressionReplacer.groovy(processor.getHttpUrl(),String.class.getName()))).append(");\n");
if(processor.getHttpAuthType()!=null) {
sb.append("\trequest.setHttpAuthType(").append("io.sc.engine.rule.core.enums.HttpAuthorizationType.").append(processor.getHttpAuthType()).append(");\n");
if(HttpAuthorizationType.BASIC_AUTH.equals(processor.getHttpAuthType())){
if(HttpAuthorizationType.BASIC.equals(processor.getHttpAuthType())){
sb.append("\trequest.setHttpAuthBasicUsername(").append(processor.getHttpAuthBasicUsername()).append(");\n");
sb.append("\trequest.setHttpAuthBasicPassword(").append(processor.getHttpAuthBasicPassword()).append(");\n");
}else if(HttpAuthorizationType.API_KEY.equals(processor.getHttpAuthType())){
sb.append("\trequest.setHttpAuthApikey(").append(processor.getHttpAuthApikey()).append(");\n");
sb.append("\trequest.setHttpAuthApiValue(").append(processor.getHttpAuthApiValue()).append(");\n");
}else if(HttpAuthorizationType.BEARER.equals(processor.getHttpAuthType())){
sb.append("\trequest.setHttpAuthBearerToken(").append(StringUtil.format("${0}", GroovyExpressionReplacer.groovy(processor.getHttpAuthBearerToken(),String.class.getName()))).append(");\n");
}

3
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/enums/HttpAuthorizationType.java

@ -2,7 +2,6 @@ package io.sc.engine.rule.core.enums;
public enum HttpAuthorizationType {
NONE,
API_KEY,
BASIC_AUTH,
BASIC,
BEARER
}

136
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/lib/processor/HttpRequestIndicatorProcessor.java

@ -16,18 +16,23 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName("HTTP_REQUEST")
@JsonIgnoreProperties(ignoreUnknown=true)
public class HttpRequestIndicatorProcessor extends IndicatorProcessor {
private HttpMethodType httpMethod;
private String httpUrl;
private HttpAuthorizationType httpAuthType;
private String httpAuthApikey;
private String httpAuthApiValue;
private String httpAuthApiAddTo;
private String httpAuthBasicUsername;
private String httpAuthBasicPassword;
private String httpAuthBearerToken;
private String httpParams;
private String httpRequestBody;
private String httpResponseMapping;
private HttpMethodType httpMethod; // HTTP Method
private String httpUrl; // URL
private String httpUrlParameterValues; // URL 中参数的测试值
private HttpAuthorizationType httpAuthType; // 认证类型
private String httpAuthBasicUsername; // Basic 认证的用户名
private String httpAuthBasicPassword; // Basic 认证的用户密码
private String httpAuthBearerToken; // BearerToken
private String httpAuthParameterValues; // 认证中参数的测试值
private String httpRequestHeader; // 请求头
private String httpRequestHeaderParameterValues; // 请求头中参数的测试值
private String httpRequestBody; // 请求 body
private String httpRequestBodyParameterValues; // 请求 body 中参数的测试值
private int httpConnectTimeout; // 连接超时毫秒数
private int httpRetryCountOnFailure; // 失败重试次数
private boolean httpAsync; // 是否异步执行
private boolean httpCache; // 是否缓存
private String httpResponseMapping; // 响应
@Override
public ProcessorType getType() {
@ -37,72 +42,135 @@ public class HttpRequestIndicatorProcessor extends IndicatorProcessor {
public HttpMethodType getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(HttpMethodType httpMethod) {
this.httpMethod = httpMethod;
}
public String getHttpUrl() {
return httpUrl;
}
public void setHttpUrl(String httpUrl) {
this.httpUrl = httpUrl;
}
public String getHttpUrlParameterValues() {
return httpUrlParameterValues;
}
public void setHttpUrlParameterValues(String httpUrlParameterValues) {
this.httpUrlParameterValues = httpUrlParameterValues;
}
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthApikey() {
return httpAuthApikey;
}
public void setHttpAuthApikey(String httpAuthApikey) {
this.httpAuthApikey = httpAuthApikey;
}
public String getHttpAuthApiValue() {
return httpAuthApiValue;
}
public void setHttpAuthApiValue(String httpAuthApiValue) {
this.httpAuthApiValue = httpAuthApiValue;
}
public String getHttpAuthApiAddTo() {
return httpAuthApiAddTo;
}
public void setHttpAuthApiAddTo(String httpAuthApiAddTo) {
this.httpAuthApiAddTo = httpAuthApiAddTo;
}
public String getHttpAuthBasicUsername() {
return httpAuthBasicUsername;
}
public void setHttpAuthBasicUsername(String httpAuthBasicUsername) {
this.httpAuthBasicUsername = httpAuthBasicUsername;
}
public String getHttpAuthBasicPassword() {
return httpAuthBasicPassword;
}
public void setHttpAuthBasicPassword(String httpAuthBasicPassword) {
this.httpAuthBasicPassword = httpAuthBasicPassword;
}
public String getHttpAuthBearerToken() {
return httpAuthBearerToken;
}
public void setHttpAuthBearerToken(String httpAuthBearerToken) {
this.httpAuthBearerToken = httpAuthBearerToken;
}
public String getHttpParams() {
return httpParams;
public String getHttpAuthParameterValues() {
return httpAuthParameterValues;
}
public void setHttpAuthParameterValues(String httpAuthParameterValues) {
this.httpAuthParameterValues = httpAuthParameterValues;
}
public void setHttpParams(String httpParams) {
this.httpParams = httpParams;
public String getHttpRequestHeader() {
return httpRequestHeader;
}
public void setHttpRequestHeader(String httpRequestHeader) {
this.httpRequestHeader = httpRequestHeader;
}
public String getHttpRequestHeaderParameterValues() {
return httpRequestHeaderParameterValues;
}
public void setHttpRequestHeaderParameterValues(String httpRequestHeaderParameterValues) {
this.httpRequestHeaderParameterValues = httpRequestHeaderParameterValues;
}
public String getHttpRequestBody() {
return httpRequestBody;
}
public void setHttpRequestBody(String httpRequestBody) {
this.httpRequestBody = httpRequestBody;
}
public String getHttpRequestBodyParameterValues() {
return httpRequestBodyParameterValues;
}
public void setHttpRequestBodyParameterValues(String httpRequestBodyParameterValues) {
this.httpRequestBodyParameterValues = httpRequestBodyParameterValues;
}
public int getHttpConnectTimeout() {
return httpConnectTimeout;
}
public void setHttpConnectTimeout(int httpConnectTimeout) {
this.httpConnectTimeout = httpConnectTimeout;
}
public int getHttpRetryCountOnFailure() {
return httpRetryCountOnFailure;
}
public void setHttpRetryCountOnFailure(int httpRetryCountOnFailure) {
this.httpRetryCountOnFailure = httpRetryCountOnFailure;
}
public boolean isHttpAsync() {
return httpAsync;
}
public void setHttpAsync(boolean httpAsync) {
this.httpAsync = httpAsync;
}
public boolean isHttpCache() {
return httpCache;
}
public void setHttpCache(boolean httpCache) {
this.httpCache = httpCache;
}
public String getHttpResponseMapping() {
return httpResponseMapping;
}
public void setHttpResponseMapping(String httpResponseMapping) {
this.httpResponseMapping = httpResponseMapping;
}

136
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/model/processor/HttpRequestParameterProcessor.java

@ -16,18 +16,23 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName("HTTP_REQUEST")
@JsonIgnoreProperties(ignoreUnknown=true)
public class HttpRequestParameterProcessor extends ParameterProcessor {
private HttpMethodType httpMethod;
private String httpUrl;
private HttpAuthorizationType httpAuthType;
private String httpAuthApikey;
private String httpAuthApiValue;
private String httpAuthApiAddTo;
private String httpAuthBasicUsername;
private String httpAuthBasicPassword;
private String httpAuthBearerToken;
private String httpParams;
private String httpRequestBody;
private String httpResponseMapping;
private HttpMethodType httpMethod; // HTTP Method
private String httpUrl; // URL
private String httpUrlParameterValues; // URL 中参数的测试值
private HttpAuthorizationType httpAuthType; // 认证类型
private String httpAuthBasicUsername; // Basic 认证的用户名
private String httpAuthBasicPassword; // Basic 认证的用户密码
private String httpAuthBearerToken; // BearerToken
private String httpAuthParameterValues; // 认证中参数的测试值
private String httpRequestHeader; // 请求头
private String httpRequestHeaderParameterValues; // 请求头中参数的测试值
private String httpRequestBody; // 请求 body
private String httpRequestBodyParameterValues; // 请求 body 中参数的测试值
private int httpConnectTimeout; // 连接超时毫秒数
private int httpRetryCountOnFailure; // 失败重试次数
private boolean httpAsync; // 是否异步执行
private boolean httpCache; // 是否缓存
private String httpResponseMapping; // 响应
@Override
public ProcessorType getType() {
@ -37,72 +42,135 @@ public class HttpRequestParameterProcessor extends ParameterProcessor {
public HttpMethodType getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(HttpMethodType httpMethod) {
this.httpMethod = httpMethod;
}
public String getHttpUrl() {
return httpUrl;
}
public void setHttpUrl(String httpUrl) {
this.httpUrl = httpUrl;
}
public String getHttpUrlParameterValues() {
return httpUrlParameterValues;
}
public void setHttpUrlParameterValues(String httpUrlParameterValues) {
this.httpUrlParameterValues = httpUrlParameterValues;
}
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthApikey() {
return httpAuthApikey;
}
public void setHttpAuthApikey(String httpAuthApikey) {
this.httpAuthApikey = httpAuthApikey;
}
public String getHttpAuthApiValue() {
return httpAuthApiValue;
}
public void setHttpAuthApiValue(String httpAuthApiValue) {
this.httpAuthApiValue = httpAuthApiValue;
}
public String getHttpAuthApiAddTo() {
return httpAuthApiAddTo;
}
public void setHttpAuthApiAddTo(String httpAuthApiAddTo) {
this.httpAuthApiAddTo = httpAuthApiAddTo;
}
public String getHttpAuthBasicUsername() {
return httpAuthBasicUsername;
}
public void setHttpAuthBasicUsername(String httpAuthBasicUsername) {
this.httpAuthBasicUsername = httpAuthBasicUsername;
}
public String getHttpAuthBasicPassword() {
return httpAuthBasicPassword;
}
public void setHttpAuthBasicPassword(String httpAuthBasicPassword) {
this.httpAuthBasicPassword = httpAuthBasicPassword;
}
public String getHttpAuthBearerToken() {
return httpAuthBearerToken;
}
public void setHttpAuthBearerToken(String httpAuthBearerToken) {
this.httpAuthBearerToken = httpAuthBearerToken;
}
public String getHttpParams() {
return httpParams;
public String getHttpAuthParameterValues() {
return httpAuthParameterValues;
}
public void setHttpAuthParameterValues(String httpAuthParameterValues) {
this.httpAuthParameterValues = httpAuthParameterValues;
}
public void setHttpParams(String httpParams) {
this.httpParams = httpParams;
public String getHttpRequestHeader() {
return httpRequestHeader;
}
public void setHttpRequestHeader(String httpRequestHeader) {
this.httpRequestHeader = httpRequestHeader;
}
public String getHttpRequestHeaderParameterValues() {
return httpRequestHeaderParameterValues;
}
public void setHttpRequestHeaderParameterValues(String httpRequestHeaderParameterValues) {
this.httpRequestHeaderParameterValues = httpRequestHeaderParameterValues;
}
public String getHttpRequestBody() {
return httpRequestBody;
}
public void setHttpRequestBody(String httpRequestBody) {
this.httpRequestBody = httpRequestBody;
}
public String getHttpRequestBodyParameterValues() {
return httpRequestBodyParameterValues;
}
public void setHttpRequestBodyParameterValues(String httpRequestBodyParameterValues) {
this.httpRequestBodyParameterValues = httpRequestBodyParameterValues;
}
public int getHttpConnectTimeout() {
return httpConnectTimeout;
}
public void setHttpConnectTimeout(int httpConnectTimeout) {
this.httpConnectTimeout = httpConnectTimeout;
}
public int getHttpRetryCountOnFailure() {
return httpRetryCountOnFailure;
}
public void setHttpRetryCountOnFailure(int httpRetryCountOnFailure) {
this.httpRetryCountOnFailure = httpRetryCountOnFailure;
}
public boolean isHttpAsync() {
return httpAsync;
}
public void setHttpAsync(boolean httpAsync) {
this.httpAsync = httpAsync;
}
public boolean isHttpCache() {
return httpCache;
}
public void setHttpCache(boolean httpCache) {
this.httpCache = httpCache;
}
public String getHttpResponseMapping() {
return httpResponseMapping;
}
public void setHttpResponseMapping(String httpResponseMapping) {
this.httpResponseMapping = httpResponseMapping;
}

5
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/util/WebRequestUtil.java

@ -24,10 +24,7 @@ public class WebRequestUtil {
switch (httpAuthType) {
case NONE:
break;
case API_KEY:
headerBuilder.add(webRequest.getHttpAuthApikey() + "=" + webRequest.getHttpAuthApiValue());
break;
case BASIC_AUTH:
case BASIC:
headerBuilder.add("Authorization:Basic " + Base64.getEncoder().encodeToString(webRequest.getHttpAuthBasicUsername().getBytes(StandardCharsets.UTF_8)) + Base64.getEncoder().encodeToString(webRequest.getHttpAuthBasicPassword().getBytes(StandardCharsets.UTF_8)));
break;
case BEARER:

4
io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/dictionary_render.tpl

@ -4,10 +4,10 @@
*/
@JsonIgnoreProperties(ignoreUnknown=true)
class #(className(dictionary.code,dictionary.version)) {
#(tabs(DictionaryGenerator.generateFields(dictionary.getFields()),1))
#(tabs(DictionaryGenerator.generateFields(dictionary),1))
public void init(){
#(tabs(DictionaryGenerator.generateInits(dictionary.getFields()),2))
#(tabs(DictionaryGenerator.generateFieldInits(dictionary),2))
}
}
#end

5
io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/i18n/enums.properties

@ -95,9 +95,8 @@ io.sc.engine.rule.core.enums.HttpMethodType.TRACE=TRACE
#================================================
# HTTP \u8BA4\u8BC1\u65B9\u6CD5\u679A\u4E3E
#================================================
io.sc.engine.rule.core.enums.HttpAuthorizationType.NONE=No Auth
io.sc.engine.rule.core.enums.HttpAuthorizationType.API_KEY=API Key
io.sc.engine.rule.core.enums.HttpAuthorizationType.BASIC_AUTH=Basic Auth
io.sc.engine.rule.core.enums.HttpAuthorizationType.NONE=NONE
io.sc.engine.rule.core.enums.HttpAuthorizationType.BASIC=Basic
io.sc.engine.rule.core.enums.HttpAuthorizationType.BEARER=Bearer Token
#================================================

5
io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/i18n/enums_tw_CN.properties

@ -95,9 +95,8 @@ io.sc.engine.rule.core.enums.HttpMethodType.TRACE=TRACE
#================================================
# HTTP \u8BA4\u8BC1\u65B9\u6CD5\u679A\u4E3E
#================================================
io.sc.engine.rule.core.enums.HttpAuthorizationType.NONE=No Auth
io.sc.engine.rule.core.enums.HttpAuthorizationType.API_KEY=API Key
io.sc.engine.rule.core.enums.HttpAuthorizationType.BASIC_AUTH=Basic Auth
io.sc.engine.rule.core.enums.HttpAuthorizationType.NONE=NONE
io.sc.engine.rule.core.enums.HttpAuthorizationType.BASIC=Basic
io.sc.engine.rule.core.enums.HttpAuthorizationType.BEARER=Bearer Token
#================================================

5
io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/i18n/enums_zh_CN.properties

@ -96,9 +96,8 @@ io.sc.engine.rule.core.enums.HttpMethodType.TRACE=TRACE
#================================================
# HTTP \u8BA4\u8BC1\u65B9\u6CD5\u679A\u4E3E
#================================================
io.sc.engine.rule.core.enums.HttpAuthorizationType.NONE=No Auth
io.sc.engine.rule.core.enums.HttpAuthorizationType.API_KEY=API Key
io.sc.engine.rule.core.enums.HttpAuthorizationType.BASIC_AUTH=Basic Auth
io.sc.engine.rule.core.enums.HttpAuthorizationType.NONE=NONE
io.sc.engine.rule.core.enums.HttpAuthorizationType.BASIC=Basic
io.sc.engine.rule.core.enums.HttpAuthorizationType.BEARER=Bearer Token
#================================================

4
io.sc.engine.rule.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.engine.rule.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

31
io.sc.engine.rule.frontend/src/i18n/messages.json

@ -108,6 +108,37 @@
"re.processor.dialog.decisionTree.title": "Decision Tree Designer",
"re.processor.dialog.executionFlow.title": "Execution Flow Designer",
"re.processor.dialog.httpRequest.title": "HTTP Request",
"re.processor.httpRequest.tab.url.title": "URL",
"re.processor.httpRequest.tab.authorization.title": "Authorization",
"re.processor.httpRequest.tab.header.title": "Header",
"re.processor.httpRequest.tab.body.title": "Body",
"re.processor.httpRequest.tab.advance.title": "Advance",
"re.processor.httpRequest.entity.httpMethod": "HTTP Method",
"re.processor.httpRequest.entity.httpUrl": "URL",
"re.processor.httpRequest.entity.httpUrlParameterValues": "Parameters",
"re.processor.httpRequest.entity.httpAuthType": "Authorization Mode",
"re.processor.httpRequest.entity.httpAuthBasicUsername": "User Name",
"re.processor.httpRequest.entity.httpAuthBasicPassword": "Password",
"re.processor.httpRequest.entity.httpAuthBearerToken": "Bearer Token",
"re.processor.httpRequest.entity.httpAuthParameterValues": "Parameters",
"re.processor.httpRequest.entity.httpRequestHeader": "Request Header",
"re.processor.httpRequest.entity.httpRequestHeaderParameterValues": "Parameters",
"re.processor.httpRequest.entity.httpRequestBody": "Request Body",
"re.processor.httpRequest.entity.httpRequestBodyParameterValues": "Parameters",
"re.processor.httpRequest.entity.httpConnectTimeout": "Connect Timeout(unit: milliseconds, 1000 milliseconds equals 1 second)",
"re.processor.httpRequest.entity.httpRetryCountOnFailure": "Count of Retry on Failured",
"re.processor.httpRequest.entity.httpAsync": "Is Asynchronous?",
"re.processor.httpRequest.entity.httpCache": "Is Cache?",
"re.processor.httpRequest.entity.httpResponseBody": "Response Body",
"re.processor.httpRequest.entity.httpResponseMapping": "Data Mapping",
"re.processor.grid.title": "Processor",
"re.processor.grid.entity.content": "Content",

31
io.sc.engine.rule.frontend/src/i18n/messages_tw_CN.json

@ -108,6 +108,37 @@
"re.processor.dialog.decisionTree.title": "決策樹設計器",
"re.processor.dialog.executionFlow.title": "執行流設計器",
"re.processor.dialog.httpRequest.title": "HTTP 請求",
"re.processor.httpRequest.tab.url.title": "URL",
"re.processor.httpRequest.tab.authorization.title": "認證",
"re.processor.httpRequest.tab.header.title": "請求頭",
"re.processor.httpRequest.tab.body.title": "請求體",
"re.processor.httpRequest.tab.advance.title": "高級",
"re.processor.httpRequest.entity.httpMethod": "請求方法",
"re.processor.httpRequest.entity.httpUrl": "URL",
"re.processor.httpRequest.entity.httpUrlParameterValues": "參數值",
"re.processor.httpRequest.entity.httpAuthType": "認證模式",
"re.processor.httpRequest.entity.httpAuthBasicUsername": "用戶名稱",
"re.processor.httpRequest.entity.httpAuthBasicPassword": "用戶登錄密碼",
"re.processor.httpRequest.entity.httpAuthBearerToken": "令牌",
"re.processor.httpRequest.entity.httpAuthParameterValues": "參數值",
"re.processor.httpRequest.entity.httpRequestHeader": "請求頭",
"re.processor.httpRequest.entity.httpRequestHeaderParameterValues": "參數值",
"re.processor.httpRequest.entity.httpRequestBody": "請求體",
"re.processor.httpRequest.entity.httpRequestBodyParameterValues": "參數值",
"re.processor.httpRequest.entity.httpConnectTimeout": "連接超時上限(單位:毫秒, 1000 毫秒等於 1 秒)",
"re.processor.httpRequest.entity.httpRetryCountOnFailure": "失敗後重試次數",
"re.processor.httpRequest.entity.httpAsync": "是否異步請求?",
"re.processor.httpRequest.entity.httpCache": "是否啟用緩存?",
"re.processor.httpRequest.entity.httpResponseBody": "響應體",
"re.processor.httpRequest.entity.httpResponseMapping": "數據映射",
"re.processor.grid.title": "處理邏輯",
"re.processor.grid.entity.content": "內容",

31
io.sc.engine.rule.frontend/src/i18n/messages_zh_CN.json

@ -109,6 +109,37 @@
"re.processor.dialog.decisionTree.title": "决策树设计器",
"re.processor.dialog.executionFlow.title": "执行流设计器",
"re.processor.dialog.httpRequest.title": "HTTP 请求",
"re.processor.httpRequest.tab.url.title": "URL",
"re.processor.httpRequest.tab.authorization.title": "认证",
"re.processor.httpRequest.tab.header.title": "请求头",
"re.processor.httpRequest.tab.body.title": "请求体",
"re.processor.httpRequest.tab.advance.title": "高级",
"re.processor.httpRequest.entity.httpMethod": "请求方法",
"re.processor.httpRequest.entity.httpUrl": "URL",
"re.processor.httpRequest.entity.httpUrlParameterValues": "测试值",
"re.processor.httpRequest.entity.httpAuthType": "认证模式",
"re.processor.httpRequest.entity.httpAuthBasicUsername": "用户名称",
"re.processor.httpRequest.entity.httpAuthBasicPassword": "用户登录密码",
"re.processor.httpRequest.entity.httpAuthBearerToken": "令牌",
"re.processor.httpRequest.entity.httpAuthParameterValues": "测试值",
"re.processor.httpRequest.entity.httpRequestHeader": "请求头",
"re.processor.httpRequest.entity.httpRequestHeaderParameterValues": "测试值",
"re.processor.httpRequest.entity.httpRequestBody": "请求体",
"re.processor.httpRequest.entity.httpRequestBodyParameterValues": "测试值",
"re.processor.httpRequest.entity.httpConnectTimeout": "连接超时上限(单位:毫秒, 1000 毫秒等于 1 秒)",
"re.processor.httpRequest.entity.httpRetryCountOnFailure": "失败后重试次数",
"re.processor.httpRequest.entity.httpAsync": "是否异步请求?",
"re.processor.httpRequest.entity.httpCache": "是否启用缓存?",
"re.processor.httpRequest.entity.httpResponseBody": "响应体",
"re.processor.httpRequest.entity.httpResponseMapping": "数据映射",
"re.processor.grid.title": "处理逻辑",
"re.processor.grid.entity.content": "内容",

102
io.sc.engine.rule.frontend/src/utils/JsonParameterAndValueTypeParser.ts

@ -0,0 +1,102 @@
import { Tools } from 'platform-core';
class JsonParameterAndValueTypeParser {
public static isPrimary(obj: any) {
return Tools.isBoolean(obj) || Tools.isString(obj) || Tools.isNumber(obj);
}
public static parseJsonString(str: string, code: string, name: string) {
if (Tools.isUndefinedOrNull(str)) {
return null;
}
const data = Tools.json2Object(str);
if (Tools.isUndefinedOrNull(data)) {
return null;
}
const parameterAndValueType = {
parameters: {},
valueTypes: {},
};
JsonParameterAndValueTypeParser.parseObject(data, code, name, parameterAndValueType);
return parameterAndValueType;
}
public static parseJsonObject(obj: any, code: string, name: string) {
if (Tools.isUndefinedOrNull(obj)) {
return null;
}
const parameterAndValueType = {
parameters: {},
valueTypes: {},
};
JsonParameterAndValueTypeParser.parseObject(obj, code, name, parameterAndValueType);
return parameterAndValueType;
}
private static parseObject(obj: any, code: string, name: string, parameterAndValueType: any) {
if (JsonParameterAndValueTypeParser.isPrimary(obj)) {
JsonParameterAndValueTypeParser.doParsePrimary(obj, code, name, parameterAndValueType);
} else if (Tools.isArray(obj)) {
JsonParameterAndValueTypeParser.doParseArray(obj, code, name, parameterAndValueType);
} else if (Tools.isObject(obj)) {
JsonParameterAndValueTypeParser.doParseObject(obj, code, name, parameterAndValueType);
}
}
private static doParsePrimary(obj: any, code: string, name: string, parameterAndValueType: any) {
if (Tools.isUndefinedOrNull(obj)) {
return;
}
const parameter = {
code: code,
name: name,
type: 'OUT',
valueType: null,
valueTypeVersion: null,
valueTypeIsList: false,
};
if (Tools.isBoolean(obj)) {
parameter.valueType = 'java.lang.Boolean';
} else if (Tools.isString(obj)) {
parameter.valueType = 'java.lang.String';
} else if (Tools.isNumber(obj)) {
parameter.valueType = 'java.math.BigDecimal';
}
parameterAndValueType.parameters[code] = parameter;
parameterAndValueType.parameters[name] = parameter;
}
private static doParseArray(array: any, code: string, name: string, parameterAndValueType: any) {
if (Tools.isUndefinedOrNull(array)) {
return;
}
const parameter = {
code: code,
name: name,
type: 'OUT',
valueType: null,
valueTypeVersion: null,
valueTypeIsList: true,
};
const firstElement = array[0];
}
private static doParseObject(array: any, code: string, name: string, parameterAndValueType: any) {
if (Tools.isUndefinedOrNull(array)) {
return;
}
const parameter = {
code: code,
name: name,
type: 'OUT',
valueType: null,
valueTypeVersion: null,
valueTypeIsList: true,
};
const firstElement = array[0];
}
}
export { JsonParameterAndValueTypeParser };

37
io.sc.engine.rule.frontend/src/utils/VariableUtil.ts

@ -0,0 +1,37 @@
import { Tools } from 'platform-core';
class VariableUtil {
private static Dollar_Reg = /(\$\{(.+?)\})(\[(.+?)\])?((\[(.+?)\])?(\.?(\$\{(.+?)\})(\[(.+?)\])?)+?)*/g;
private static Well_Reg = /#\{(.+?)\}\.#\{(.+?)\}/g;
/**
* :
* ${aaa}
* ${bbb}[1]
* ${ccc}[1].${ddd}
* ${eee}[1].${fff}[2]
* ${ggg}[1].${hhh}[2].${iii}
* #{aaa}.#{bbb}
* @param str
* @returns
*/
public static extract(str: string): string[] {
if (Tools.isUndefinedOrNull(str)) {
return [];
}
const dollarMatches: any = str.match(VariableUtil.Dollar_Reg) || [];
const wellMatches: any = str.match(VariableUtil.Well_Reg) || [];
const result: any[] = [];
dollarMatches.forEach((item: any) => {
result.push(item);
});
wellMatches.forEach((item: any) => {
result.push(item);
});
return result;
}
}
export { VariableUtil };

663
io.sc.engine.rule.frontend/src/views/resources/designer/HttpRequestDialog.vue

@ -0,0 +1,663 @@
<template>
<w-dialog
ref="dialogRef"
:title="$t('re.processor.dialog.httpRequest.title')"
:can-maximize="false"
body-padding="0px 0px 0px 0px"
width="1024px"
:buttons="[
{
icon: 'beenhere',
label: $t('save'),
click: save,
},
]"
>
<q-splitter :model-value="50" horizontal separator-style="height:3px">
<template #before>
<q-tabs v-model="selectedTabRef" no-caps inline-label align="left" class="px-4" @update:model-value="refresh">
<q-tab name="url" icon="bi-link-45deg" :label="$t('re.processor.httpRequest.tab.url.title')" />
<q-tab name="authorization" icon="bi-shield-lock" :label="$t('re.processor.httpRequest.tab.authorization.title')" />
<q-tab name="header" icon="bi-list-task" :label="$t('re.processor.httpRequest.tab.header.title')" />
<q-tab name="body" icon="bi-receipt" :label="$t('re.processor.httpRequest.tab.body.title')" />
<q-tab name="advance" icon="bi-gear" :label="$t('re.processor.httpRequest.tab.advance.title')" />
</q-tabs>
<q-tab-panels v-model="selectedTabRef" animated class="px-4 pt-2" style="height: 300px">
<q-tab-panel name="url" style="padding: 0px; height: 100%">
<w-form
ref="urlFormRef"
v-model="modelValue"
:cols-num="12"
:fields="[
{
colSpan: 2,
name: 'httpMethod',
label: $t('re.processor.httpRequest.entity.httpMethod'),
type: 'w-select',
options: httpMethodTypeOptionsRef,
defaultValue: 'GET',
},
{
firstCol: true,
colSpan: 6,
name: 'httpUrl',
label: $t('re.processor.grid.entity.httpUrl'),
type: 'w-code-mirror',
height: 224,
toolbar: false,
lang: 'javascript',
placeholder: true,
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletionManager.autoCompletion(),
},
{
colSpan: 6,
name: 'httpUrlParameterValues',
type: 'w-grid',
height: 192,
title: $t('re.processor.httpRequest.entity.httpUrlParameterValues'),
dense: dense,
localMode: true,
autoFetchData: false,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
args.grid.setLocalData(analyze(urlFormRef.getFieldValue('httpUrl')));
},
},
'separator',
'add',
'edit',
{
extend: 'remove',
click: (args: any) => {
args.grid.removeLocalData(args.selecteds);
},
},
],
columns: parameterValueGridColumns,
editor: parameterValueGridEditor,
onAfterEditorDataSubmit: (args: any) => {
updateGridValues(args.grid, 'httpUrlParameterValues');
},
},
]"
>
</w-form>
</q-tab-panel>
<q-tab-panel name="authorization" style="padding: 0px; height: 100%">
<w-form
ref="authorizationFormRef"
v-model="modelValue"
:cols-num="12"
:fields="[
{
colSpan: 6,
type: 'w-form-group',
layout: 'form',
colsNum: 1,
fields: [
{
name: 'httpAuthType',
label: $t('re.processor.httpRequest.entity.httpAuthType'),
type: 'w-select',
options: httpAuthorizationTypeOptionsRef,
defaultValue: 'NONE',
'onUpdate:modelValue': httpAuthTypeChanged,
},
{
name: 'httpAuthBasicUsername',
label: $t('re.processor.httpRequest.entity.httpAuthBasicUsername'),
showIf: (args: any) => {
return args.form.getFieldValue('httpAuthType') === 'BASIC';
},
type: 'w-code-mirror',
height: 30,
toolbar: false,
lang: 'javascript',
placeholder: true,
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletionManager.autoCompletion(),
},
{
name: 'httpAuthBasicPassword',
label: $t('re.processor.httpRequest.entity.httpAuthBasicPassword'),
showIf: (args: any) => {
return args.form.getFieldValue('httpAuthType') === 'BASIC';
},
type: 'w-code-mirror',
toolbar: false,
lang: 'javascript',
height: 30,
placeholder: true,
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletionManager.autoCompletion(),
},
{
name: 'httpAuthBearerToken',
label: $t('re.processor.httpRequest.entity.httpAuthBearerToken'),
showIf: (args: any) => {
return args.form.getFieldValue('httpAuthType') === 'BEARER';
},
type: 'w-code-mirror',
toolbar: false,
lang: 'javascript',
height: 228,
placeholder: true,
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletionManager.autoCompletion(),
},
],
},
{
colSpan: 6,
name: 'httpAuthParameterValues',
showIf: (args: any) => {
return args.form.getFieldValue('httpAuthType') === 'BEARER' || args.form.getFieldValue('httpAuthType') === 'BASIC';
},
type: 'w-grid',
title: $t('re.processor.httpRequest.entity.httpAuthParameterValues'),
height: 236,
dense: dense,
localMode: true,
autoFetchData: false,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
const httpAuthType = authorizationFormRef.getFieldValue('httpAuthType');
if (httpAuthType === 'NONE') {
args.grid.setLocalData([]);
} else if (httpAuthType === 'BASIC') {
const httpAuthBasicUsername = authorizationFormRef.getFieldValue('httpAuthBasicUsername');
const httpAuthBasicPassword = authorizationFormRef.getFieldValue('httpAuthBasicPassword');
args.grid.setLocalData(analyze(httpAuthBasicUsername, httpAuthBasicPassword));
} else if (httpAuthType === 'BEARER') {
const httpAuthBearerToken = authorizationFormRef.getFieldValue('httpAuthBearerToken');
args.grid.setLocalData(analyze(httpAuthBearerToken));
}
},
},
'separator',
'add',
'edit',
{
extend: 'remove',
click: (args: any) => {
args.grid.removeLocalData(args.selecteds);
},
},
],
columns: parameterValueGridColumns,
editor: parameterValueGridEditor,
onAfterEditorDataSubmit: (args: any) => {
updateGridValues(args.grid, 'httpAuthParameterValues');
},
},
]"
>
</w-form>
</q-tab-panel>
<q-tab-panel name="header" style="padding: 0px; height: 100%">
<w-form
ref="headerFormRef"
v-model="modelValue"
:cols-num="12"
:fields="[
{
colSpan: 6,
name: 'httpRequestHeader',
label: $t('re.processor.httpRequest.entity.httpRequestHeader'),
type: 'w-code-mirror',
toolbar: false,
lang: 'json',
height: 268,
placeholder: true,
lineWrap: true,
lineBreak: true,
autoCompletion: autoCompletionManager.autoCompletion(),
defaultValue: '{\n\t\n}',
},
{
colSpan: 6,
name: 'httpRequestHeaderParameterValues',
type: 'w-grid',
title: $t('re.processor.httpRequest.entity.httpRequestHeaderParameterValues'),
height: 236,
dense: dense,
localMode: true,
autoFetchData: false,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
args.grid.setLocalData(analyze(headerFormRef.getFieldValue('httpRequestHeader')));
},
},
'separator',
'add',
'edit',
{
extend: 'remove',
click: (args: any) => {
args.grid.removeLocalData(args.selecteds);
},
},
],
columns: parameterValueGridColumns,
editor: parameterValueGridEditor,
onAfterEditorDataSubmit: (args: any) => {
updateGridValues(args.grid, 'httpRequestHeaderParameterValues');
},
},
]"
>
</w-form>
</q-tab-panel>
<q-tab-panel name="body" style="padding: 0px; height: 100%">
<w-form
ref="bodyFormRef"
v-model="modelValue"
:cols-num="12"
:fields="[
{
colSpan: 6,
name: 'httpRequestBody',
label: $t('re.processor.httpRequest.entity.httpRequestBody'),
type: 'w-code-mirror',
toolbar: false,
lang: 'json',
height: 268,
placeholder: true,
lineWrap: true,
lineBreak: true,
autoCompletion: autoCompletionManager.autoCompletion(),
defaultValue: '{\n\t\n}',
},
{
colSpan: 6,
name: 'httpRequestBodyParameterValues',
type: 'w-grid',
title: $t('re.processor.httpRequest.entity.httpRequestBodyParameterValues'),
height: 236,
dense: dense,
localMode: true,
autoFetchData: false,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
args.grid.setLocalData(analyze(bodyFormRef.getFieldValue('httpRequestBody')));
},
},
'separator',
'add',
'edit',
{
extend: 'remove',
click: (args: any) => {
args.grid.removeLocalData(args.selecteds);
},
},
],
columns: parameterValueGridColumns,
editor: parameterValueGridEditor,
onAfterEditorDataSubmit: (args: any) => {
updateGridValues(args.grid, 'httpRequestBodyParameterValues');
},
},
]"
>
</w-form>
</q-tab-panel>
<q-tab-panel name="advance" style="padding: 0px; height: 100%">
<w-form
ref="advanceFormRef"
v-model="modelValue"
:cols-num="3"
:fields="[
{
firstCol: true,
name: 'httpConnectTimeout',
label: $t('re.processor.httpRequest.entity.httpConnectTimeout'),
type: 'w-integer',
defaultValue: 3000,
},
{
firstCol: true,
name: 'httpRetryCountOnFailure',
label: $t('re.processor.httpRequest.entity.httpRetryCountOnFailure'),
type: 'w-integer',
defaultValue: 0,
},
{
firstCol: true,
name: 'httpAsync',
label: $t('re.processor.httpRequest.entity.httpAsync'),
type: 'w-checkbox',
defaultValue: false,
},
{
firstCol: true,
name: 'httpCache',
label: $t('re.processor.httpRequest.entity.httpCache'),
type: 'w-checkbox',
defaultValue: false,
},
]"
>
</w-form>
</q-tab-panel>
</q-tab-panels>
</template>
<template #after>
<w-form
ref="responseFormRef"
v-model="modelValue"
class="px-2 pt-1 pb-2"
:cols-num="1"
:fields="[
{
type: 'w-form-group',
align: 'right',
fields: [
{
type: 'q-btn',
label: $t('send'),
icon: 'bi-send',
dense: true,
outline: true,
onClick: (args: any) => {
axios.post(Environment.apiContextPath('/api/re/indicator/processor/sendWebRequest'), modelValue).then((response) => {
const result = response.data;
if (result.successful) {
modelValue.httpResponseBody = result.content;
} else {
modelValue.httpResponseBody = result.status + ',' + result.error;
}
});
const parameters = Tools.deepClone(autoCompletionManager.getParameters());
console.log(parameters);
const valueTypes = Tools.deepClone(autoCompletionManager.getValueTypes());
responseAutoCompletionManager.setParameters(parameters);
responseAutoCompletionManager.setValueTypes(valueTypes);
},
},
],
},
{
name: 'httpResponseBody',
label: $t('re.processor.httpRequest.entity.httpResponseBody'),
type: 'w-code-mirror',
toolbar: false,
lang: 'javascript',
height: 240,
},
]"
>
</w-form>
</template>
</q-splitter>
</w-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { $t, axios, Environment, EnumTools, Tools, Options } from 'platform-core';
import { reactive } from 'vue';
import { AutoCompletionManager } from '@/views/shared/AutoCompletionManager';
import { PlaceHolder } from '@/utils/PlaceHolder';
import { VariableUtil } from '@/utils/VariableUtil';
import { nextTick } from 'vue';
let context = undefined;
const dense = false;
const dialogRef = ref();
const selectedTabRef = ref('url');
const httpMethodTypeEnumRef = ref();
const httpMethodTypeOptionsRef = ref();
const httpAuthorizationTypeEnumRef = ref();
const httpAuthorizationTypeOptionsRef = ref();
const urlFormRef = ref();
const authorizationFormRef = ref();
const headerFormRef = ref();
const bodyFormRef = ref();
const advanceFormRef = ref();
const responseFormRef = ref();
const httpResponseRef = ref();
const autoCompletionManager = new AutoCompletionManager();
const responseAutoCompletionManager = new AutoCompletionManager();
const modelValue = reactive({
type: 'HTTP_REQUEST',
parameter: undefined,
id: undefined,
httpMethod: undefined,
httpUrl: undefined,
httpUrlParameterValues: undefined,
httpAuthType: undefined,
httpAuthBasicUsername: undefined,
httpAuthBasicPassword: undefined,
httpAuthBearerToken: undefined,
httpAuthParameterValues: undefined,
httpRequestHeader: undefined,
httpRequestHeaderParameterValues: undefined,
httpRequestBody: undefined,
httpRequestBodyParameterValues: undefined,
httpResponseBody: undefined,
httpResponseMapping: undefined,
httpConnectTimeout: 3000,
httpRetryCountOnFailure: 0,
httpAsync: false,
httpCache: false,
});
const parameterValueGridColumns = [
{
width: '40%',
name: 'name',
label: $t('name'),
align: 'left',
sortable: false,
format: (value: any) => {
return PlaceHolder.replace(value);
},
},
{
width: '60%',
name: 'value',
label: $t('value'),
sortable: false,
},
];
const parameterValueGridEditor = {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'name',
label: $t('name'),
type: 'w-code-mirror',
toolbar: false,
lang: 'java',
height: 30,
placeholder: true,
autoCompletion: autoCompletionManager.autoCompletion(),
},
{
name: 'value',
label: $t('value'),
type: 'w-text',
},
],
},
};
const open = async (_context: any) => {
context = _context;
if (context.targetType === 'parameter') {
modelValue.parameter = context.target.id;
} else if (context.targetType === 'indicator') {
modelValue.indicator = context.target.id;
}
modelValue.id = context.processor.id;
modelValue.httpMethod = context.processor.httpMethod;
modelValue.httpUrl = context.processor.httpUrl;
modelValue.httpUrlParameterValues = context.processor.httpUrlParameterValues;
modelValue.httpAuthType = context.processor.httpAuthType;
modelValue.httpAuthBasicUsername = context.processor.httpAuthBasicUsername;
modelValue.httpAuthBasicPassword = context.processor.httpAuthBasicPassword;
modelValue.httpAuthBearerToken = context.processor.httpAuthBearerToken;
modelValue.httpAuthParameterValues = context.processor.httpAuthParameterValues;
modelValue.httpRequestHeader = context.processor.httpRequestHeader;
modelValue.httpRequestHeaderParameterValues = context.processor.httpRequestHeaderParameterValues;
modelValue.httpRequestBody = context.processor.httpRequestBody;
modelValue.httpRequestBodyParameterValues = context.processor.httpRequestBodyParameterValues;
modelValue.httpResponseBody = context.processor.httpResponseBody;
modelValue.httpResponseMapping = context.processor.httpResponseMapping;
modelValue.httpConnectTimeout = context.processor.httpConnectTimeout;
modelValue.httpRetryCountOnFailure = context.processor.httpRetryCountOnFailure;
modelValue.httpAsync = context.processor.httpAsync;
modelValue.httpCache = context.processor.httpCache;
init();
dialogRef.value.show();
refresh();
};
const close = () => {
dialogRef.value.hide();
};
const init = () => {
if (context.targetType === 'parameter') {
autoCompletionManager.load(Environment.apiContextPath('/api/re/common/parameterAndValueType/findByParameterId/' + context.target.id));
} else if (context.targetType === 'indicator') {
autoCompletionManager.load(Environment.apiContextPath('/api/re/common/parameterAndValueType/findByIndicatorId/' + context.target.id));
}
};
const refresh = () => {
nextTick(() => {
let data = Tools.json2Object(modelValue.httpUrlParameterValues) || [];
let grid = urlFormRef.value?.getFieldComponent('httpUrlParameterValues');
if (data && data.length > 0) {
grid?.setLocalData(data);
}
data = Tools.json2Object(modelValue.httpAuthParameterValues) || [];
grid = authorizationFormRef.value?.getFieldComponent('httpAuthParameterValues');
if (data && data.length > 0) {
grid?.setLocalData(data);
}
data = Tools.json2Object(modelValue.httpRequestHeaderParameterValues) || [];
grid = headerFormRef.value?.getFieldComponent('httpRequestHeaderParameterValues');
if (data && data.length > 0) {
grid?.setLocalData(data);
}
data = Tools.json2Object(modelValue.httpRequestBodyParameterValues) || [];
grid = bodyFormRef.value?.getFieldComponent('httpRequestBodyParameterValues');
if (data && data.length > 0) {
grid?.setLocalData(data);
}
});
};
const httpAuthTypeChanged = () => {};
const updateGridValues = (grid: any, gridType: string) => {
const rows = grid.getRows();
const items: any[] = [];
if (rows && rows.length > 0) {
for (const row of rows) {
items.push({ name: row.name, value: row.value });
}
}
if (gridType === 'httpUrlParameterValues') {
modelValue.httpUrlParameterValues = Tools.object2Json(items);
} else if (gridType === 'httpAuthParameterValues') {
modelValue.httpAuthParameterValues = Tools.object2Json(items);
} else if (gridType === 'httpRequestHeaderParameterValues') {
modelValue.httpRequestHeaderParameterValues = Tools.object2Json(items);
} else if (gridType === 'httpRequestBodyParameterValues') {
modelValue.httpRequestBodyParameterValues = Tools.object2Json(items);
}
};
const save = () => {
axios.put(Environment.apiContextPath('/api/re/model/parameter/processor/' + context.processor.id), modelValue).then((response) => {
context.processorGrid?.updateLocalData(response.data);
close();
});
};
const analyze = (...args: string[]) => {
if (Tools.isUndefinedOrNull(args) || args.length <= 0) {
return [];
}
let arrays: Array<string> = [];
for (const arg of args) {
arrays = arrays.concat(VariableUtil.extract(arg));
}
//
const variables = [...new Set(arrays)];
const rows: any[] = [];
for (const item of variables) {
rows.push({ name: item, value: null });
}
return rows;
};
defineExpose({
open,
close,
});
EnumTools.fetch(['io.sc.engine.rule.core.enums.HttpMethodType', 'io.sc.engine.rule.core.enums.HttpAuthorizationType']).then((value) => {
httpMethodTypeEnumRef.value = value.HttpMethodType;
httpMethodTypeOptionsRef.value = Options.enum(httpMethodTypeEnumRef.value);
httpAuthorizationTypeEnumRef.value = value.HttpAuthorizationType;
httpAuthorizationTypeOptionsRef.value = Options.enum(httpAuthorizationTypeEnumRef.value);
});
</script>

17
io.sc.engine.rule.frontend/src/views/resources/designer/Processor.vue

@ -42,6 +42,14 @@
decisionTreeDialogRef.open(parameter.id, args.selected?.id);
} else if ('EXECUTION_FLOW' === type) {
executionFlowDialogRef.open(parameter.id, args.selected?.id);
} else if ('HTTP_REQUEST' === type) {
const context = {
targetType: 'parameter',
target: parameter,
processor: args.selected,
processorGrid: gridRef,
};
httpRequestDialogRef.open(context);
} else {
args._click(args);
}
@ -91,7 +99,7 @@
name: 'type',
label: $t('type'),
sortable: false,
format: (value, row) => {
format: (value: any, row: any) => {
return $t('io.sc.engine.rule.core.enums.ProcessorType.' + value);
},
},
@ -139,18 +147,19 @@
},
}"
@before-editor-data-submit="
(args) => {
(args: any) => {
processorManager.beforeEditorDataSubmit(args);
}
"
@after-editor-open="
(args) => {
(args: any) => {
processorManager.afterEditorOpen(args);
}
"
></w-grid>
<DecisionTreeDialog ref="decisionTreeDialogRef"></DecisionTreeDialog>
<ExecutionFlowDialog ref="executionFlowDialogRef"></ExecutionFlowDialog>
<HttpRequestDialog ref="httpRequestDialogRef"></HttpRequestDialog>
<ObjectPropertiesMatcherDialog
ref="objectPropertiesMatcherDialogRef"
:target-type="Processor.PARAMETER"
@ -173,6 +182,7 @@ import { Processor } from '@/views/shared/Processor';
import { PlaceHolder } from '@/utils/PlaceHolder';
import DecisionTreeDialog from './DecisionTreeDialog.vue';
import ExecutionFlowDialog from './ExecutionFlowDialog.vue';
import HttpRequestDialog from './HttpRequestDialog.vue';
import ObjectPropertiesMatcherDialog from '@/views/shared/ObjectPropertiesMatcherDialog.vue';
const props = defineProps({
@ -185,6 +195,7 @@ const props = defineProps({
const gridRef = ref();
const decisionTreeDialogRef = ref();
const executionFlowDialogRef = ref();
const httpRequestDialogRef = ref();
const objectPropertiesMatcherDialogRef = ref();
const processorManagerContext = {
target: props.parameter,

9
io.sc.engine.rule.frontend/src/views/shared/AutoCompletionManager.ts

@ -71,9 +71,18 @@ class AutoCompletionManager {
this.valueTypes = {};
}
public getParameters() {
return this.parameters;
}
public setParameters(parameters: any) {
this.parameters = parameters;
}
public getValueTypes() {
return this.valueTypes;
}
public setValueTypes(valueTypes: any) {
this.valueTypes = valueTypes;
}

580
io.sc.engine.rule.frontend/src/views/shared/processors/HttpRequest copy.ts

@ -0,0 +1,580 @@
import { ref, computed } from 'vue';
import { axios, Environment, $t, Tools, EnumTools, Options } from 'platform-core';
import { Processor } from '../Processor';
import { PlaceHolder } from '@/utils/PlaceHolder';
class HttpRequest extends Processor {
#editorForm: any;
#httpResponseBodyRef = ref(undefined);
#httpMethodTypeEnum: any;
#httpMethodTypeOptionsRef = ref(<any>[]);
#HttpAuthorizationTypeEnum: any;
#httpAuthorizationTypeOptionsRef = ref(<any>[]);
constructor(targetType: string, context?: any) {
super(targetType, context);
this.PROCESSOR_TYPE = 'HTTP_REQUEST';
this.EDITOR_DIALOG_WIDTH = 1100;
}
public getToolbarAction(): any {
return {
extend: 'add',
name: 'http',
label: $t('io.sc.engine.rule.core.enums.ProcessorType.' + this.PROCESSOR_TYPE),
icon: 'sync_alt',
enableIf: (args: any) => {
const valueType = this.context.target.valueType;
return valueType !== 'io.sc.engine.rule.core.SingleRuleResult' && valueType !== 'io.sc.engine.rule.core.RuleSetResult';
},
afterClick: (args: any) => {
args.grid.getEditorForm().setFieldValue('type', this.PROCESSOR_TYPE);
},
};
}
public format(row: any): any {
return row.httpMethod + ', ' + PlaceHolder.replace(row.httpUrl);
}
public getEditorFields(): any {
return [
{
colSpan: 2,
name: 'httpMethod',
label: $t('re.processor.grid.entity.httpMethod'),
type: 'w-select',
options: this.#httpMethodTypeOptionsRef,
rows: 1,
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
},
{
colSpan: 2,
name: 'httpAuthType',
label: $t('re.processor.grid.entity.httpAuthType'),
type: 'w-select',
options: this.#httpAuthorizationTypeOptionsRef,
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
},
{
colSpan: 4,
name: 'httpAuthApikey',
label: $t('re.processor.grid.entity.httpAuthApikey'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'API_KEY';
},
},
{
colSpan: 4,
name: 'httpAuthApiValue',
label: $t('re.processor.grid.entity.httpAuthApiValue'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'API_KEY';
},
},
{
colSpan: 4,
name: 'httpAuthBasicUsername',
label: $t('re.processor.grid.entity.httpAuthBasicUsername'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'BASIC_AUTH';
},
},
{
colSpan: 4,
name: 'httpAuthBasicPassword',
label: $t('re.processor.grid.entity.httpAuthBasicPassword'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'BASIC_AUTH';
},
},
{
colSpan: 8,
name: 'httpAuthBearerToken',
label: $t('re.processor.grid.entity.httpAuthBearerToken'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'BEARER';
},
},
{
colSpan: 6,
firstCol: true,
name: 'httpUrl',
label: $t('re.processor.grid.entity.httpUrl'),
type: 'w-code-mirror',
lang: 'javascript',
rows: 6,
toolbar: false,
placeholder: true,
lineWrap: true,
lineBreak: true,
lineHeight: '1.3rem',
fontSize: '0.75rem',
autoCompletion: this.autoCompletionManager.autoCompletion(),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
},
{
colSpan: 6,
name: 'httpUrlParameterValues',
label: $t('re.processor.grid.entity.httpUrlParameterValues'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-grid',
height: 93,
title: $t('re.processor.grid.entity.httpUrlParameterValues'),
localMode: true,
autoFetchData: false,
dense: true,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
const sql = this.#editorForm.getFieldValue('httpUrl');
const regex = /\$\{[\u0000-\uFFFF]+?\}/g;
const array: any[] = sql.match(regex);
const rows: any[] = [];
array.forEach((item) => {
rows.push({ name: item, value: '' });
});
const grid = this.#editorForm.getFieldComponent('httpUrlParameterValues');
grid.setLocalData(rows);
},
},
'separator',
'add',
'edit',
[
{
extend: 'remove',
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('httpUrlParameterValues');
grid.removeRows(args.selecteds);
},
},
{
extend: 'remove',
name: 'removeAll',
label: $t('deleteAll'),
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('httpUrlParameterValues');
grid.setLocalData([]);
},
},
],
],
columns: [
{
width: '50%',
name: 'name',
label: $t('name'),
align: 'left',
sortable: false,
format: (value: any) => {
return PlaceHolder.replace(value);
},
},
{
width: '100%',
name: 'value',
label: $t('value'),
sortable: false,
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'name',
label: $t('name'),
type: 'w-code-mirror',
toolbar: false,
lang: 'java',
rows: 1,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
},
{
name: 'value',
label: $t('value'),
type: 'w-text',
},
],
},
},
},
{
colSpan: 6,
firstCol: true,
name: 'httpRequestHeader',
label: $t('re.processor.grid.entity.httpRequestHeader'),
type: 'w-code-mirror',
lang: 'javascript',
rows: 6,
toolbar: false,
placeholder: true,
lineWrap: true,
lineBreak: true,
lineHeight: '1.3rem',
fontSize: '0.75rem',
autoCompletion: this.autoCompletionManager.autoCompletion(),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
},
{
colSpan: 6,
name: 'httpRequestHeaderParameterValues',
label: $t('re.processor.grid.entity.httpRequestHeaderParameterValues'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-grid',
height: 93,
title: $t('re.processor.grid.entity.httpRequestHeaderParameterValues'),
localMode: true,
autoFetchData: false,
dense: true,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
const sql = this.#editorForm.getFieldValue('httpRequestHeader');
const regex = /\$\{[\u0000-\uFFFF]+?\}/g;
const array: any[] = sql.match(regex);
const rows: any[] = [];
array.forEach((item) => {
rows.push({ name: item, value: '' });
});
const grid = this.#editorForm.getFieldComponent('httpRequestHeaderParameterValues');
grid.setLocalData(rows);
},
},
'separator',
'add',
'edit',
[
{
extend: 'remove',
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('httpRequestHeaderParameterValues');
grid.removeRows(args.selecteds);
},
},
{
extend: 'remove',
name: 'removeAll',
label: $t('deleteAll'),
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('httpRequestHeaderParameterValues');
grid.setLocalData([]);
},
},
],
],
columns: [
{
width: '50%',
name: 'name',
label: $t('name'),
align: 'left',
sortable: false,
format: (value: any) => {
return PlaceHolder.replace(value);
},
},
{
width: '100%',
name: 'value',
label: $t('value'),
sortable: false,
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'name',
label: $t('name'),
type: 'w-code-mirror',
toolbar: false,
lang: 'java',
rows: 1,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
},
{
name: 'value',
label: $t('value'),
type: 'w-text',
},
],
},
},
},
{
colSpan: 6,
name: 'httpRequestBody',
label: $t('re.processor.grid.entity.httpRequestBody'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-code-mirror',
rows: 7,
toolbar: false,
lineNumber: false,
lang: 'json',
lineWrap: false,
lineBreak: true,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
userDefinedFunctions: this.userDefinedFunctionsManager.userDefinedFunctions(),
},
{
colSpan: 6,
name: 'httpRequestBodyParameterValues',
label: $t('re.processor.grid.entity.httpRequestBodyParameterValues'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-grid',
height: 110,
title: $t('re.processor.grid.entity.httpRequestBodyParameterValues'),
localMode: true,
autoFetchData: false,
dense: true,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'send',
label: $t('send'),
icon: 'bi-send',
click: (args: any) => {
const httpMethod = this.#editorForm.getFieldValue('httpMethod');
const httpUrl = this.#editorForm.getFieldValue('httpUrl');
const httpAuthType = this.#editorForm.getFieldValue('httpAuthType');
const httpAuthApikey = this.#editorForm.getFieldValue('httpAuthApikey');
const httpAuthApiValue = this.#editorForm.getFieldValue('httpAuthApiValue');
const httpAuthBasicUsername = this.#editorForm.getFieldValue('httpAuthBasicUsername');
const httpAuthBasicPassword = this.#editorForm.getFieldValue('httpAuthBasicPassword');
const httpAuthBearerToken = this.#editorForm.getFieldValue('httpAuthBearerToken');
const httpRequestBody = this.#editorForm.getFieldValue('httpRequestBody');
axios
.post(Environment.apiContextPath('/api/re/indicator/processor/sendWebRequest'), {
httpMethod,
httpUrl,
httpAuthType,
httpAuthApikey,
httpAuthApiValue,
httpAuthBasicUsername,
httpAuthBasicPassword,
httpAuthBearerToken,
httpRequestBody,
})
.then((response) => {
const result = response.data;
if (result.successful) {
this.#httpResponseBodyRef.value = result.content;
} else {
this.#httpResponseBodyRef.value = result.status + ',' + result.error;
}
});
},
},
'separator',
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
const sql = this.#editorForm.getFieldValue('httpRequestBody');
const regex = /\$\{[\u0000-\uFFFF]+?\}/g;
const array: any[] = sql.match(regex);
const rows: any[] = [];
array.forEach((item) => {
rows.push({ name: item, value: '' });
});
const grid = this.#editorForm.getFieldComponent('httpRequestBodyParameterValues');
grid.setLocalData(rows);
},
},
'separator',
'add',
'edit',
[
{
extend: 'remove',
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('httpRequestBodyParameterValues');
grid.removeRows(args.selecteds);
},
},
{
extend: 'remove',
name: 'removeAll',
label: $t('deleteAll'),
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('httpRequestBodyParameterValues');
grid.setLocalData([]);
},
},
],
],
columns: [
{
width: '50%',
name: 'name',
label: $t('name'),
align: 'left',
sortable: false,
format: (value: any) => {
return PlaceHolder.replace(value);
},
},
{
width: '100%',
name: 'value',
label: $t('value'),
sortable: false,
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'name',
label: $t('name'),
type: 'w-code-mirror',
toolbar: false,
lang: 'java',
rows: 1,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
},
{
name: 'value',
label: $t('value'),
type: 'w-text',
},
],
},
},
},
{
colSpan: 12,
name: 'httpResponseBody',
label: $t('re.processor.grid.entity.httpResponseBody'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-code-mirror',
lang: 'json',
rows: 4,
lineHeight: '1.3rem',
fontSize: '0.75rem',
toolbar: false,
lineNumber: false,
lineWrap: false,
lineBreak: true,
modelValue: this.#httpResponseBodyRef.value,
},
{
colSpan: 12,
name: 'httpResponseMapping',
label: $t('re.processor.grid.entity.httpResponseMapping'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-code-mirror',
rows: 5,
toolbar: false,
lineNumber: false,
lineHeight: '1.3rem',
fontSize: '0.75rem',
lang: 'java',
lineWrap: false,
lineBreak: true,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
userDefinedFunctions: this.userDefinedFunctionsManager.userDefinedFunctions(),
defaultValue:
'if(${response}.getSuccessful()){\n\t//def object =new groovy.xml.XmlParser().parse(${response}.getContent());\n\tdef object = new groovy.json.JsonSlurper().parseText(${response}.getContent());\n}',
},
];
}
public getViewerFields(): any {
return [
{ name: 'httpMethod', label: $t('re.processor.grid.entity.httpMethod') },
{ name: 'httpUrl', label: $t('re.processor.grid.entity.httpUrl') },
{ name: 'httpAuthType', label: $t('re.processor.grid.entity.httpAuthType') },
{ name: 'httpAuthApikey', label: $t('re.processor.grid.entity.httpAuthApikey') },
{ name: 'httpAuthApiValue', label: $t('re.processor.grid.entity.httpAuthApiValue') },
{ name: 'httpAuthBasicUsername', label: $t('re.processor.grid.entity.httpAuthBasicUsername') },
{ name: 'httpAuthBasicPassword', label: $t('re.processor.grid.entity.httpAuthBasicPassword') },
{ name: 'httpAuthBearerToken', label: $t('re.processor.grid.entity.httpAuthBearerToken') },
{ name: 'httpRequestBody', label: $t('re.processor.grid.entity.httpRequestBody') },
{ name: 'httpResponseMapping', label: $t('re.processor.grid.entity.httpResponseMapping') },
];
}
public beforeEditorDataSubmit(args: any): void {}
public afterEditorOpen(args: any) {
args.grid.getEditorDialog().setWidth(this.EDITOR_DIALOG_WIDTH);
this.initAutoCompletionManager();
this.initUserDefinedFunctionsManager();
this.#editorForm = args.grid.getEditorForm();
EnumTools.fetch(['io.sc.engine.rule.core.enums.HttpMethodType', 'io.sc.engine.rule.core.enums.HttpAuthorizationType']).then((value) => {
this.#httpMethodTypeEnum = value.HttpMethodType;
this.#httpMethodTypeOptionsRef.value = Options.enum(this.#httpMethodTypeEnum);
this.#HttpAuthorizationTypeEnum = value.HttpAuthorizationType;
this.#httpAuthorizationTypeOptionsRef.value = Options.enum(this.#HttpAuthorizationTypeEnum);
});
}
}
export { HttpRequest };

409
io.sc.engine.rule.frontend/src/views/shared/processors/HttpRequest.ts

@ -1,15 +1,11 @@
import { ref, computed } from 'vue';
import { axios, Environment, $t, Tools, EnumTools, Options } from 'platform-core';
import { ref } from 'vue';
import { axios, $t, EnumTools, Options } from 'platform-core';
import { Processor } from '../Processor';
import { PlaceHolder } from '@/utils/PlaceHolder';
class HttpRequest extends Processor {
#editorForm: any;
#httpResponseBodyRef = ref(undefined);
#httpMethodTypeEnum: any;
#httpMethodTypeOptionsRef = ref(<any>[]);
#HttpAuthorizationTypeEnum: any;
#httpAuthorizationTypeOptionsRef = ref(<any>[]);
constructor(targetType: string, context?: any) {
super(targetType, context);
@ -40,419 +36,58 @@ class HttpRequest extends Processor {
public getEditorFields(): any {
return [
{
colSpan: 2,
colSpan: 3,
name: 'httpMethod',
label: $t('re.processor.grid.entity.httpMethod'),
label: $t('re.processor.httpRequest.entity.httpMethod'),
type: 'w-select',
options: this.#httpMethodTypeOptionsRef,
rows: 1,
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
},
{
colSpan: 2,
name: 'httpAuthType',
label: $t('re.processor.grid.entity.httpAuthType'),
type: 'w-select',
options: this.#httpAuthorizationTypeOptionsRef,
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
},
{
colSpan: 4,
name: 'httpAuthApikey',
label: $t('re.processor.grid.entity.httpAuthApikey'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'API_KEY';
},
},
{
colSpan: 4,
name: 'httpAuthApiValue',
label: $t('re.processor.grid.entity.httpAuthApiValue'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'API_KEY';
},
},
{
colSpan: 4,
name: 'httpAuthBasicUsername',
label: $t('re.processor.grid.entity.httpAuthBasicUsername'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'BASIC_AUTH';
},
},
{
colSpan: 4,
name: 'httpAuthBasicPassword',
label: $t('re.processor.grid.entity.httpAuthBasicPassword'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'BASIC_AUTH';
},
},
{
colSpan: 8,
name: 'httpAuthBearerToken',
label: $t('re.processor.grid.entity.httpAuthBearerToken'),
type: 'w-text',
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE && args.form.getFieldValue('httpAuthType') === 'BEARER';
},
},
{
colSpan: 6,
firstCol: true,
colSpan: 9,
name: 'httpUrl',
label: $t('re.processor.grid.entity.httpUrl'),
type: 'w-code-mirror',
lang: 'javascript',
rows: 7,
toolbar: false,
placeholder: true,
lineWrap: true,
lineBreak: true,
lineHeight: '1.3rem',
fontSize: '0.75rem',
autoCompletion: this.autoCompletionManager.autoCompletion(),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
},
{
colSpan: 6,
name: 'urlParameterValues',
label: $t('re.processor.grid.entity.sqlParameterValues'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-grid',
height: 110,
title: $t('re.processor.grid.entity.sqlParameterValues'),
localMode: true,
autoFetchData: false,
dense: true,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
const sql = this.#editorForm.getFieldValue('httpUrl');
const regex = /\$\{[\u0000-\uFFFF]+?\}/g;
const array: any[] = sql.match(regex);
const rows: any[] = [];
array.forEach((item) => {
rows.push({ name: item, value: '' });
});
const grid = this.#editorForm.getFieldComponent('urlParameterValues');
grid.setLocalData(rows);
},
},
'separator',
'add',
'edit',
[
{
extend: 'remove',
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('urlParameterValues');
grid.removeRows(args.selecteds);
},
},
{
extend: 'remove',
name: 'removeAll',
label: $t('deleteAll'),
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('urlParameterValues');
grid.setLocalData([]);
},
},
],
],
columns: [
{
width: '50%',
name: 'name',
label: $t('name'),
align: 'left',
sortable: false,
format: (value: any) => {
return PlaceHolder.replace(value);
},
},
{
width: '100%',
name: 'value',
label: $t('value'),
sortable: false,
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'name',
label: $t('name'),
type: 'w-code-mirror',
toolbar: false,
lang: 'java',
rows: 1,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
},
{
name: 'value',
label: $t('value'),
label: $t('re.processor.httpRequest.entity.httpUrl'),
type: 'w-text',
},
],
},
},
},
{
colSpan: 6,
name: 'httpRequestBody',
label: $t('re.processor.grid.entity.httpRequestBody'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-code-mirror',
rows: 7,
toolbar: false,
lineNumber: false,
lang: 'json',
lineWrap: false,
lineBreak: true,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
userDefinedFunctions: this.userDefinedFunctionsManager.userDefinedFunctions(),
},
{
colSpan: 6,
name: 'bodyParameterValues',
label: $t('re.processor.grid.entity.sqlParameterValues'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-grid',
height: 110,
title: $t('re.processor.grid.entity.sqlParameterValues'),
localMode: true,
autoFetchData: false,
dense: true,
dbClickOperation: 'edit',
dndMode: 'local',
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'send',
label: $t('send'),
icon: 'bi-send',
click: (args: any) => {
const httpMethod = this.#editorForm.getFieldValue('httpMethod');
const httpUrl = this.#editorForm.getFieldValue('httpUrl');
const httpAuthType = this.#editorForm.getFieldValue('httpAuthType');
const httpAuthApikey = this.#editorForm.getFieldValue('httpAuthApikey');
const httpAuthApiValue = this.#editorForm.getFieldValue('httpAuthApiValue');
const httpAuthBasicUsername = this.#editorForm.getFieldValue('httpAuthBasicUsername');
const httpAuthBasicPassword = this.#editorForm.getFieldValue('httpAuthBasicPassword');
const httpAuthBearerToken = this.#editorForm.getFieldValue('httpAuthBearerToken');
const httpRequestBody = this.#editorForm.getFieldValue('httpRequestBody');
axios
.post(Environment.apiContextPath('/api/re/indicator/processor/sendWebRequest'), {
httpMethod,
httpUrl,
httpAuthType,
httpAuthApikey,
httpAuthApiValue,
httpAuthBasicUsername,
httpAuthBasicPassword,
httpAuthBearerToken,
httpRequestBody,
})
.then((response) => {
const result = response.data;
if (result.successful) {
this.#httpResponseBodyRef.value = result.content;
} else {
this.#httpResponseBodyRef.value = result.status + ',' + result.error;
}
});
},
},
'separator',
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (args: any) => {
const sql = this.#editorForm.getFieldValue('httpRequestBody');
const regex = /\$\{[\u0000-\uFFFF]+?\}/g;
const array: any[] = sql.match(regex);
const rows: any[] = [];
array.forEach((item) => {
rows.push({ name: item, value: '' });
});
const grid = this.#editorForm.getFieldComponent('bodyParameterValues');
grid.setLocalData(rows);
},
},
'separator',
'add',
'edit',
[
{
extend: 'remove',
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('bodyParameterValues');
grid.removeRows(args.selecteds);
},
},
{
extend: 'remove',
name: 'removeAll',
label: $t('deleteAll'),
click: (args: any) => {
const grid = args.grid.getEditorForm().getFieldComponent('bodyParameterValues');
grid.setLocalData([]);
},
},
],
],
columns: [
{
width: '50%',
name: 'name',
label: $t('name'),
align: 'left',
sortable: false,
format: (value: any) => {
return PlaceHolder.replace(value);
},
},
{
width: '100%',
name: 'value',
label: $t('value'),
sortable: false,
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'name',
label: $t('name'),
type: 'w-code-mirror',
toolbar: false,
lang: 'java',
rows: 1,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
},
{
name: 'value',
label: $t('value'),
type: 'w-text',
},
],
},
},
},
{
colSpan: 12,
name: 'httpResponseBody',
label: $t('re.processor.grid.entity.httpResponseBody'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-code-mirror',
lang: 'json',
rows: 4,
lineHeight: '1.3rem',
fontSize: '0.75rem',
toolbar: false,
lineNumber: false,
lineWrap: false,
lineBreak: true,
modelValue: this.#httpResponseBodyRef.value,
},
{
colSpan: 12,
name: 'httpResponseMapping',
label: $t('re.processor.grid.entity.httpResponseMapping'),
showIf: (args: any) => {
return args.form.getFieldValue('type') === this.PROCESSOR_TYPE;
},
type: 'w-code-mirror',
rows: 5,
toolbar: false,
lineNumber: false,
lineHeight: '1.3rem',
fontSize: '0.75rem',
lang: 'java',
lineWrap: false,
lineBreak: true,
placeholder: true,
autoCompletion: this.autoCompletionManager.autoCompletion(),
userDefinedFunctions: this.userDefinedFunctionsManager.userDefinedFunctions(),
defaultValue:
'if(${response}.getSuccessful()){\n\t//def object =new groovy.xml.XmlParser().parse(${response}.getContent());\n\tdef object = new groovy.json.JsonSlurper().parseText(${response}.getContent());\n}',
},
];
}
public getViewerFields(): any {
return [
{ name: 'httpMethod', label: $t('re.processor.grid.entity.httpMethod') },
{ name: 'httpMethod', label: $t('re.processor.httpRequest.entity.httpMethod') },
{ name: 'httpUrl', label: $t('re.processor.grid.entity.httpUrl') },
{ name: 'httpAuthType', label: $t('re.processor.grid.entity.httpAuthType') },
{ name: 'httpAuthApikey', label: $t('re.processor.grid.entity.httpAuthApikey') },
{ name: 'httpAuthApiValue', label: $t('re.processor.grid.entity.httpAuthApiValue') },
{ name: 'httpAuthBasicUsername', label: $t('re.processor.grid.entity.httpAuthBasicUsername') },
{ name: 'httpAuthBasicPassword', label: $t('re.processor.grid.entity.httpAuthBasicPassword') },
{ name: 'httpAuthBearerToken', label: $t('re.processor.grid.entity.httpAuthBearerToken') },
{ name: 'httpRequestBody', label: $t('re.processor.grid.entity.httpRequestBody') },
{ name: 'httpResponseMapping', label: $t('re.processor.grid.entity.httpResponseMapping') },
{ name: 'httpUrlParameterValues', label: $t('re.processor.httpRequest.entity.httpUrlParameterValues') },
{ name: 'httpAuthType', label: $t('re.processor.httpRequest.entity.httpAuthType') },
{ name: 'httpAuthBasicUsername', label: $t('re.processor.httpRequest.entity.httpAuthBasicUsername') },
{ name: 'httpAuthBasicPassword', label: $t('re.processor.httpRequest.entity.httpAuthBasicPassword') },
{ name: 'httpAuthBearerToken', label: $t('re.processor.httpRequest.entity.httpAuthBearerToken') },
{ name: 'httpAuthParameterValues', label: $t('re.processor.httpRequest.entity.httpAuthParameterValues') },
{ name: 'httpRequestHeader', label: $t('re.processor.httpRequest.entity.httpRequestHeader') },
{ name: 'httpRequestHeaderParameterValues', label: $t('re.processor.httpRequest.entity.httpRequestHeaderParameterValues') },
{ name: 'httpRequestBody', label: $t('re.processor.httpRequest.entity.httpRequestBody') },
{ name: 'httpRequestBodyParameterValues', label: $t('re.processor.httpRequest.entity.httpRequestBodyParameterValues') },
{ name: 'httpConnectTimeout', label: $t('re.processor.httpRequest.entity.httpConnectTimeout') },
{ name: 'httpRetryCountOnFailure', label: $t('re.processor.httpRequest.entity.httpRetryCountOnFailure') },
{ name: 'httpAsync', label: $t('re.processor.httpRequest.entity.httpAsync') },
{ name: 'httpCache', label: $t('re.processor.httpRequest.entity.httpCache') },
{ name: 'httpResponseMapping', label: $t('re.processor.httpRequest.entity.httpResponseMapping') },
];
}
public beforeEditorDataSubmit(args: any): void {}
public afterEditorOpen(args: any) {
args.grid.getEditorDialog().setWidth(this.EDITOR_DIALOG_WIDTH);
this.initAutoCompletionManager();
this.initUserDefinedFunctionsManager();
this.#editorForm = args.grid.getEditorForm();
EnumTools.fetch(['io.sc.engine.rule.core.enums.HttpMethodType', 'io.sc.engine.rule.core.enums.HttpAuthorizationType']).then((value) => {
this.#httpMethodTypeEnum = value.HttpMethodType;
this.#httpMethodTypeOptionsRef.value = Options.enum(this.#httpMethodTypeEnum);
this.#HttpAuthorizationTypeEnum = value.HttpAuthorizationType;
this.#httpAuthorizationTypeOptionsRef.value = Options.enum(this.#HttpAuthorizationTypeEnum);
});
}
}

5
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/entity/DictionaryEntity.java

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.sc.engine.rule.core.enums.DeployStatus;
import io.sc.engine.rule.core.enums.DictionaryType;
import io.sc.engine.rule.server.dictionary.vo.DictionaryVo;
import io.sc.platform.core.Environment;
import io.sc.platform.core.util.PinyinUtil;
import io.sc.platform.orm.DeepClone;
import io.sc.platform.orm.IdClearable;
@ -55,8 +56,8 @@ public class DictionaryEntity extends CorporationAuditorEntity<DictionaryVo> imp
protected String name;
//名称(字母)
@Column(name="NAMEC_", length=1024)
@Size(max=1024)
@Column(name="NAMEC_", length= Environment.PIN_YIN_MAX_LENGTH)
@Size(max=Environment.PIN_YIN_MAX_LENGTH)
protected String namec;
//描述

5
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/entity/UserDefinedJavaClassFieldEntity.java

@ -5,6 +5,7 @@ import io.sc.engine.rule.core.util.ExpressionReplacer;
import io.sc.engine.rule.server.common.CodeAndNameReplacer;
import io.sc.engine.rule.server.common.service.support.ParameterAndValueType;
import io.sc.engine.rule.server.dictionary.vo.UserDefinedJavaClassFieldVo;
import io.sc.platform.core.Environment;
import io.sc.platform.core.util.PinyinUtil;
import io.sc.platform.orm.DeepClone;
import io.sc.platform.orm.IdClearable;
@ -43,8 +44,8 @@ public class UserDefinedJavaClassFieldEntity extends CorporationAuditorEntity<Us
protected String name;
//名称(字母)
@Column(name="NAMEC_", length=1024)
@Size(max=1024)
@Column(name="NAMEC_", length= Environment.PIN_YIN_MAX_LENGTH)
@Size(max=Environment.PIN_YIN_MAX_LENGTH)
protected String namec;
//描述

3
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/function/entity/FunctionEntity.java

@ -46,8 +46,7 @@ public class FunctionEntity extends CorporationAuditorEntity<FunctionVo> impleme
private String signature;
//math xml
@Column(name="MATH_XML_", length=255)
@Size(max=255)
@Column(name="MATH_XML_")
private String mathXml;
// 函数体

26
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/converter/IndicatorProcessorEntityConverter.java

@ -83,15 +83,20 @@ public class IndicatorProcessorEntityConverter {
HttpRequestIndicatorProcessor _po =new HttpRequestIndicatorProcessor();
_po.setHttpMethod(_entity.getHttpMethod());
_po.setHttpUrl(_entity.getHttpUrl());
_po.setHttpUrlParameterValues(_entity.getHttpUrlParameterValues());
_po.setHttpAuthType(_entity.getHttpAuthType());
_po.setHttpAuthApikey(_entity.getHttpAuthApikey());
_po.setHttpAuthApiValue(_entity.getHttpAuthApiValue());
_po.setHttpAuthApiAddTo(_entity.getHttpAuthApiAddTo());
_po.setHttpAuthBasicUsername(_entity.getHttpAuthBasicUsername());
_po.setHttpAuthBasicPassword(_entity.getHttpAuthBasicPassword());
_po.setHttpAuthBearerToken(_entity.getHttpAuthBearerToken());
_po.setHttpParams(_entity.getHttpParams());
_po.setHttpAuthParameterValues(_entity.getHttpAuthParameterValues());
_po.setHttpRequestHeader(_entity.getHttpRequestHeader());
_po.setHttpRequestHeaderParameterValues(_entity.getHttpRequestHeaderParameterValues());
_po.setHttpRequestBody(_entity.getHttpRequestBody());
_po.setHttpRequestBodyParameterValues(_entity.getHttpRequestBodyParameterValues());
_po.setHttpConnectTimeout(_entity.getHttpConnectTimeout());
_po.setHttpRetryCountOnFailure(_entity.getHttpRetryCountOnFailure());
_po.setHttpAsync(_entity.isHttpAsync());
_po.setHttpCache(_entity.isHttpCache());
_po.setHttpResponseMapping(_entity.getHttpResponseMapping());
po =_po;
}else {
@ -191,15 +196,20 @@ public class IndicatorProcessorEntityConverter {
HttpRequestIndicatorProcessorEntity _entity =new HttpRequestIndicatorProcessorEntity();
_entity.setHttpMethod(_po.getHttpMethod());
_entity.setHttpUrl(_po.getHttpUrl());
_entity.setHttpUrlParameterValues(_po.getHttpUrlParameterValues());
_entity.setHttpAuthType(_po.getHttpAuthType());
_entity.setHttpAuthApikey(_po.getHttpAuthApikey());
_entity.setHttpAuthApiValue(_po.getHttpAuthApiValue());
_entity.setHttpAuthApiAddTo(_po.getHttpAuthApiAddTo());
_entity.setHttpAuthBasicUsername(_po.getHttpAuthBasicUsername());
_entity.setHttpAuthBasicPassword(_po.getHttpAuthBasicPassword());
_entity.setHttpAuthBearerToken(_po.getHttpAuthBearerToken());
_entity.setHttpParams(_po.getHttpParams());
_entity.setHttpAuthParameterValues(_po.getHttpAuthParameterValues());
_entity.setHttpRequestHeader(_po.getHttpRequestHeader());
_entity.setHttpRequestHeaderParameterValues(_po.getHttpRequestHeaderParameterValues());
_entity.setHttpRequestBody(_po.getHttpRequestBody());
_entity.setHttpRequestBodyParameterValues(_po.getHttpRequestBodyParameterValues());
_entity.setHttpConnectTimeout(_po.getHttpConnectTimeout());
_entity.setHttpRetryCountOnFailure(_po.getHttpRetryCountOnFailure());
_entity.setHttpAsync(_po.isHttpAsync());
_entity.setHttpCache(_po.isHttpCache());
_entity.setHttpResponseMapping(_po.getHttpResponseMapping());
entity =_entity;
}else {

5
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/entity/LibEntity.java

@ -6,6 +6,7 @@ import io.sc.engine.rule.core.enums.DeployStatus;
import io.sc.engine.rule.core.enums.LibType;
import io.sc.engine.rule.server.lib.vo.LibVo;
import io.sc.engine.rule.server.testcase.entity.LibTestCaseEntity;
import io.sc.platform.core.Environment;
import io.sc.platform.core.util.PinyinUtil;
import io.sc.platform.orm.DeepClone;
import io.sc.platform.orm.IdClearable;
@ -55,8 +56,8 @@ public class LibEntity extends CorporationAuditorEntity<LibVo> implements DeepCl
protected String name;
//名称(字母)
@Column(name="NAMEC_", length=1024)
@Size(max=1024)
@Column(name="NAMEC_", length=Environment.PIN_YIN_MAX_LENGTH)
@Size(max=Environment.PIN_YIN_MAX_LENGTH)
protected String namec;
//描述

282
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/entity/processor/HttpRequestIndicatorProcessorEntity.java

@ -8,6 +8,7 @@ import io.sc.engine.rule.core.enums.ReplaceMode;
import io.sc.engine.rule.server.common.service.support.ParameterAndValueType;
import io.sc.engine.rule.server.lib.entity.IndicatorProcessorEntity;
import io.sc.engine.rule.server.lib.vo.processor.HttpRequestIndicatorProcessorVo;
import io.sc.platform.orm.converter.NumericBooleanConverter;
import javax.persistence.*;
@ -18,47 +19,75 @@ import javax.persistence.*;
@DiscriminatorValue("HTTP_REQUEST")
@JsonTypeName("HTTP_REQUEST")
public class HttpRequestIndicatorProcessorEntity extends IndicatorProcessorEntity {
// Method
// HTTP Method
@Column(name="HTTP_METHOD_")
@Enumerated(EnumType.STRING)
private HttpMethodType httpMethod;
// Url
// URL
@Column(name="HTTP_URL_")
private String httpUrl;
// URL 中参数的测试值
@Column(name="HTTP_URL_PARAMETER_VALUES_")
private String httpUrlParameterValues;
// 认证类型
@Column(name="HTTP_AUTH_TYPE_")
@Enumerated(EnumType.STRING)
private HttpAuthorizationType httpAuthType;
// Api Key's key
@Column(name="HTTP_AUTH_API_KEY_")
private String httpAuthApikey;
// Api Key's value
@Column(name="HTTP_AUTH_API_VALUE_")
private String httpAuthApiValue;
// Api Key's value
@Column(name="HTTP_AUTH_API_ADDTO_")
private String httpAuthApiAddTo;
// Basic 认证的用户名
@Column(name="HTTP_AUTH_BASIC_USERNAME_")
private String httpAuthBasicUsername;
// Basic 认证的用户密码
@Column(name="HTTP_AUTH_BASIC_PASSWORD_")
private String httpAuthBasicPassword;
// BearerToken
@Column(name="HTTP_AUTH_BEARER_TOKEN_")
private String httpAuthBearerToken;
@Column(name="HTTP_PARAMS_")
private String httpParams;
// 认证中参数的测试值
@Column(name="HTTP_AUTH_PARAMETER_VALUES_")
private String httpAuthParameterValues;
@Column(name="HTTP_REQUEST_BODY_")
// 请求头
@Column(name="HTTP_HEADER_")
private String httpRequestHeader;
// 请求头中参数的测试值
@Column(name="HTTP_HEADER_PARAMETER_VALUES_")
private String httpRequestHeaderParameterValues;
// 请求 body
@Column(name="HTTP_BODY_")
private String httpRequestBody;
// 请求 body 中参数的测试值
@Column(name="HTTP_BODY_PARAMETER_VALUES_")
private String httpRequestBodyParameterValues;
// 连接超时毫秒数
@Column(name="HTTP_CONN_TIMEOUT_")
private int httpConnectTimeout;
// 失败重试次数
@Column(name="HTTP_RETRY_COUNT_")
private int httpRetryCountOnFailure;
// 是否异步执行
@Column(name="HTTP_IS_ASYNC_")
@Convert(converter= NumericBooleanConverter.class)
private boolean httpAsync;
// 是否缓存
@Column(name="HTTP_IS_CACHE_")
@Convert(converter= NumericBooleanConverter.class)
private boolean httpCache;
// 响应
@Column(name="HTTP_RESPONSE_MAPPING_")
private String httpResponseMapping;
@ -67,114 +96,257 @@ public class HttpRequestIndicatorProcessorEntity extends IndicatorProcessorEntit
public HttpRequestIndicatorProcessorVo toVo() {
HttpRequestIndicatorProcessorVo vo =new HttpRequestIndicatorProcessorVo();
super.toVo(vo);
vo.setType(this.getType());
vo.setHttpMethod(this.getHttpMethod());
vo.setHttpUrl(this.getHttpUrl());
vo.setHttpAuthType(this.getHttpAuthType());
vo.setHttpAuthApikey(this.getHttpAuthApikey());
vo.setHttpAuthApiValue(this.getHttpAuthApiValue());
vo.setHttpAuthApiAddTo(this.getHttpAuthApiAddTo());
vo.setHttpAuthBasicUsername(this.getHttpAuthBasicUsername());
vo.setHttpAuthBasicPassword(this.getHttpAuthBasicPassword());
vo.setHttpAuthBearerToken(this.getHttpAuthBearerToken());
vo.setHttpParams(this.getHttpParams());
vo.setHttpRequestBody(this.getHttpRequestBody());
vo.setHttpResponseMapping(this.getHttpResponseMapping());
vo.setHttpMethod(httpMethod);
vo.setHttpUrl(httpUrl);
vo.setHttpUrlParameterValues(httpUrlParameterValues);
vo.setHttpAuthType(httpAuthType);
vo.setHttpAuthBasicUsername(httpAuthBasicUsername);
vo.setHttpAuthBasicPassword(httpAuthBasicPassword);
vo.setHttpAuthBearerToken(httpAuthBearerToken);
vo.setHttpAuthParameterValues(httpAuthParameterValues);
vo.setHttpRequestHeader(httpRequestHeader);
vo.setHttpRequestHeaderParameterValues(httpRequestHeaderParameterValues);
vo.setHttpRequestBody(httpRequestBody);
vo.setHttpRequestBodyParameterValues(httpRequestBodyParameterValues);
vo.setHttpConnectTimeout(httpConnectTimeout);
vo.setHttpRetryCountOnFailure(httpRetryCountOnFailure);
vo.setHttpAsync(httpAsync);
vo.setHttpCache(httpCache);
vo.setHttpResponseMapping(httpResponseMapping);
return vo;
}
@Override
public ProcessorType getType() {
return ProcessorType.HTTP_REQUEST;
}
public HttpMethodType getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(HttpMethodType httpMethod) {
this.httpMethod = httpMethod;
}
public String getHttpUrl() {
return httpUrl;
}
public void setHttpUrl(String httpUrl) {
this.httpUrl = httpUrl;
}
public String getHttpUrlParameterValues() {
return httpUrlParameterValues;
}
public void setHttpUrlParameterValues(String httpUrlParameterValues) {
this.httpUrlParameterValues = httpUrlParameterValues;
}
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthApikey() {
return httpAuthApikey;
}
public void setHttpAuthApikey(String httpAuthApikey) {
this.httpAuthApikey = httpAuthApikey;
}
public String getHttpAuthApiValue() {
return httpAuthApiValue;
}
public void setHttpAuthApiValue(String httpAuthApiValue) {
this.httpAuthApiValue = httpAuthApiValue;
}
public String getHttpAuthApiAddTo() {
return httpAuthApiAddTo;
}
public void setHttpAuthApiAddTo(String httpAuthApiAddTo) {
this.httpAuthApiAddTo = httpAuthApiAddTo;
}
public String getHttpAuthBasicUsername() {
return httpAuthBasicUsername;
}
public void setHttpAuthBasicUsername(String httpAuthBasicUsername) {
this.httpAuthBasicUsername = httpAuthBasicUsername;
}
public String getHttpAuthBasicPassword() {
return httpAuthBasicPassword;
}
public void setHttpAuthBasicPassword(String httpAuthBasicPassword) {
this.httpAuthBasicPassword = httpAuthBasicPassword;
}
public String getHttpAuthBearerToken() {
return httpAuthBearerToken;
}
public void setHttpAuthBearerToken(String httpAuthBearerToken) {
this.httpAuthBearerToken = httpAuthBearerToken;
}
public String getHttpParams() {
return httpParams;
public String getHttpAuthParameterValues() {
return httpAuthParameterValues;
}
public void setHttpAuthParameterValues(String httpAuthParameterValues) {
this.httpAuthParameterValues = httpAuthParameterValues;
}
public String getHttpRequestHeader() {
return httpRequestHeader;
}
public void setHttpRequestHeader(String httpRequestHeader) {
this.httpRequestHeader = httpRequestHeader;
}
public String getHttpRequestHeaderParameterValues() {
return httpRequestHeaderParameterValues;
}
public void setHttpParams(String httpParams) {
this.httpParams = httpParams;
public void setHttpRequestHeaderParameterValues(String httpRequestHeaderParameterValues) {
this.httpRequestHeaderParameterValues = httpRequestHeaderParameterValues;
}
public String getHttpRequestBody() {
return httpRequestBody;
}
public void setHttpRequestBody(String httpRequestBody) {
this.httpRequestBody = httpRequestBody;
}
public String getHttpRequestBodyParameterValues() {
return httpRequestBodyParameterValues;
}
public void setHttpRequestBodyParameterValues(String httpRequestBodyParameterValues) {
this.httpRequestBodyParameterValues = httpRequestBodyParameterValues;
}
public int getHttpConnectTimeout() {
return httpConnectTimeout;
}
public void setHttpConnectTimeout(int httpConnectTimeout) {
this.httpConnectTimeout = httpConnectTimeout;
}
public int getHttpRetryCountOnFailure() {
return httpRetryCountOnFailure;
}
public void setHttpRetryCountOnFailure(int httpRetryCountOnFailure) {
this.httpRetryCountOnFailure = httpRetryCountOnFailure;
}
public boolean isHttpAsync() {
return httpAsync;
}
public void setHttpAsync(boolean httpAsync) {
this.httpAsync = httpAsync;
}
public boolean isHttpCache() {
return httpCache;
}
public void setHttpCache(boolean httpCache) {
this.httpCache = httpCache;
}
public String getHttpResponseMapping() {
return httpResponseMapping;
}
public void setHttpResponseMapping(String httpResponseMapping) {
this.httpResponseMapping = httpResponseMapping;
}
@Override
public boolean replace(ParameterAndValueType parameterAndValueType, ReplaceMode mode) {
String replaced =parameterAndValueType.replace(this.httpParams, mode);
// httpUrl
String replaced =parameterAndValueType.replace(this.httpUrl, mode);
replaced =(replaced==null?"":replaced);
boolean result =false;
if(!replaced.equals(this.httpParams)) {
if(!replaced.equals(this.httpUrl)) {
result =true;
}
this.httpUrl =replaced;
// httpUrlParameterValues
replaced =parameterAndValueType.replace(this.httpUrlParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpUrlParameterValues)) {
result =true;
}
this.httpUrlParameterValues =replaced;
// httpAuthBasicUsername;
replaced =parameterAndValueType.replace(this.httpAuthBasicUsername, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpAuthBasicUsername)) {
result =true;
}
this.httpAuthBasicUsername =replaced;
// httpAuthBasicPassword;
replaced =parameterAndValueType.replace(this.httpAuthBasicPassword, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpAuthBasicPassword)) {
result =true;
}
this.httpAuthBasicPassword =replaced;
// BearerToken
replaced =parameterAndValueType.replace(this.httpAuthBearerToken, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpAuthBearerToken)) {
result =true;
}
this.httpAuthBearerToken =replaced;
// httpAuthParameterValues
replaced =parameterAndValueType.replace(this.httpAuthParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpAuthParameterValues)) {
result =true;
}
this.httpAuthParameterValues =replaced;
// httpRequestHeader
replaced =parameterAndValueType.replace(this.httpRequestHeader, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestHeader)) {
result =true;
}
this.httpParams =replaced;
this.httpRequestHeader =replaced;
// httpRequestHeaderParameterValues
replaced =parameterAndValueType.replace(this.httpRequestHeaderParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestHeaderParameterValues)) {
result =true;
}
this.httpRequestHeaderParameterValues =replaced;
// httpRequestBody
replaced =parameterAndValueType.replace(this.httpRequestBody, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestBody)) {
result =true;
}
this.httpRequestBody =replaced;
// httpRequestBodyParameterValues
replaced =parameterAndValueType.replace(this.httpRequestBodyParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestBodyParameterValues)) {
result =true;
}
this.httpRequestBodyParameterValues =replaced;
// httpResponseMapping
replaced =parameterAndValueType.replace(this.httpResponseMapping, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpResponseMapping)) {
result =true;
}
this.httpResponseMapping =replaced;
return result;
}
}

154
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/vo/processor/HttpRequestIndicatorProcessorVo.java

@ -9,109 +9,161 @@ import io.sc.engine.rule.server.lib.vo.IndicatorProcessorVo;
* 指标处理器Http请求操作Vo
*/
public class HttpRequestIndicatorProcessorVo extends IndicatorProcessorVo {
// Method
private HttpMethodType httpMethod;
// Url
private String httpUrl;
// 认证类型
private HttpAuthorizationType httpAuthType;
// Api Key's key
private String httpAuthApikey;
// Api Key's value
private String httpAuthApiValue;
// Api Key's value
private String httpAuthApiAddTo;
private String httpAuthBasicUsername;
private String httpAuthBasicPassword;
private String httpAuthBearerToken;
private String httpParams;
private String httpRequestBody;
private String httpResponseMapping;
private HttpMethodType httpMethod; // HTTP Method
private String httpUrl; // URL
private String httpUrlParameterValues; // URL 中参数的测试值
private HttpAuthorizationType httpAuthType; // 认证类型
private String httpAuthBasicUsername; // Basic 认证的用户名
private String httpAuthBasicPassword; // Basic 认证的用户密码
private String httpAuthBearerToken; // BearerToken
private String httpAuthParameterValues; // 认证中参数的测试值
private String httpRequestHeader; // 请求头
private String httpRequestHeaderParameterValues; // 请求头中参数的测试值
private String httpRequestBody; // 请求 body
private String httpRequestBodyParameterValues; // 请求 body 中参数的测试值
private int httpConnectTimeout; // 连接超时毫秒数
private int httpRetryCountOnFailure; // 失败重试次数
private boolean httpAsync; // 是否异步执行
private boolean httpCache; // 是否缓存
private String httpResponseMapping; // 响应
@Override
public ProcessorType getType() {
return ProcessorType.HTTP_REQUEST;
}
public HttpMethodType getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(HttpMethodType httpMethod) {
this.httpMethod = httpMethod;
}
public String getHttpUrl() {
return httpUrl;
}
public void setHttpUrl(String httpUrl) {
this.httpUrl = httpUrl;
}
public String getHttpUrlParameterValues() {
return httpUrlParameterValues;
}
public void setHttpUrlParameterValues(String httpUrlParameterValues) {
this.httpUrlParameterValues = httpUrlParameterValues;
}
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthApikey() {
return httpAuthApikey;
}
public void setHttpAuthApikey(String httpAuthApikey) {
this.httpAuthApikey = httpAuthApikey;
}
public String getHttpAuthApiValue() {
return httpAuthApiValue;
}
public void setHttpAuthApiValue(String httpAuthApiValue) {
this.httpAuthApiValue = httpAuthApiValue;
}
public String getHttpAuthApiAddTo() {
return httpAuthApiAddTo;
}
public void setHttpAuthApiAddTo(String httpAuthApiAddTo) {
this.httpAuthApiAddTo = httpAuthApiAddTo;
}
public String getHttpAuthBasicUsername() {
return httpAuthBasicUsername;
}
public void setHttpAuthBasicUsername(String httpAuthBasicUsername) {
this.httpAuthBasicUsername = httpAuthBasicUsername;
}
public String getHttpAuthBasicPassword() {
return httpAuthBasicPassword;
}
public void setHttpAuthBasicPassword(String httpAuthBasicPassword) {
this.httpAuthBasicPassword = httpAuthBasicPassword;
}
public String getHttpAuthBearerToken() {
return httpAuthBearerToken;
}
public void setHttpAuthBearerToken(String httpAuthBearerToken) {
this.httpAuthBearerToken = httpAuthBearerToken;
}
public String getHttpParams() {
return httpParams;
public String getHttpAuthParameterValues() {
return httpAuthParameterValues;
}
public void setHttpParams(String httpParams) {
this.httpParams = httpParams;
public void setHttpAuthParameterValues(String httpAuthParameterValues) {
this.httpAuthParameterValues = httpAuthParameterValues;
}
public String getHttpRequestHeader() {
return httpRequestHeader;
}
public void setHttpRequestHeader(String httpRequestHeader) {
this.httpRequestHeader = httpRequestHeader;
}
public String getHttpRequestHeaderParameterValues() {
return httpRequestHeaderParameterValues;
}
public void setHttpRequestHeaderParameterValues(String httpRequestHeaderParameterValues) {
this.httpRequestHeaderParameterValues = httpRequestHeaderParameterValues;
}
public String getHttpRequestBody() {
return httpRequestBody;
}
public void setHttpRequestBody(String httpRequestBody) {
this.httpRequestBody = httpRequestBody;
}
public String getHttpRequestBodyParameterValues() {
return httpRequestBodyParameterValues;
}
public void setHttpRequestBodyParameterValues(String httpRequestBodyParameterValues) {
this.httpRequestBodyParameterValues = httpRequestBodyParameterValues;
}
public int getHttpConnectTimeout() {
return httpConnectTimeout;
}
public void setHttpConnectTimeout(int httpConnectTimeout) {
this.httpConnectTimeout = httpConnectTimeout;
}
public int getHttpRetryCountOnFailure() {
return httpRetryCountOnFailure;
}
public void setHttpRetryCountOnFailure(int httpRetryCountOnFailure) {
this.httpRetryCountOnFailure = httpRetryCountOnFailure;
}
public boolean isHttpAsync() {
return httpAsync;
}
public void setHttpAsync(boolean httpAsync) {
this.httpAsync = httpAsync;
}
public boolean isHttpCache() {
return httpCache;
}
public void setHttpCache(boolean httpCache) {
this.httpCache = httpCache;
}
public String getHttpResponseMapping() {
return httpResponseMapping;
}
public void setHttpResponseMapping(String httpResponseMapping) {
this.httpResponseMapping = httpResponseMapping;
}

26
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/converter/ParameterProcessorEntityConverter.java

@ -60,15 +60,20 @@ public class ParameterProcessorEntityConverter {
HttpRequestParameterProcessor _po =new HttpRequestParameterProcessor();
_po.setHttpMethod(_entity.getHttpMethod());
_po.setHttpUrl(_entity.getHttpUrl());
_po.setHttpUrlParameterValues(_entity.getHttpUrlParameterValues());
_po.setHttpAuthType(_entity.getHttpAuthType());
_po.setHttpAuthApikey(_entity.getHttpAuthApikey());
_po.setHttpAuthApiValue(_entity.getHttpAuthApiValue());
_po.setHttpAuthApiAddTo(_entity.getHttpAuthApiAddTo());
_po.setHttpAuthBasicUsername(_entity.getHttpAuthBasicUsername());
_po.setHttpAuthBasicPassword(_entity.getHttpAuthBasicPassword());
_po.setHttpAuthBearerToken(_entity.getHttpAuthBearerToken());
_po.setHttpParams(_entity.getHttpParams());
_po.setHttpAuthParameterValues(_entity.getHttpAuthParameterValues());
_po.setHttpRequestHeader(_entity.getHttpRequestHeader());
_po.setHttpRequestHeaderParameterValues(_entity.getHttpRequestHeaderParameterValues());
_po.setHttpRequestBody(_entity.getHttpRequestBody());
_po.setHttpRequestBodyParameterValues(_entity.getHttpRequestBodyParameterValues());
_po.setHttpConnectTimeout(_entity.getHttpConnectTimeout());
_po.setHttpRetryCountOnFailure(_entity.getHttpRetryCountOnFailure());
_po.setHttpAsync(_entity.isHttpAsync());
_po.setHttpCache(_entity.isHttpCache());
_po.setHttpResponseMapping(_entity.getHttpResponseMapping());
po =_po;
}else if(entity instanceof MathFormulaParameterProcessorEntity) {
@ -213,15 +218,20 @@ public class ParameterProcessorEntityConverter {
HttpRequestParameterProcessorEntity _entity =new HttpRequestParameterProcessorEntity();
_entity.setHttpMethod(_po.getHttpMethod());
_entity.setHttpUrl(_po.getHttpUrl());
_entity.setHttpUrlParameterValues(_po.getHttpUrlParameterValues());
_entity.setHttpAuthType(_po.getHttpAuthType());
_entity.setHttpAuthApikey(_po.getHttpAuthApikey());
_entity.setHttpAuthApiValue(_po.getHttpAuthApiValue());
_entity.setHttpAuthApiAddTo(_po.getHttpAuthApiAddTo());
_entity.setHttpAuthBasicUsername(_po.getHttpAuthBasicUsername());
_entity.setHttpAuthBasicPassword(_po.getHttpAuthBasicPassword());
_entity.setHttpAuthBearerToken(_po.getHttpAuthBearerToken());
_entity.setHttpParams(_po.getHttpParams());
_entity.setHttpAuthParameterValues(_po.getHttpAuthParameterValues());
_entity.setHttpRequestHeader(_po.getHttpRequestHeader());
_entity.setHttpRequestHeaderParameterValues(_po.getHttpRequestHeaderParameterValues());
_entity.setHttpRequestBody(_po.getHttpRequestBody());
_entity.setHttpRequestBodyParameterValues(_po.getHttpRequestBodyParameterValues());
_entity.setHttpConnectTimeout(_po.getHttpConnectTimeout());
_entity.setHttpRetryCountOnFailure(_po.getHttpRetryCountOnFailure());
_entity.setHttpAsync(_po.isHttpAsync());
_entity.setHttpCache(_po.isHttpCache());
_entity.setHttpResponseMapping(_po.getHttpResponseMapping());
entity =_entity;
}else if(po instanceof MathFormulaParameterProcessor) {

280
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/entity/processor/HttpRequestParameterProcessorEntity.java

@ -8,6 +8,7 @@ import io.sc.engine.rule.core.enums.ReplaceMode;
import io.sc.engine.rule.server.common.service.support.ParameterAndValueType;
import io.sc.engine.rule.server.model.entity.ParameterProcessorEntity;
import io.sc.engine.rule.server.model.vo.processor.HttpRequestParameterProcessorVo;
import io.sc.platform.orm.converter.NumericBooleanConverter;
import javax.persistence.*;
@ -18,47 +19,75 @@ import javax.persistence.*;
@DiscriminatorValue("HTTP_REQUEST")
@JsonTypeName("HTTP_REQUEST")
public class HttpRequestParameterProcessorEntity extends ParameterProcessorEntity {
// Method
// HTTP Method
@Column(name="HTTP_METHOD_")
@Enumerated(EnumType.STRING)
private HttpMethodType httpMethod;
// Url
// URL
@Column(name="HTTP_URL_")
private String httpUrl;
// URL 中参数的测试值
@Column(name="HTTP_URL_PARAMETER_VALUES_")
private String httpUrlParameterValues;
// 认证类型
@Column(name="HTTP_AUTH_TYPE_")
@Enumerated(EnumType.STRING)
private HttpAuthorizationType httpAuthType;
// Api Key's key
@Column(name="HTTP_AUTH_API_KEY_")
private String httpAuthApikey;
// Api Key's value
@Column(name="HTTP_AUTH_API_VALUE_")
private String httpAuthApiValue;
// Api Key's value
@Column(name="HTTP_AUTH_API_ADDTO_")
private String httpAuthApiAddTo;
// Basic 认证的用户名
@Column(name="HTTP_AUTH_BASIC_USERNAME_")
private String httpAuthBasicUsername;
// Basic 认证的用户密码
@Column(name="HTTP_AUTH_BASIC_PASSWORD_")
private String httpAuthBasicPassword;
// BearerToken
@Column(name="HTTP_AUTH_BEARER_TOKEN_")
private String httpAuthBearerToken;
@Column(name="HTTP_PARAMS_")
private String httpParams;
// 认证中参数的测试值
@Column(name="HTTP_AUTH_PARAMETER_VALUES_")
private String httpAuthParameterValues;
@Column(name="HTTP_REQUEST_BODY_")
// 请求头
@Column(name="HTTP_HEADER_")
private String httpRequestHeader;
// 请求头中参数的测试值
@Column(name="HTTP_HEADER_PARAMETER_VALUES_")
private String httpRequestHeaderParameterValues;
// 请求 body
@Column(name="HTTP_BODY_")
private String httpRequestBody;
// 请求 body 中参数的测试值
@Column(name="HTTP_BODY_PARAMETER_VALUES_")
private String httpRequestBodyParameterValues;
// 连接超时毫秒数
@Column(name="HTTP_CONN_TIMEOUT_")
private int httpConnectTimeout;
// 失败重试次数
@Column(name="HTTP_RETRY_COUNT_")
private int httpRetryCountOnFailure;
// 是否异步执行
@Column(name="HTTP_IS_ASYNC_")
@Convert(converter= NumericBooleanConverter.class)
private boolean httpAsync;
// 是否缓存
@Column(name="HTTP_IS_CACHE_")
@Convert(converter= NumericBooleanConverter.class)
private boolean httpCache;
// 响应
@Column(name="HTTP_RESPONSE_MAPPING_")
private String httpResponseMapping;
@ -66,18 +95,23 @@ public class HttpRequestParameterProcessorEntity extends ParameterProcessorEntit
public HttpRequestParameterProcessorVo toVo() {
HttpRequestParameterProcessorVo vo =new HttpRequestParameterProcessorVo();
super.toVo(vo);
vo.setHttpMethod(this.getHttpMethod());
vo.setHttpUrl(this.getHttpUrl());
vo.setHttpAuthType(this.getHttpAuthType());
vo.setHttpAuthApikey(this.getHttpAuthApikey());
vo.setHttpAuthApiValue(this.getHttpAuthApiValue());
vo.setHttpAuthApiAddTo(this.getHttpAuthApiAddTo());
vo.setHttpAuthBasicUsername(this.getHttpAuthBasicUsername());
vo.setHttpAuthBasicPassword(this.getHttpAuthBasicPassword());
vo.setHttpAuthBearerToken(this.getHttpAuthBearerToken());
vo.setHttpParams(this.getHttpParams());
vo.setHttpRequestBody(this.getHttpRequestBody());
vo.setHttpResponseMapping(this.getHttpResponseMapping());
vo.setHttpMethod(httpMethod);
vo.setHttpUrl(httpUrl);
vo.setHttpUrlParameterValues(httpUrlParameterValues);
vo.setHttpAuthType(httpAuthType);
vo.setHttpAuthBasicUsername(httpAuthBasicUsername);
vo.setHttpAuthBasicPassword(httpAuthBasicPassword);
vo.setHttpAuthBearerToken(httpAuthBearerToken);
vo.setHttpAuthParameterValues(httpAuthParameterValues);
vo.setHttpRequestHeader(httpRequestHeader);
vo.setHttpRequestHeaderParameterValues(httpRequestHeaderParameterValues);
vo.setHttpRequestBody(httpRequestBody);
vo.setHttpRequestBodyParameterValues(httpRequestBodyParameterValues);
vo.setHttpConnectTimeout(httpConnectTimeout);
vo.setHttpRetryCountOnFailure(httpRetryCountOnFailure);
vo.setHttpAsync(httpAsync);
vo.setHttpCache(httpCache);
vo.setHttpResponseMapping(httpResponseMapping);
return vo;
}
@ -86,155 +120,233 @@ public class HttpRequestParameterProcessorEntity extends ParameterProcessorEntit
return ProcessorType.HTTP_REQUEST;
}
public HttpMethodType getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(HttpMethodType httpMethod) {
this.httpMethod = httpMethod;
}
public String getHttpUrl() {
return httpUrl;
}
public void setHttpUrl(String httpUrl) {
this.httpUrl = httpUrl;
}
public String getHttpUrlParameterValues() {
return httpUrlParameterValues;
}
public void setHttpUrlParameterValues(String httpUrlParameterValues) {
this.httpUrlParameterValues = httpUrlParameterValues;
}
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthApikey() {
return httpAuthApikey;
public String getHttpAuthBasicUsername() {
return httpAuthBasicUsername;
}
public void setHttpAuthApikey(String httpAuthApikey) {
this.httpAuthApikey = httpAuthApikey;
public void setHttpAuthBasicUsername(String httpAuthBasicUsername) {
this.httpAuthBasicUsername = httpAuthBasicUsername;
}
public String getHttpAuthApiValue() {
return httpAuthApiValue;
public String getHttpAuthBasicPassword() {
return httpAuthBasicPassword;
}
public void setHttpAuthApiValue(String httpAuthApiValue) {
this.httpAuthApiValue = httpAuthApiValue;
public void setHttpAuthBasicPassword(String httpAuthBasicPassword) {
this.httpAuthBasicPassword = httpAuthBasicPassword;
}
public String getHttpAuthApiAddTo() {
return httpAuthApiAddTo;
public String getHttpAuthBearerToken() {
return httpAuthBearerToken;
}
public void setHttpAuthApiAddTo(String httpAuthApiAddTo) {
this.httpAuthApiAddTo = httpAuthApiAddTo;
public void setHttpAuthBearerToken(String httpAuthBearerToken) {
this.httpAuthBearerToken = httpAuthBearerToken;
}
public String getHttpAuthBasicUsername() {
return httpAuthBasicUsername;
public String getHttpAuthParameterValues() {
return httpAuthParameterValues;
}
public void setHttpAuthParameterValues(String httpAuthParameterValues) {
this.httpAuthParameterValues = httpAuthParameterValues;
}
public void setHttpAuthBasicUsername(String httpAuthBasicUsername) {
this.httpAuthBasicUsername = httpAuthBasicUsername;
public String getHttpRequestHeader() {
return httpRequestHeader;
}
public void setHttpRequestHeader(String httpRequestHeader) {
this.httpRequestHeader = httpRequestHeader;
}
public String getHttpAuthBasicPassword() {
return httpAuthBasicPassword;
public String getHttpRequestHeaderParameterValues() {
return httpRequestHeaderParameterValues;
}
public void setHttpRequestHeaderParameterValues(String httpRequestHeaderParameterValues) {
this.httpRequestHeaderParameterValues = httpRequestHeaderParameterValues;
}
public void setHttpAuthBasicPassword(String httpAuthBasicPassword) {
this.httpAuthBasicPassword = httpAuthBasicPassword;
public String getHttpRequestBody() {
return httpRequestBody;
}
public void setHttpRequestBody(String httpRequestBody) {
this.httpRequestBody = httpRequestBody;
}
public String getHttpAuthBearerToken() {
return httpAuthBearerToken;
public String getHttpRequestBodyParameterValues() {
return httpRequestBodyParameterValues;
}
public void setHttpRequestBodyParameterValues(String httpRequestBodyParameterValues) {
this.httpRequestBodyParameterValues = httpRequestBodyParameterValues;
}
public void setHttpAuthBearerToken(String httpAuthBearerToken) {
this.httpAuthBearerToken = httpAuthBearerToken;
public int getHttpConnectTimeout() {
return httpConnectTimeout;
}
public void setHttpConnectTimeout(int httpConnectTimeout) {
this.httpConnectTimeout = httpConnectTimeout;
}
public String getHttpParams() {
return httpParams;
public int getHttpRetryCountOnFailure() {
return httpRetryCountOnFailure;
}
public void setHttpRetryCountOnFailure(int httpRetryCountOnFailure) {
this.httpRetryCountOnFailure = httpRetryCountOnFailure;
}
public void setHttpParams(String httpParams) {
this.httpParams = httpParams;
public boolean isHttpAsync() {
return httpAsync;
}
public void setHttpAsync(boolean httpAsync) {
this.httpAsync = httpAsync;
}
public String getHttpRequestBody() {
return httpRequestBody;
public boolean isHttpCache() {
return httpCache;
}
public void setHttpRequestBody(String httpRequestBody) {
this.httpRequestBody = httpRequestBody;
public void setHttpCache(boolean httpCache) {
this.httpCache = httpCache;
}
public String getHttpResponseMapping() {
return httpResponseMapping;
}
public void setHttpResponseMapping(String httpResponseMapping) {
this.httpResponseMapping = httpResponseMapping;
}
@Override
public boolean replace(ParameterAndValueType parameterAndValueType, ReplaceMode mode) {
String replaced =parameterAndValueType.replace(this.httpParams, mode);
// httpUrl
String replaced =parameterAndValueType.replace(this.httpUrl, mode);
replaced =(replaced==null?"":replaced);
boolean result =false;
if(!replaced.equals(this.httpParams)) {
if(!replaced.equals(this.httpUrl)) {
result =true;
}
this.httpParams =replaced;
this.httpUrl =replaced;
replaced =parameterAndValueType.replace(this.httpResponseMapping, mode);
// httpUrlParameterValues
replaced =parameterAndValueType.replace(this.httpUrlParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpResponseMapping)) {
if(!replaced.equals(this.httpUrlParameterValues)) {
result =true;
}
this.httpResponseMapping =replaced;
this.httpUrlParameterValues =replaced;
replaced =parameterAndValueType.replace(this.httpUrl, mode);
// httpAuthBasicUsername;
replaced =parameterAndValueType.replace(this.httpAuthBasicUsername, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpUrl)) {
if(!replaced.equals(this.httpAuthBasicUsername)) {
result =true;
}
this.httpUrl =replaced;
this.httpAuthBasicUsername =replaced;
// httpAuthBasicPassword;
replaced =parameterAndValueType.replace(this.httpAuthBasicPassword, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpAuthBasicPassword)) {
result =true;
}
this.httpAuthBasicPassword =replaced;
// BearerToken
replaced =parameterAndValueType.replace(this.httpAuthBearerToken, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpAuthBearerToken)) {
result =true;
}
this.httpAuthBearerToken =replaced;
// httpAuthParameterValues
replaced =parameterAndValueType.replace(this.httpAuthParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpAuthParameterValues)) {
result =true;
}
this.httpAuthParameterValues =replaced;
// httpRequestHeader
replaced =parameterAndValueType.replace(this.httpRequestHeader, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestHeader)) {
result =true;
}
this.httpRequestHeader =replaced;
// httpRequestHeaderParameterValues
replaced =parameterAndValueType.replace(this.httpRequestHeaderParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestHeaderParameterValues)) {
result =true;
}
this.httpRequestHeaderParameterValues =replaced;
// httpRequestBody
replaced =parameterAndValueType.replace(this.httpRequestBody, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestBody)) {
result =true;
}
this.httpRequestBody =replaced;
// httpRequestBodyParameterValues
replaced =parameterAndValueType.replace(this.httpRequestBodyParameterValues, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpRequestBodyParameterValues)) {
result =true;
}
this.httpRequestBodyParameterValues =replaced;
// httpResponseMapping
replaced =parameterAndValueType.replace(this.httpResponseMapping, mode);
replaced =(replaced==null?"":replaced);
if(!replaced.equals(this.httpResponseMapping)) {
result =true;
}
this.httpResponseMapping =replaced;
return result;
}
}

143
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/vo/processor/HttpRequestParameterProcessorVo.java

@ -9,35 +9,23 @@ import io.sc.engine.rule.server.model.vo.ParameterProcessorVo;
* 模型参数处理器Http 请求操作Vo
*/
public class HttpRequestParameterProcessorVo extends ParameterProcessorVo {
// Method
private HttpMethodType httpMethod;
// Url
private String httpUrl;
// 认证类型
private HttpAuthorizationType httpAuthType;
// Api Key's key
private String httpAuthApikey;
// Api Key's value
private String httpAuthApiValue;
// Api Key's value
private String httpAuthApiAddTo;
private String httpAuthBasicUsername;
private String httpAuthBasicPassword;
private String httpAuthBearerToken;
private String httpParams;
private String httpRequestBody;
private String httpResponseMapping;
private HttpMethodType httpMethod; // HTTP Method
private String httpUrl; // URL
private String httpUrlParameterValues; // URL 中参数的测试值
private HttpAuthorizationType httpAuthType; // 认证类型
private String httpAuthBasicUsername; // Basic 认证的用户名
private String httpAuthBasicPassword; // Basic 认证的用户密码
private String httpAuthBearerToken; // BearerToken
private String httpAuthParameterValues; // 认证中参数的测试值
private String httpRequestHeader; // 请求头
private String httpRequestHeaderParameterValues; // 请求头中参数的测试值
private String httpRequestBody; // 请求 body
private String httpRequestBodyParameterValues; // 请求 body 中参数的测试值
private int httpConnectTimeout; // 连接超时毫秒数
private int httpRetryCountOnFailure; // 失败重试次数
private boolean httpAsync; // 是否异步执行
private boolean httpCache; // 是否缓存
private String httpResponseMapping; // 响应
@Override
public ProcessorType getType() {
@ -60,36 +48,20 @@ public class HttpRequestParameterProcessorVo extends ParameterProcessorVo {
this.httpUrl = httpUrl;
}
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthApikey() {
return httpAuthApikey;
}
public void setHttpAuthApikey(String httpAuthApikey) {
this.httpAuthApikey = httpAuthApikey;
public String getHttpUrlParameterValues() {
return httpUrlParameterValues;
}
public String getHttpAuthApiValue() {
return httpAuthApiValue;
public void setHttpUrlParameterValues(String httpUrlParameterValues) {
this.httpUrlParameterValues = httpUrlParameterValues;
}
public void setHttpAuthApiValue(String httpAuthApiValue) {
this.httpAuthApiValue = httpAuthApiValue;
}
public String getHttpAuthApiAddTo() {
return httpAuthApiAddTo;
public HttpAuthorizationType getHttpAuthType() {
return httpAuthType;
}
public void setHttpAuthApiAddTo(String httpAuthApiAddTo) {
this.httpAuthApiAddTo = httpAuthApiAddTo;
public void setHttpAuthType(HttpAuthorizationType httpAuthType) {
this.httpAuthType = httpAuthType;
}
public String getHttpAuthBasicUsername() {
@ -116,12 +88,28 @@ public class HttpRequestParameterProcessorVo extends ParameterProcessorVo {
this.httpAuthBearerToken = httpAuthBearerToken;
}
public String getHttpParams() {
return httpParams;
public String getHttpAuthParameterValues() {
return httpAuthParameterValues;
}
public void setHttpAuthParameterValues(String httpAuthParameterValues) {
this.httpAuthParameterValues = httpAuthParameterValues;
}
public String getHttpRequestHeader() {
return httpRequestHeader;
}
public void setHttpRequestHeader(String httpRequestHeader) {
this.httpRequestHeader = httpRequestHeader;
}
public String getHttpRequestHeaderParameterValues() {
return httpRequestHeaderParameterValues;
}
public void setHttpParams(String httpParams) {
this.httpParams = httpParams;
public void setHttpRequestHeaderParameterValues(String httpRequestHeaderParameterValues) {
this.httpRequestHeaderParameterValues = httpRequestHeaderParameterValues;
}
public String getHttpRequestBody() {
@ -132,6 +120,46 @@ public class HttpRequestParameterProcessorVo extends ParameterProcessorVo {
this.httpRequestBody = httpRequestBody;
}
public String getHttpRequestBodyParameterValues() {
return httpRequestBodyParameterValues;
}
public void setHttpRequestBodyParameterValues(String httpRequestBodyParameterValues) {
this.httpRequestBodyParameterValues = httpRequestBodyParameterValues;
}
public int getHttpConnectTimeout() {
return httpConnectTimeout;
}
public void setHttpConnectTimeout(int httpConnectTimeout) {
this.httpConnectTimeout = httpConnectTimeout;
}
public int getHttpRetryCountOnFailure() {
return httpRetryCountOnFailure;
}
public void setHttpRetryCountOnFailure(int httpRetryCountOnFailure) {
this.httpRetryCountOnFailure = httpRetryCountOnFailure;
}
public boolean isHttpAsync() {
return httpAsync;
}
public void setHttpAsync(boolean httpAsync) {
this.httpAsync = httpAsync;
}
public boolean isHttpCache() {
return httpCache;
}
public void setHttpCache(boolean httpCache) {
this.httpCache = httpCache;
}
public String getHttpResponseMapping() {
return httpResponseMapping;
}
@ -139,5 +167,4 @@ public class HttpRequestParameterProcessorVo extends ParameterProcessorVo {
public void setHttpResponseMapping(String httpResponseMapping) {
this.httpResponseMapping = httpResponseMapping;
}
}

5
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/resource/entity/ResourceEntity.java

@ -7,6 +7,7 @@ import io.sc.engine.rule.core.enums.DeployStatus;
import io.sc.engine.rule.core.enums.ResourceType;
import io.sc.engine.rule.server.resource.vo.ResourceVo;
import io.sc.engine.rule.server.testcase.entity.ResourceTestCaseEntity;
import io.sc.platform.core.Environment;
import io.sc.platform.core.util.PinyinUtil;
import io.sc.platform.core.constraints.IdentifierConstraint;
import io.sc.platform.orm.DeepClone;
@ -61,8 +62,8 @@ public class ResourceEntity extends CorporationAuditorEntity<ResourceVo> impleme
protected String name;
//名称
@Column(name="NAMEC_", length=1024)
@Size(max=1024)
@Column(name="NAMEC_", length= Environment.PIN_YIN_MAX_LENGTH)
@Size(max=Environment.PIN_YIN_MAX_LENGTH)
protected String namec;
//描述

40
io.sc.engine.rule.server/src/main/resources/liquibase/RE_1.0.0_20220515__Rule Engine Database Schema DDL.xml

@ -20,7 +20,7 @@
<column name="TYPE_" type="NVARCHAR(20)" remarks="类型,用于区分子类"/>
<column name="CODE_" type="NVARCHAR(255)" remarks="代码"/>
<column name="NAME_" type="NVARCHAR(255)" remarks="名称"/>
<column name="NAMEC_" type="NVARCHAR(1024)" remarks="名称(字母)"/>
<column name="NAMEC_" type="NVARCHAR(700)" remarks="名称(字母)"/>
<column name="DESCRIPTION_" type="NVARCHAR(1024)" remarks="描述"/>
<column name="VERSION_" type="INTEGER" remarks="版本号"/>
<column name="STATUS_" type="NVARCHAR(10)" remarks="状态(HISTORY:历史, ON_LINE:上线, OFF_LINE:下线,SKETCH:草稿,APPROVING:审批中)"/>
@ -378,15 +378,20 @@
<column name="GROOVY_SCRIPT_" type="CLOB" remarks="Groovy脚本代码"/>
<column name="HTTP_METHOD_" type="NVARCHAR(20)" remarks="HTTP请求方法"/>
<column name="HTTP_URL_" type="NVARCHAR(2048)" remarks="HTTP请求URL"/>
<column name="HTTP_URL_PARAMETER_VALUES_" type="CLOB" remarks="HTTP请求 URL 中参数的测试值"/>
<column name="HTTP_AUTH_TYPE_" type="NVARCHAR(20)" remarks="HTTP认证类型"/>
<column name="HTTP_AUTH_API_KEY_" type="NVARCHAR(255)" remarks="HTTP认证(API KEY)-KEY"/>
<column name="HTTP_AUTH_API_VALUE_" type="NVARCHAR(1024)" remarks="HTTP认证(API KEY)-VALUE"/>
<column name="HTTP_AUTH_API_ADDTO_" type="NVARCHAR(20)" remarks="HTTP认证(API KEY)-ADDTO"/>
<column name="HTTP_AUTH_BASIC_USERNAME_" type="NVARCHAR(255)" remarks="HTTP认证(BASIC AUTH)-用户名"/>
<column name="HTTP_AUTH_BASIC_PASSWORD_" type="NVARCHAR(255)" remarks="HTTP认证(BASIC AUTH)-密码"/>
<column name="HTTP_AUTH_BEARER_TOKEN_" type="NVARCHAR(1024)" remarks="HTTP认证(Bear Token)-令牌"/>
<column name="HTTP_PARAMS_" type="NVARCHAR(2048)" remarks="HTTP请求参数"/>
<column name="HTTP_REQUEST_BODY_" type="CLOB" remarks="HTTP请求体"/>
<column name="HTTP_AUTH_PARAMETER_VALUES_" type="CLOB" remarks="HTTP认证中参数的测试值"/>
<column name="HTTP_HEADER_" type="CLOB" remarks="HTTP请求头"/>
<column name="HTTP_HEADER_PARAMETER_VALUES_" type="CLOB" remarks="HTTP请求头中参数的测试值"/>
<column name="HTTP_BODY_" type="CLOB" remarks="HTTP请求体"/>
<column name="HTTP_BODY_PARAMETER_VALUES_" type="CLOB" remarks="HTTP请求体中参数的测试值"/>
<column name="HTTP_CONN_TIMEOUT_" type="INTEGER" remarks="HTTP请求连接超时毫秒数"/>
<column name="HTTP_RETRY_COUNT_" type="INTEGER" remarks="HTTP请求失败重试次数"/>
<column name="HTTP_IS_ASYNC_" type="SMALLINT" remarks="HTTP请求是否采用异步模式"/>
<column name="HTTP_IS_CACHE_" type="SMALLINT" remarks="HTTP请求是否采用缓存"/>
<column name="HTTP_RESPONSE_MAPPING_" type="CLOB" remarks="HTTP响应映射"/>
<column name="MATH_FORMULA_" type="CLOB" remarks="数学公式"/>
<column name="NUMBER_RANGE_VAR_" type="CLOB" remarks="数值分段函数变量表达式"/>
@ -449,7 +454,7 @@
<column name="TYPE_" type="NVARCHAR(20)" remarks="类型,用于区分子类"/>
<column name="CODE_" type="NVARCHAR(255)" remarks="代码"/>
<column name="NAME_" type="NVARCHAR(255)" remarks="名称"/>
<column name="NAMEC_" type="NVARCHAR(1024)" remarks="名称(字母)"/>
<column name="NAMEC_" type="NVARCHAR(700)" remarks="名称(字母)"/>
<column name="DESCRIPTION_" type="NVARCHAR(1024)" remarks="描述"/>
<column name="VERSION_" type="INTEGER" remarks="版本号"/>
<column name="STATUS_" type="NVARCHAR(10)" remarks="状态(HISTORY:历史, ON_LINE:上线, OFF_LINE:下线,SKETCH:草稿,APPROVING:审批中)"/>
@ -506,7 +511,7 @@
</column>
<column name="CODE_" type="NVARCHAR(255)" remarks="代码"/>
<column name="NAME_" type="NVARCHAR(255)" remarks="名称"/>
<column name="NAMEC_" type="NVARCHAR(1024)" remarks="名称(字母)"/>
<column name="NAMEC_" type="NVARCHAR(700)" remarks="名称(字母)"/>
<column name="DESCRIPTION_" type="NVARCHAR(1024)" remarks="描述"/>
<column name="VALUE_TYPE_" type="NVARCHAR(255)" remarks="值数据类型"/>
<column name="VALUE_TYPE_VERSION_" type="INTEGER" remarks="值数据类型版本"/>
@ -618,7 +623,7 @@
<column name="TYPE_" type="NVARCHAR(20)" remarks="类型,用于区分子类"/>
<column name="CODE_" type="NVARCHAR(255)" remarks="代码"/>
<column name="NAME_" type="NVARCHAR(255)" remarks="名称"/>
<column name="NAMEC_" type="NVARCHAR(1024)" remarks="名称(字母)"/>
<column name="NAMEC_" type="NVARCHAR(700)" remarks="名称(字母)"/>
<column name="DESCRIPTION_" type="NVARCHAR(1024)" remarks="描述"/>
<column name="PARENT_ID_" type="NVARCHAR(36)" remarks="父ID"/>
@ -790,15 +795,20 @@
<column name="GROOVY_SCRIPT_" type="CLOB" remarks="Groovy脚本代码"/>
<column name="HTTP_METHOD_" type="NVARCHAR(20)" remarks="HTTP请求方法"/>
<column name="HTTP_URL_" type="NVARCHAR(2048)" remarks="HTTP请求URL"/>
<column name="HTTP_URL_PARAMETER_VALUES_" type="CLOB" remarks="HTTP请求 URL 中参数的测试值"/>
<column name="HTTP_AUTH_TYPE_" type="NVARCHAR(20)" remarks="HTTP认证类型"/>
<column name="HTTP_AUTH_API_KEY_" type="NVARCHAR(255)" remarks="HTTP认证(API KEY)-KEY"/>
<column name="HTTP_AUTH_API_VALUE_" type="NVARCHAR(1024)" remarks="HTTP认证(API KEY)-VALUE"/>
<column name="HTTP_AUTH_API_ADDTO_" type="NVARCHAR(20)" remarks="HTTP认证(API KEY)-ADDTO"/>
<column name="HTTP_AUTH_BASIC_USERNAME_" type="NVARCHAR(255)" remarks="HTTP认证(BASIC AUTH)-用户名"/>
<column name="HTTP_AUTH_BASIC_PASSWORD_" type="NVARCHAR(255)" remarks="HTTP认证(BASIC AUTH)-密码"/>
<column name="HTTP_AUTH_BEARER_TOKEN_" type="NVARCHAR(1024)" remarks="HTTP认证(Bear Token)-令牌"/>
<column name="HTTP_PARAMS_" type="NVARCHAR(2048)" remarks="HTTP请求参数"/>
<column name="HTTP_REQUEST_BODY_" type="CLOB" remarks="HTTP请求体"/>
<column name="HTTP_AUTH_PARAMETER_VALUES_" type="CLOB" remarks="HTTP认证中参数的测试值"/>
<column name="HTTP_HEADER_" type="CLOB" remarks="HTTP请求头"/>
<column name="HTTP_HEADER_PARAMETER_VALUES_" type="CLOB" remarks="HTTP请求头中参数的测试值"/>
<column name="HTTP_BODY_" type="CLOB" remarks="HTTP请求体"/>
<column name="HTTP_BODY_PARAMETER_VALUES_" type="CLOB" remarks="HTTP请求体中参数的测试值"/>
<column name="HTTP_CONN_TIMEOUT_" type="INTEGER" remarks="HTTP请求连接超时毫秒数"/>
<column name="HTTP_RETRY_COUNT_" type="INTEGER" remarks="HTTP请求失败重试次数"/>
<column name="HTTP_IS_ASYNC_" type="SMALLINT" remarks="HTTP请求是否采用异步模式"/>
<column name="HTTP_IS_CACHE_" type="SMALLINT" remarks="HTTP请求是否采用缓存"/>
<column name="HTTP_RESPONSE_MAPPING_" type="CLOB" remarks="HTTP响应映射"/>
<column name="MATH_FORMULA_" type="CLOB" remarks="数学公式"/>
<column name="NUMBER_RANGE_VAR_" type="CLOB" remarks="数值分段函数变量表达式"/>
@ -941,7 +951,7 @@
<column name="SIGNATURE_" type="NVARCHAR(255)" remarks="函数签名"/>
<column name="DESCRIPTION_" type="NVARCHAR(255)" remarks="描述"/>
<column name="ENABLE_" type="SMALLINT" remarks="是否可用"/>
<column name="MATH_XML_" type="NVARCHAR(512)" remarks="数学公式的 matchml"/>
<column name="MATH_XML_" type="CLOB" remarks="数学公式的 matchml"/>
<column name="BODY_" type="CLOB" remarks="函数体"/>
<!-- 审计字段 -->

4
io.sc.engine.st.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.engine.st.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.ai.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.ai.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

2
io.sc.platform.core.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.2.70",
"version": "8.2.71",
"description": "前端核心包,用于快速构建前端的脚手架",
"//main": "库的主文件",
"main": "dist/platform-core.js",

9
io.sc.platform.core.frontend/src/platform/utils/Tools.ts

@ -59,6 +59,15 @@ class Tools {
return obj === null || typeof obj === 'undefined' || obj === '';
}
/**
*
* @param obj
* @returns
*/
public static isBoolean(obj: any): boolean {
return 'boolean' === typeof obj;
}
/**
*
* @param obj

4
io.sc.platform.core.frontend/template-project/package.json

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.2.70",
"version": "8.2.71",
"description": "前端核心包,用于快速构建前端的脚手架",
"private": false,
"keywords": [],
@ -111,7 +111,7 @@
"mockjs": "1.1.0",
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

1
io.sc.platform.core/src/main/java/io/sc/platform/core/Environment.java

@ -17,6 +17,7 @@ public class Environment {
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
public static final String DEFAULT_CHARSET_NAME = StandardCharsets.UTF_8.name();
public static final String DEFAULT_URL_ENCODE_NAME = StandardCharsets.UTF_8.name();
public static final int PIN_YIN_MAX_LENGTH =700;
public static final String KEY_APPLICATION_NAME ="application.name";
public static final String KEY_IS_RUNNING_IN_DEVELOPMENT ="application.is-running-in-development";
public static final String KEY_IS_RUNNING_IN_WEB_CONTAINER ="application.is-running-in-web-container";

12
io.sc.platform.core/src/main/java/io/sc/platform/core/util/PinyinUtil.java

@ -72,7 +72,9 @@ public class PinyinUtil {
return chinese;
}
String[] array =getPinYinArray(chinese);
return StringUtil.combine("",array);
String result =StringUtil.combine("",array);
int length =result.length();
return result.substring(0,length>Environment.PIN_YIN_MAX_LENGTH?Environment.PIN_YIN_MAX_LENGTH:length);
}
public static String pinyinOnlyFirst(String chinese) {
@ -96,7 +98,9 @@ public class PinyinUtil {
for(String pinyin : array) {
sb.append(pinyin.substring(0, 1).toUpperCase()).append(pinyin.substring(1));
}
return sb.toString();
String result =sb.toString();
int length =result.length();
return result.substring(0,length>Environment.PIN_YIN_MAX_LENGTH?Environment.PIN_YIN_MAX_LENGTH:length);
}
private static String[] getPinYinArray(String chinese) {
@ -212,8 +216,4 @@ public class PinyinUtil {
}
return pinyin(o1).compareTo(pinyin(o2));
}
public static void main(String[] args) {
System.out.println(pinyin("重庆"));
}
}

4
io.sc.platform.developer.doc/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.developer.doc",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"main": "index.js",
"scripts": {
@ -28,7 +28,7 @@
"vuepress": "2.0.0-rc.15"
},
"dependencies": {
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"vue": "3.5.13",
"vue-i18n": "11.0.1"

4
io.sc.platform.developer.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.developer.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.lcdp.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.lcdp.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.license.keygen.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.license.keygen.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.mvc.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.mvc.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.scheduler.manager.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.scheduler.manager.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.system.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.system.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -111,7 +111,7 @@
"mockjs": "1.1.0",
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.standard.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.standard.frontend",
"version": "8.2.13",
"version": "8.2.14",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.70",
"platform-core": "8.2.71",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.website/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.website",
"version": "8.2.12",
"version": "8.2.14",
"description": "",
"main": "index.js",
"scripts": {
@ -28,6 +28,6 @@
},
"dependencies": {
"vue": "3.5.13",
"platform-core": "8.2.70"
"platform-core": "8.2.71"
}
}
Loading…
Cancel
Save