Showing posts with label groovy. Show all posts
Showing posts with label groovy. Show all posts

Sunday, 2 October 2016

Construct a JSON document with groovy.json.JsonBuilder


def builder = new groovy.json.JsonBuilder()
def myMap = [:]

myMap.put('name', 'Dynamically generated approval Pprocess')
myMap.put('rootActivity', ['type':'graph'])
myMap['rootActivity'] +=  ['name':'auto'] 
builder.call( myMap )
println builder.toPrettyString()

Friday, 13 May 2016

Create configuration file templates programatically


The UrbanCode REST interface has a nice function for creating Configuration file templates.

First you need to create some JSON specifying the name of the template, the component ID and the contents of the template.

You'll notice that I've chosen to use a variable from a previous process step (the process step is named "Read Templates"   and the property is called xpath.template.contents) into which I've read the contents of the template I need to create.

Now all we need to do is call the REST interface to create the template - Here's an example of how to do this in a Groovy process step