|
@@ -10,18 +10,15 @@ import lombok.Data;
|
|
import lombok.EqualsAndHashCode;
|
|
import lombok.EqualsAndHashCode;
|
|
import org.flowable.bpmn.model.*;
|
|
import org.flowable.bpmn.model.*;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
@EqualsAndHashCode(callSuper = true)
|
|
@EqualsAndHashCode(callSuper = true)
|
|
@Data
|
|
@Data
|
|
public class HttpNode extends Node {
|
|
public class HttpNode extends Node {
|
|
private String url;
|
|
private String url;
|
|
private String method;
|
|
private String method;
|
|
- private List<Map<String, String>> headers;
|
|
|
|
- private List<Map<String, String>> body;
|
|
|
|
|
|
+ private List<Map<String, Object>> headers;
|
|
|
|
+ private List<Map<String, Object>> body;
|
|
private Long requestTimeout = 0L;
|
|
private Long requestTimeout = 0L;
|
|
private Integer retryCount;
|
|
private Integer retryCount;
|
|
private TimeUnitEnum unit = TimeUnitEnum.MINUTE;
|
|
private TimeUnitEnum unit = TimeUnitEnum.MINUTE;
|
|
@@ -67,20 +64,38 @@ public class HttpNode extends Node {
|
|
try {
|
|
try {
|
|
ObjectMapper objectMapper = ApplicationContextUtil.getBean(ObjectMapper.class);
|
|
ObjectMapper objectMapper = ApplicationContextUtil.getBean(ObjectMapper.class);
|
|
if (CollectionUtils.isNotEmpty(this.headers)) {
|
|
if (CollectionUtils.isNotEmpty(this.headers)) {
|
|
- String headers = objectMapper.writeValueAsString(this.headers);
|
|
|
|
|
|
+ Map<Object, Object> map = new HashMap<>();
|
|
|
|
+ for (Map<String, Object> header : this.headers) {
|
|
|
|
+ Object label = header.get("label");
|
|
|
|
+ Object value = header.get("value");
|
|
|
|
+ if (Objects.nonNull(label) && Objects.nonNull(value)) {
|
|
|
|
+ map.put(label, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String headers = objectMapper.writeValueAsString(map);
|
|
FieldExtension headerExtension = new FieldExtension();
|
|
FieldExtension headerExtension = new FieldExtension();
|
|
headerExtension.setFieldName("requestHeaders");
|
|
headerExtension.setFieldName("requestHeaders");
|
|
headerExtension.setExpression(headers);
|
|
headerExtension.setExpression(headers);
|
|
fieldExtensions.add(headerExtension);
|
|
fieldExtensions.add(headerExtension);
|
|
}
|
|
}
|
|
if (CollectionUtils.isNotEmpty(this.body)) {
|
|
if (CollectionUtils.isNotEmpty(this.body)) {
|
|
- String requestBody = objectMapper.writeValueAsString(this.body);
|
|
|
|
|
|
+ Map<Object, Object> map = new HashMap<>();
|
|
|
|
+ for (Map<String, Object> boy : this.body) {
|
|
|
|
+ Object label = boy.get("label");
|
|
|
|
+ Object value = boy.get("value");
|
|
|
|
+ if (Objects.nonNull(label) && Objects.nonNull(value)) {
|
|
|
|
+ map.put(label, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String body = objectMapper.writeValueAsString(map);
|
|
|
|
+ String requestBody = objectMapper.writeValueAsString(body);
|
|
FieldExtension bodyExtension = new FieldExtension();
|
|
FieldExtension bodyExtension = new FieldExtension();
|
|
bodyExtension.setFieldName("requestBody");
|
|
bodyExtension.setFieldName("requestBody");
|
|
bodyExtension.setExpression(requestBody);
|
|
bodyExtension.setExpression(requestBody);
|
|
fieldExtensions.add(bodyExtension);
|
|
fieldExtensions.add(bodyExtension);
|
|
}
|
|
}
|
|
- } catch (JsonProcessingException ignored) {}
|
|
|
|
|
|
+ } catch (JsonProcessingException ignored) {
|
|
|
|
+ }
|
|
FieldExtension timeoutExtension = new FieldExtension();
|
|
FieldExtension timeoutExtension = new FieldExtension();
|
|
timeoutExtension.setFieldName("requestTimeout");
|
|
timeoutExtension.setFieldName("requestTimeout");
|
|
timeoutExtension.setStringValue(this.requestTimeout.toString());
|
|
timeoutExtension.setStringValue(this.requestTimeout.toString());
|