Skip to content

Commit 352d176

Browse files
authored
Merge pull request #118 from codingapi/dev
update version
2 parents 6ff4c71 + a0de501 commit 352d176

11 files changed

Lines changed: 68 additions & 21 deletions

File tree

flow-engine-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.flow</groupId>
88
<artifactId>flow-engine-parent</artifactId>
9-
<version>0.0.18</version>
9+
<version>0.0.22</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

flow-engine-framework/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.flow</groupId>
88
<artifactId>flow-engine-parent</artifactId>
9-
<version>0.0.18</version>
9+
<version>0.0.22</version>
1010
</parent>
1111

1212
<name>flow-engine-framework</name>

flow-engine-framework/src/main/java/com/codingapi/flow/form/FieldAttribute.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ public class FieldAttribute {
1212
// 属性名称
1313
private String label;
1414
// 属性值
15-
private String value;
15+
private Object value;
1616
}

flow-engine-framework/src/main/java/com/codingapi/flow/form/FlowForm.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ public static FlowForm fromMap(Map<String, Object> map) {
7474
fieldMeta.setPlaceholder((String) field.get("placeholder"));
7575
fieldMeta.setTooltip((String) field.get("tooltip"));
7676
fieldMeta.setHelp((String) field.get("help"));
77-
List<Map<String, Object>> attributes = (List<Map<String, Object>>)field.get("attributes");
78-
if(attributes!=null) {
77+
List<Map<String, Object>> attributes = (List<Map<String, Object>>) field.get("attributes");
78+
if (attributes != null) {
7979
List<FieldAttribute> attributeList = new ArrayList<>();
80-
for (Map<String, Object> attribute : attributes){
80+
for (Map<String, Object> attribute : attributes) {
8181
FieldAttribute fieldAttribute = new FieldAttribute();
8282
fieldAttribute.setKey((String) attribute.get("key"));
8383
fieldAttribute.setLabel((String) attribute.get("label"));
84-
fieldAttribute.setValue((String) attribute.get("value"));
84+
fieldAttribute.setValue(attribute.get("value"));
8585
attributeList.add(fieldAttribute);
8686
}
8787
fieldMeta.setAttributes(attributeList);
@@ -124,15 +124,16 @@ public FormField getField(String fieldCode) {
124124

125125
/**
126126
* 获取表单字段
127-
* @param formCode 表单code
127+
*
128+
* @param formCode 表单code
128129
* @param fieldCode 字段code
129130
*/
130-
public FormField getField(String formCode,String fieldCode){
131-
if(this.code.equals(formCode)){
131+
public FormField getField(String formCode, String fieldCode) {
132+
if (this.code.equals(formCode)) {
132133
return this.getField(fieldCode);
133-
}else {
134-
for (FlowForm subForm:subForms){
135-
if(subForm.getCode().equals(formCode)){
134+
} else {
135+
for (FlowForm subForm : subForms) {
136+
if (subForm.getCode().equals(formCode)) {
136137
return subForm.getField(fieldCode);
137138
}
138139
}
@@ -156,9 +157,9 @@ private void initFormFieldDataTypes(FlowForm form, Map<String, DataType> types)
156157
public Map<String, DataType> loadAllFieldDataTypeMaps() {
157158
Map<String, DataType> types = new HashMap<>();
158159
List<FlowForm> forms;
159-
if(this.subForms==null || this.subForms.isEmpty()){
160+
if (this.subForms == null || this.subForms.isEmpty()) {
160161
forms = new ArrayList<>();
161-
}else {
162+
} else {
162163
forms = new ArrayList<>(this.getSubForms());
163164
}
164165
forms.add(this);
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.codingapi.flow.form;
2+
3+
import com.alibaba.fastjson.JSONObject;
4+
import org.junit.jupiter.api.Test;
5+
6+
import static org.junit.jupiter.api.Assertions.*;
7+
8+
class FieldAttributeTest {
9+
10+
11+
@Test
12+
void convert(){
13+
14+
String attribute1 = """
15+
{
16+
"key":"123",
17+
"label":"123",
18+
"value":{
19+
"data":"123"
20+
}
21+
}
22+
""";
23+
24+
String attribute2 = """
25+
{
26+
"key":"123",
27+
"label":"123",
28+
"value":[
29+
{
30+
"data":"123"
31+
},
32+
{
33+
"data":"123"
34+
}
35+
]
36+
}
37+
""";
38+
39+
FieldAttribute attributeObj1 = JSONObject.parseObject(attribute1,FieldAttribute.class);
40+
FieldAttribute attributeObj2 = JSONObject.parseObject(attribute2,FieldAttribute.class);
41+
42+
assertEquals("{\"data\":\"123\"}", attributeObj1.getValue().toString());
43+
assertEquals("[{\"data\":\"123\"},{\"data\":\"123\"}]", attributeObj2.getValue().toString());
44+
45+
}
46+
}

flow-engine-starter-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.flow</groupId>
88
<artifactId>flow-engine-parent</artifactId>
9-
<version>0.0.18</version>
9+
<version>0.0.22</version>
1010
</parent>
1111

1212
<name>flow-engine-starter-api</name>

flow-engine-starter-infra/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.flow</groupId>
88
<artifactId>flow-engine-parent</artifactId>
9-
<version>0.0.18</version>
9+
<version>0.0.22</version>
1010
</parent>
1111

1212
<name>flow-engine-starter-infra</name>

flow-engine-starter-query/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.flow</groupId>
88
<artifactId>flow-engine-parent</artifactId>
9-
<version>0.0.18</version>
9+
<version>0.0.22</version>
1010
</parent>
1111

1212
<name>flow-engine-starter-query</name>

flow-engine-starter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.flow</groupId>
88
<artifactId>flow-engine-parent</artifactId>
9-
<version>0.0.18</version>
9+
<version>0.0.22</version>
1010
</parent>
1111

1212
<name>flow-engine-starter</name>

0 commit comments

Comments
 (0)