feature #I4GYV2 script节点支持从文件中获取脚本

This commit is contained in:
bryan31
2021-11-05 13:15:52 +08:00
parent 6d113d1b2b
commit 169a47a412
36 changed files with 597 additions and 11 deletions

View File

@@ -0,0 +1 @@
liteflow.rule-source=json-script-file/flow.json

View File

@@ -0,0 +1,34 @@
{
"flow": {
"nodes": {
"node": [
{
"id": "s1",
"name": "普通脚本",
"type": "script",
"file": "json-script-file/s1.groovy"
},
{
"id": "s2",
"name": "条件脚本",
"type": "cond_script",
"file": "json-script-file/s2.groovy"
}
]
},
"chain": [
{
"name": "chain1",
"condition": [
{"type": "then", "value": "a,b,c,s1"}
]
},
{
"name": "chain2",
"condition": [
{"type": "then", "value": "d,s2(a|b)"}
]
}
]
}
}

View File

@@ -0,0 +1,40 @@
{
"flow": {
"nodes": {
"node": [
{
"id": "s1",
"name": "普通脚本",
"type": "script",
"file": "json-script-file/s1.groovy"
},
{
"id": "s2",
"name": "条件脚本_改",
"type": "cond_script",
"file": "json-script-file/s2_update.groovy"
},
{
"id": "s3",
"name": "普通脚本_新增",
"type": "script",
"file": "json-script-file/s2_update.groovy"
}
]
},
"chain": [
{
"name": "chain1",
"condition": [
{"type": "then", "value": "a,b,c,s1"}
]
},
{
"name": "chain2",
"condition": [
{"type": "then", "value": "d,s2(a|b),s3"}
]
}
]
}
}

View File

@@ -0,0 +1,3 @@
Integer a=3
Integer b=2
slot.setData("s1",a*b)

View File

@@ -0,0 +1,6 @@
Integer count = slot.getData("count")
if(count > 100){
return "a"
}else{
return "b"
}

View File

@@ -0,0 +1,6 @@
Integer count = slot.getData("count")
if(count > 150){
return "b"
}else{
return "a"
}

View File

@@ -0,0 +1,4 @@
Integer a=3
Integer b=2
Integer c=10
slot.setData("s1",a*b+c)

View File

@@ -0,0 +1 @@
liteflow.rule-source=xml-script-file/flow.xml

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<nodes>
<node id="s1" name="普通脚本" type="script" file="xml-script-file/s1.groovy"/>
<node id="s2" name="条件脚本" type="cond_script" file="xml-script-file/s2.groovy"/>
</nodes>
<chain name="chain1">
<then value="a,b,c,s1"/>
</chain>
<chain name="chain2">
<then value="d,s2(a|b)"/>
</chain>
</flow>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<nodes>
<node id="s1" name="普通脚本" type="script" file="xml-script-file/s1.groovy"/>
<node id="s2" name="条件脚本_改" type="cond_script" file="xml-script-file/s2_update.groovy"/>
<node id="s3" name="普通脚本_新增" type="script" file="xml-script-file/s3.groovy"/>
</nodes>
<chain name="chain1">
<then value="a,b,c,s1"/>
</chain>
<chain name="chain2">
<then value="d,s2(a|b),s3"/>
</chain>
</flow>

View File

@@ -0,0 +1,3 @@
Integer a=3
Integer b=2
slot.setData("s1",a*b)

View File

@@ -0,0 +1,6 @@
Integer count = slot.getData("count")
if(count > 100){
return "a"
}else{
return "b"
}

View File

@@ -0,0 +1,6 @@
Integer count = slot.getData("count")
if(count > 150){
return "b"
}else{
return "a"
}

View File

@@ -0,0 +1,4 @@
Integer a=3
Integer b=2
Integer c=10
slot.setData("s1",a*b+c);