introduced termination when folder exists meaning order already processed

This commit is contained in:
dcore94 2021-10-18 12:08:50 +02:00
parent c173f3441c
commit 0ee189e8e0
1 changed files with 62 additions and 24 deletions

View File

@ -59,7 +59,7 @@
},
{
"name": "decision",
"taskReferenceName": "check_user_existance",
"taskReferenceName": "check_folder_existance",
"inputParameters": {
"folders": "${check_folder.output.response.body.itemlist}"
},
@ -108,31 +108,69 @@
}
},
{
"name" : "pyrest",
"taskReferenceName" : "create_destination_folder",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.storagehub}/workspace/items/${workflow.variables.parent_folder_id}/create/FOLDER",
"method" : "POST",
"headers" : {
"Content-type": "application/x-www-form-urlencoded",
"Accept" : "text/plain",
"Authorization" : "${init.input.auth}"
},
"body" : {
"name" : "${init.input.folder}",
"description" : "Target folder of Bluecloud data downloads",
"hidden" : "false"
}
}
"name" : "http",
"taskReferenceName" : "check_destination_folder",
"type" : "HTTP",
"inputParameters" : {
"http_request": {
"uri" : "${init.input.storagehub}/workspace/items/${workflow.variables.parent_folder_id}/items/${init.input.folder}",
"method" : "GET",
"headers" : { "Authorization" : "${init.input.auth}" }
}
}
},
{
"type": "SET_VARIABLE",
"name": "store_target_folderid",
"taskReferenceName": "store_target_folderid",
"inputParameters": {
"target_folder_id": "${create_destination_folder.output.body}"
}
"name": "decision",
"taskReferenceName": "check_destination_folder_existance",
"inputParameters": {
"folders": "${check_destination_folder.output.response.body.itemlist}"
},
"type": "DECISION",
"caseExpression": "($.folders.length === 0 ? 'create' : 'exists')",
"decisionCases": {
"create": [
{
"name" : "pyrest",
"taskReferenceName" : "create_destination_folder",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.storagehub}/workspace/items/${workflow.variables.parent_folder_id}/create/FOLDER",
"method" : "POST",
"headers" : {
"Content-type": "application/x-www-form-urlencoded",
"Accept" : "text/plain",
"Authorization" : "${init.input.auth}"
},
"body" : {
"name" : "${init.input.folder}",
"description" : "Target folder of Bluecloud data downloads",
"hidden" : "false"
}
}
},
{
"type": "SET_VARIABLE",
"name": "store_target_folderid",
"taskReferenceName": "store_target_folderid",
"inputParameters": {
"target_folder_id": "${create_destination_folder.output.body}"
}
}
],
"exists" : [
{
"name": "terminate",
"taskReferenceName": "duplicate_folder",
"inputParameters": {
"terminationStatus": "FAILED",
"workflowOutput": "Order already processed."
},
"type": "TERMINATE",
"startDelay": 0,
"optional": false
}
]
}
},
{
"name": "LAMBDA_TASK",