Sunday 2 October 2016

Generate an UrbanCode process programatically



!/bin/bash

[ "$1" != "" ] || {
          echo "Please supply process name"
          exit 1
}

cat /dev/null > tmp.json
cat <<EOF > tmp.json

{
        "description": "",
        "name": "$1",
        "notificationScheme": "DefaultnotofocationScheme",
        "properties": {
                "foo": "bar"
        },
        "rootActivity": {
                "type": "graph",
                "name": "generated",
                "edges": [
                    {
                        "to": "task",
                        "type": "ALWAYS",
                        "value": ""
                    },
                    {
                        "to": "ae2de8fcf2e3b56bcb2fe451ff9db8",
                        "from": "task",
                        "type": "SUCCESS",
                        "value": ""
                    }
                ],
               "children": [
                    {
                        "type": "finish",
                        "name": "ae2de8fcf2e3b56bcb2fe451ff9db8",
                        "children": []
                    },
                    {
                        "commentRequired": false,
                        "commentPrompt": "",
                        "templateName": "TaskCreated",
                        "userNames": "",
                        "groupNames": "",
                        "propDefs": [],
                        "type": "manualTask",
                        "name": "task",
                        "children": []
                    }
                ]
        },
        "workingDir": "${p:resource\\/work.dir}\\/${p:process.name}"
}
EOF
result=$(curl -k -u '<user>:>password>' 'https://<host>:<port>/cli/process/create' -X PUT --data-binary @tmp.json)
echo "RESULT: $result"
echo ""

Evernote helps you remember everything and get organized effortlessly. Download Evernote.

No comments:

Post a Comment