Using the Script Task
Introduction
A Script Task is a BPMN shape that lets you use scripting languages to allow custom logic to be executed. The shape works as all others by taking input variables and setting outputs with the task executing the provided script.
Languages
The Script Task currently supports the Groovy and JavaScript languages. Groovy is a JVM-based language which means it is built on top of the Java language and has access to the standard Java libraries in addition to the standard Groovy languages. The JavaScript support is Java's Nashorn engine.
Resources
Groovy
- http://groovy-lang.org/index.html
- http://www.groovy-lang.org/documentation.html
- http://docs.groovy-lang.org/latest/html/api/groovy/lang/GroovyShell.html
- http://javabeat.net/introduction-to-groovy-scripting-language/
- http://docs.smartthings.com/en/latest/getting-started/groovy-basics.html
- https://learnxinyminutes.com/docs/groovy/
- https://dzone.com/articles/groovyshell-and-memory-leaks
JavaScript
- http://docs.oracle.com/javase/7/docs/technotes/guides/scripting/programmer_guide/
- https://www.infoq.com/articles/nashorn
IDE
Logistics
When a Script Task is activated it is sent via an internal message to a script engine outside the process engine to await execution.
Validation
Validation in the modeler and on deployment verifies that a script exists and that it is compilable on the target environment.
Variable Names
Variable input and output names must be compliant with language keywords, reserved words, special characters and core classes.
Groovy
1.1.2. Keywords
The following list represents all the keywords of the Groovy language.
as
|
assert
|
break
|
case
|
catch
|
class
|
const
|
contine
|
def
|
default
|
do
|
else
|
enum
|
extends
|
false
|
finally
|
for
|
goto
|
if
|
implements
|
import
|
in
|
instanceof
|
interface
|
new
|
null
|
package
|
return
|
super
|
switch
|
this
|
throw
|
throws
|
trait
|
true
|
try
|
while
|
Identifiers
Normal Identifiers
Identifiers start with a letter, a dollar or an underscore. They can't start with a number.
A letter can be in the following ranges:
- 'a' to 'z' (lowercase ascii letter)
- 'A' to 'Z' (uppercase ascii letter)
- '\u00C0' to '\u00D6'
- '\u00D8' to '\u00F6'
- '\u00F8' to '\u00FF'
- '\u0100' to '\uFFFE'
The following characters can contain letters and numbers.
Following are a few examples of valid identifiers (here, variable names):
def name
def item3
def with_underscore
def $dollarStart
The following are invalid identifiers
def 3tier
def a+b
def a#b
Java Language Keywords
Following is a list of keywords in the Java programming language. you cannot use any of the following as identifiers in your programs. The keywords const
and goto
are reserved, even though they are not currently used. true
, false
, and null
might seem like keywords, but they are actually literals — so you can't use them as identifiers in your programs.
abstract
|
continue
|
for
|
new
|
switch
|
assert***
|
default
|
goto*
|
package
|
synchronized
|
boolean
|
do
|
if
|
private
|
this
|
break
|
double
|
implements
|
protected
|
throw
|
byte
|
else
|
import
|
publi
|
throws
|
case
|
enum****
|
instanceof
|
return
|
transient
|
catch
|
extends
|
int
|
short
|
try
|
char
|
final
|
interface
|
static
|
void
|
class
|
finally
|
longe
|
strictfp**
|
volatile
|
const*
|
float
|
native
|
super
|
while
|
* not used
** added in 1.2
*** added in 1.4
**** added in 5.0
Restricted List (not limited to)
- String
- Long
- Float
- Boolean
- Int
- Integer
- BigDecimal
JavaScript Reserved Words
In JavaScript you can't use the following reserved words as variables, labels, or function names:
abstract
|
arguments
|
await*
|
boolean
|
break
|
byte
|
case
|
catch
|
char
|
class*
|
const
|
continue
|
debugger
|
default
|
delete
|
do
|
double
|
else
|
enum*
|
val
|
export*
|
extends*
|
false
|
final
|
finally
|
float
|
for
|
function
|
goto
|
if
|
implements
|
import*
|
in
|
instanceof
|
int
|
interface
|
let*
|
long
|
native
|
new
|
null
|
package
|
private
|
protected
|
public
|
return
|
short
|
static
|
super*
|
switch
|
synchronized
|
this
|
throw
|
throws
|
transient
|
true
|
try
|
typeof
|
var
|
void
|
volatile
|
while
|
with
|
yield
|
Error Boundary Events
The Script Task supports a single error boundary event to be added to its shape. If any error occurs, a token will flow down this path.
Errors
As with all code there is the chance that the script will generate an error. This can be from not providing data to null pointers or just bad logic. If an exception is thrown from the script it will propagate back to the process instance as an error.
Timeout Configuration
To prevent a script from running too long the Script Task has a configurable Timeout option in minutes. This should be configured to the least amount of time that the script should run in.
Timeouts in the Script Engine
When the script starts executing, the script engine will watch the elapsed time and once the timeout is reached a cancel request will be sent to the executing thread. This will terminate the running script and send a TIMEOUT error back to the process engine.
Timeouts in the Process Engine
As another timeout check for if the entire script engine is down, the process engine will track the executing script. It will error the task if the script does not start executing within 90 seconds or once it starts and does not hear back with a success or error after the configured timeout plus one minute.
Both timeouts will error the Script Task and execute the Error Boundary if there is one on the shape, otherwise, it will error the process instance.
Script Hash Code
A hash code based on the text of the script is generated on model checkin. This hash code is used to identify copied scripts among different script tasks or in different models. The hash code is based on all the characters, so even an additional space in one script will differentiate it from another.
Statistics and Instance Runs
Each instance run will be stored in the database for an administrator to mine for statistical information. This data will be very useful in determining if a script has a problem, is running too long or longer than expected or causing process instances to fail.
Blacklisting
Because scripts are open form there is the chance that a script can be written that can cause issues with the JVM it runs in or has been written with bad logic. If a script becomes a constant problem an administrator has the ability to blacklist a script with its hash code. Once a script is blacklisted, the script engine will immediately return an error whenever it receives a script to execute with a blacklisted script hash code. The reason for the hash code as the blacklist key is so that if there are multiple exact copies of a certain script that has been deemed bad, the blacklisting will affect them all, no matter what model they run in.
Whitelisting
A blacklisted script may be returned to a runnable state.
Separate JVM
The Script Engine runs in a separate JVM to prevent any bad scripts from bringing down the whole process engine.
Logging in Script
A variable called LOG is provided to both languages. Write to this string variable for storage of logs. A custom class called ScriptLogger is provided for Groovy scripts as a helper.
Data
Data is provided in two forms, native Java objects and JSON strings.
Assignments to data outputs must be explicitly made either with the name of the output or through the DATA_OUTPUT variable. Returns with values are ignored.
Note: Integers coming out of JavaScript become floats.
Java Variables
PM Data Type | Groovy | JavaScript |
---|---|---|
Date
|
java.util.Date
|
java.util.Date
|
DateTime
|
java.time.ZonedDateTime
|
java.time.ZonedDateTime
|
Time
|
NOT SUPPORTED
|
NOT SUPPORTED
|
Duration
|
NOT SUPPORTED
|
NOT SUPPORTED
|
String
|
java.lang.String
|
java.lang.String
|
Boolean
|
java.lang.Boolean
|
java.lang.Boolean
|
Value Group
|
java.lang.String
|
java.lang.String
|
Float
|
java.math.BigDecimal
|
java.math.BigDecimal
|
Integer
|
java.lang.Long
|
java.lang.Long
|
Complex
|
NOT SUPPORTED
|
NOT SUPPORTED
|
Note: BigDecimal does not support operators such as +, please use the methods provided on the class.
JSON Variables
Each script is always given a set of JSON-formatted strings of input data and type data. These can be parsed by the script and used for type information and data structure.
See examples further down for usages.
DATA_INPUT
This variable is a JSON string with all input variables and values. This will need to be parsed and values may need to be cast to the proper types.
Example:
{"integer1":2,"integer2":1}
DATA_TYPES
This is a helper variable that has all of the data inputs and outputs but instead of the value it is the XSD type that the variables resolve to.
Examples:
a) {"time1":"time"}
b) {"integer2":"int","integer1":"int","integer3":"int"}
DATA_OUTPUT
This variable, if set, will overwrite any other assigned outputs. This must be in the expected output structure as a JSON object.
LOG
A default variable provided in Groovy and JavaScript. You may write directly to this variable or use the helper class ScriptLogger to write logs. On completion or error of the script, the logs will be written to the database.
Tips and Best Practices
- Keep scripts as small as possible.
- Use an IDE like IntelliJ IDEA to develop scripts.
- Be sure to handle various different data inputs like null or negative numbers. Check your data before using.
- If possible, run through many tests in an IDE first.
- Use the compile and test buttons often if developing in the modeler.
- Have another person verify your script.
Supported Libraries
- JavaScript
- Nashorn Javascript engine
- Groovy
- Java 1.8.x
- Groovy 2.4.10
- Apache httpcomponents/HttpClient
- Custom Libraries provided by PM
- com.xtrac.script.library.tools.BasicTools
- com.xtrac.script.library.tools.PMTools
- com.xtrac.script.library.tools.ScriptLogger
Limitations
No support for Complex types, Duration or Time in PM 2.0
Due to a limitation in the underlying data infrastructure and the coming work for null, list and maps, we do not support complex types, duration or time.
External Libraries
The script engine does not allow automatic import of external libraries. However, if a library is needed, Operations can be requested to put the jar onto the classpath of both Source and Target environments. Use and maintain at your own risk.
Scripts as Files
There is no central repository for scripts. If the same script is to be used in multiple places, it must be copied manually. OneNote or another Wiki may be used as a psuedo-repository if needed. Or a call activity can wrap a Script Task.
Custom Libraries for Groovy
com.xtrac.script.library.tools.ScriptLogger
Add import:
import com.xtrac.script.library.tools.ScriptLogger
Method and Parameters | Return Type | Description |
---|---|---|
log(String log) | Unit | Logs with INFO |
error(String log) | Unit | Logs with Error |
logBindingVariables() | Unit | Logs all Binding variables. Variables declared in the script are not printed. |
Examples in Groovy
Logging
Input name | Input type | Output name | Output type |
Script
import com.xtrac.script.library.tools.ScriptLogger
def logger = new ScriptLogger(binding)
output = "my output"
logger.log("hello") logger.log("world") logger.error("Ooops") logger.logBindingVariables() |
Example Result
Input name | Input value | Output name | Output value |
---|---|---|---|
LOG |
2017-06-02T15:58:33.547 [INFO] - hello 2017-06-02T15:58:33.615 [INFO] - world 2017-06-02T15:58:33.615 [ERROR] - Ooops 2017-06-02T15:58:33.638 [INFO] - VARIABLE: DATA_INPUT = {} 2017-06-02T15:58:33.642 [INFO] - VARIABLE: DATA_TYPES = null 2017-06-02T15:58:33.642 [INFO] - VARIABLE: output = my output |
Random Integer Between 0 and 1000 with Logging
Input name | Input type | Output name | Output type |
Script
import com.xtrac.script.library.tools.ScriptLogger
def logger = new ScriptLogger(binding)
Random random = new Random()
logger.log("my random integer: " + integer1) |
Example Result
Input name | Input value | Output name | Output value |
---|---|---|---|
Integer1 | 870 |
Adding Two Numbers
Input name | Input type | Output name | Output type |
---|---|---|---|
Integer1 | integer | integerResult | integer |
integer2 | integer |
Script
integerResult = integer1 + integer2 |
Example Result
Input name | Input value | Output name | Output value |
---|---|---|---|
integer1 | 3 | integerResult | 13 |
integer2 | 10 |
Adding Two Numbers Using JSON DATA_INPUT and Assigning to DATA_OUTPUT
Input name | Input type | Output name | Output type |
---|---|---|---|
variable1 | integer | result | integer |
variable 2 | integer |
Script
def slurper = new groovy.json.JsonSlurper()
def jsonVariables = slurper.parseText(DATA_INPUT)
def var1 = jsonVariables.variable1 def var2 = jsonVariables.variable2
jsonVariables.result = var1 + var2
DATA_OUTPUT = jsonVariables |
Float Arithmetic
Input name | Input type | Output name | Output type |
---|---|---|---|
float1 | Float | floatAdd | Float |
float2 | Float | floatSubtract | Float |
floatMultiply | Float | ||
floatDivide | Float |
Script
|
Example Result
Input name | Value | Output name | Value |
---|---|---|---|
amount1 | 1.2 | amount2 | 51.3 |
amount2 | 0 |
Float Arithmetic (as java.lang.BigDecimal with method calls)
Input name | Input type | Output name | Output type |
---|---|---|---|
float1 | Float | floatAdd | Float |
float2 | Float | floatSubtract | Float |
floatMultiply | Float | ||
floatDivide | Float |
Script
import java.math.*; import java.lang.*;
floatAdd = float1.add(float2) floatSubtract = float1.subtract(float2) floatMultiply = float1.multiply(float2) floatDivide = float1.divide(float2, 3, RoundingMode.CEILING) |
Example Result
Input name | Input type | Output name | Output type |
---|---|---|---|
float1 | 2.1 | floatAdd | 3.2 |
float2 | 1.1 | floatSubtract | 1 |
floatMultiply | 2.31 | ||
floatDivide | 1.91 |
Call the PM Login Resource and Return the XTRAC Session Token Using Apache HTTPClient
Input name | Input type | Output name | Output type |
---|---|---|---|
token | String |
Script
import groovy.json.JsonSlurper import org.apache.http.client.methods.HttpPost import org.apache.http.entity.StringEntity import org.apache.http.impl.client.HttpClientBuilder import org.apache.http.util.EntityUtils
def url = "https://pm-qa2a.xtrac.fmr.com/pxs-execution-rs/pxs/execution/login"
def client = HttpClientBuilder.create().build();
def request = new HttpPost(url); request.setHeader("Content-Type","application/json"); def stringEntity = new StringEntity('{"username":"SOMEUSER","password":"SOMEPASSWORD","orgId":"1007"}')
request.setEntity(stringEntity);
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity()
def slurper = new JsonSlurper() def result = slurper.parseText(jsonString)
token = result.xtracToken |
Start a Process Instance Using Apache HTTPClient
Input name | Input type | Output name | Output type |
---|---|---|---|
user | String | processInstanceId | String |
orgId | String | notificationId | String |
orgName | String | startStatus | String |
processDefId | String | fullURL | String |
token | String | jsonResponse | String |
Script
import org.apache.http.entity.StringEntity import org.apache.http.impl.client.HttpClientBuilder import org.apache.http.util.EntityUtils
import groovy.json.JsonSlurper import org.apache.http.client.methods.HttpGet
def url = "https://pm-qa2a.xtrac.fmr.com/pxs-execution-rs/pxs/execution/startprocess/" + processDefId def client = HttpClientBuilder.create().build();
fullUrl = url
def request = new HttpGet(url); request.setHeader("Content-Type", "application/xml"); request.setHeader("PXUSERNAME", user) request.setHeader("PXORGID", orgId) request.setHeader("PXORGNAME", orgName) request.setHeader("PXSESSIONTOKEN", token)
def response = client.execute(request)
statusCode = response.getStatusLine().statusCode
def jsonString = EntityUtils.toString(response.getEntity()
jsonResponse = jsonString
def slurper = new JsonSlurper() def result = slurper.parseText(jsonString)
processInstanceId = result.processInstanceId notificationId = result.startProcessStatus.notifUuid startStatus = result.startProcessStatus.startStatus |
Concatenate a Two Variables with a Method Call
Input name | Input type | Output name | Output type |
---|---|---|---|
variable1 | String | result | String |
variable2 | String | ||
separator | String |
Script
static concatenateValues(List<Object> values, String separator) { StringBuffer buffer = new StringBuffer() for(int i = 0; i < values.size(); i++) { def value = values.get(i) buffer.append(value) if(i != values.size() - 1) buffer.append(separator) } return buffer.toString() } def list = new java.util.ArrayList<String>(); list.add(variable1) list.add(variable2)
result = concatenateValues(list, separator) |
Example Result
Input name | Input value | Output name | Output value |
---|---|---|---|
variable1 | "Hello" | result | "Hello World" |
variable2 | "World" | ||
separator | " " |
Generate XML
Input name | Input type | Output name | Output type |
---|---|---|---|
output | String |
Script
import groovy.xml.*
def writer = new StringWriter() def html = new MarkupBuilder(writer) html.html { head { title 'Simple document' } body(id: 'main') { h1 'Building HTML the Groovy Way' p { mkp.yield 'Mixing text with ' strong 'bold' mkp.yield ' elements.' } a href: 'more.html', 'Read more...' } } output = writer.toString() |
Example Result
output |
<html> <head> <title>Simple document</title> </head> <body id='main'> <h1>Building HTML the Groovy Way</h1> <p>Mixing text with <strong>bold</strong> elements. </p> <a href='more.html'>Read more...</a> </body> </html> |
Generate JSON
Input name | Input type | Output name | Output type |
---|---|---|---|
firstName | String | output | String |
lastName | String |
Script
import groovy.json.JsonOutput
output = JsonOutput.toJson([first: firstName, last: lastName]) |
Example Result
Input name | Input type | Output name | Output type |
---|---|---|---|
firstName | "First" | output | {"first":"First","last":"Last"} |
lastName | "Last" |
Examples in Javascript
Adding Two Numbers
Input name | Input type | Output name | Output type |
---|---|---|---|
integer1 | integer | Integer3 | integer |
integer2 | integer |
Script
function script() { return integer1 + integer2; } integer3 = script() |
Example Result
Input name | Input type | Output name | Output type |
---|---|---|---|
integer1 | 1 | Integer3 | 3.0 |
integer2 | 2 |
Adding Two Numbers Using DATA_INPUT and DATA_OUTPUT Variables
Input name | Input type | Output name | Output type |
---|---|---|---|
variable1 | integer | result | integer |
variable2 | integer |
Script
function script() { var json = JSON.parse(DATA_INPUT) return json.variable1 + json.variable2; } var assignment = {} assignment = {"result": script()}
DATA_OUTPUT = assignment |
Advanced Code Snippets in Groovy
All snippets are provided as-is and are intended only as a starting point and for education. These snippets are not intended for production use without first testing them and applying error handling.
Parse JSON
static Object parseJSON(String stringToBeParsed) { def slurper = new JsonSlurper() return slurper.parseText(stringToBeParsed) } |
Parse XML
static GPathResult parseXML(String stringToBeParsed) { def slurper = new XmlSlurper() return slurper.parseText(stringToBeParsed) } |
Call PM Instances get to a JSESSIONID token
Description | Returns the necessary JSESSIONID token required to use Instances searching |
Input |
BaseUrl: url for the environment Username password |
Output | JSESSIONID string |
static Optional<String> loginToInstancesRS(String baseUrl, String username, String password) { def url = baseUrl + "/px-instances-rs/login"
def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/x-www-form-urlencoded") def stringEntity = new StringEntity("username=${username}&password=${password}")
request.setEntity(stringEntity)
def response = client.execute(request)
def headers = response.getHeaders("Set-Cookie") def header = headers.find { header -> header.value.contains("JSESSIONID") }
if(header != null) { def index = header.value.indexOf(";") return Optional.ofNullable(header.value.substring(0, index)) } else return Optional.empty() } |
Search Process Instances
Description | Searches instances |
Input |
BaseUrl: url for the environment JSESSIONID: token orgName instanceId States Name startDate endDate |
Output | String of the response |
static String searchProcessInstances(String baseUrl, String jsessionId, String orgName, Optional<String> instanceId, Optional<List<String>> states, Optional<String> name, Optional<ZonedDateTime> startDate, Optional<ZonedDateTime> endDate) { def search = "?nopage=true&search=" def searchParams = new ArrayList<String>() if(instanceId.present) { searchParams.add("instanceEntityId:" + instanceId.get()) } if(name.present) { searchParams.add("nameTxt*.*" + name.get()) } if(states.present) { searchParams.add("pqpisStatusTxt+[" + states.get().join(",") + "]") } if(startDate.present) { def year = startDate.get().getYear() def month = startDate.get().getMonthValue() def day = startDate.get().getDayOfMonth() def hour = startDate.get().getHour() def minute = startDate.get().getMinute() def second = startDate.get().getSecond() def pattern = "yyyy-MM-dd'T'hh:mm:ss.nnnZ" DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern) def newDate = ZonedDateTime.of(year, month, day, hour, minute, second, 0, startDate.get().getZone()) def startValue = newDate.format(formatter) searchParams.add("createTs>" + startValue) } if(endDate.present) { def year = endDate.get().getYear() def month = endDate.get().getMonthValue() def day = endDate.get().getDayOfMonth() def hour = endDate.get().getHour() def minute = endDate.get().getMinute() def second = endDate.get().getSecond() def pattern = "yyyy-MM-dd'T'hh:mm:ss.nnnZ" DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern) def newDate = ZonedDateTime.of(year, month, day, hour, minute, second, 0, endDate.get().getZone()) def startValue = newDate.format(formatter) searchParams.add("createTs<" + startValue) } def url = baseUrl + "/px-instances-rs/v1/instance/processes" if(searchParams.size() > 0) { String joined = searchParams.join(",") String encoded = URLEncoder.encode(joined, "UTF-8") url += search + encoded } def client = HttpClientBuilder.create().build() def request = new HttpGet(url) request.setHeader("Cookie", jsessionId) request.setHeader("PXORGNAME", orgName) def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity()) jsonString } |
Method to parse results of Instances search
Description |
Parses the results of the Instances search |
Input |
BaseUrl: url for the environment JSESSIONID: token orgName instanceId States Name startDate endDate |
Output | String of the response |
Support Classes | ProcessInstanceSearchEntry |
static List<ProcessInstanceSearchEntry> parseProcessInstanceSearchJson(String jsonResponse) { def slurper = new JsonSlurper() def slurpedResult = slurper.parseText(jsonResponse) List<ProcessInstanceSearchEntry> entriesList = new ArrayList<ProcessInstanceSearchEntry>() if(slurpedResult instanceof ArrayList) { slurpedResult.each { process -> assert process instanceof Map def entityId = process.get("defEntityId") def orgTxt = process.get("orgTxt") def nameTxt = process.get("nameTxt") def majorVersion = process.get("majorVersion") def minorVersion = process.get("minorVersion") def procDefBpmn = process.get("procDefBpmn") def modelBpmn = process.get("modelBpmn") def descTxt = process.get("descTxt") def instanceEntityId = process.get("instanceEntityId") def createTs = process.get("createTs") def workItemId = process.get("workItemId") def targetCompletionDate = process.get("targetCompletionDate") def workflowQueue = process.get("pqpriQueue") def statusTxt = process.get("pqpisStatusTxt") def parentId = process.get("parentId")
ProcessInstanceSearchEntry entry = new ProcessInstanceSearchEntry() entry.setDefEntityId(entityId) entry.setOrgTxt(orgTxt) entry.setNameTxt(nameTxt) entry.setMajorVersion(majorVersion) entry.setMinorVersion(minorVersion) entry.setProcDefBpmn(procDefBpmn) entry.setModelBpmn(modelBpmn) entry.setDescTxt(descTxt) entry.setInstanceEntityId(instanceEntityId) entry.setCreateTs(createTs) entry.setWorkItemId(workItemId) entry.setTargetCompletionDate(targetCompletionDate) entry.setWorkflowQueue(workflowQueue) entry.setStatusTxt(statusTxt) entry.setParentId(parentId)
entriesList.add(entry) } } entriesList } |
Method that creates a JSON Message to be used in message start or receive task
Description |
Creates the JSON payload to be used as a message |
Input |
|
Output | String of the response |
Support Classes |
ProcessInfo DataInfo Message Messages |
static String createMessageAsJSON(Optional<String> correlationIdValue, String namespaceValue, String dataTypeValue, Optional<String> processNameValue, Optional<Integer> majorValue, Optional<Integer> minorValue, Optional<String> processIdValue, String orgNameValue, Optional<Map<String, Object>> dataValue, String messageIdValue) }
ProcessInfo processInfo = new ProcessInfo() processInfo.setName(processNameValue.orElse(null)) processInfo.setOrgName(orgNameValue) processInfo.setId(processIdValue.orElse(null)) processInfo.setMajor(majorValue.orElse(null)) processInfo.setMinor(minorValue.orElse(null))
DataInfo dataInfo = new DataInfo() dataInfo.setDataType(dataTypeValue) dataInfo.setDataTypeNamespace(namespaceValue)
Message message = new Message() message.setMessageId(messageIdValue) message.setCorrelationId(correlationIdValue.orElse(null)) message.setDataInfo(dataInfo) message.setProcessInfo(processInfo) message.setData(dataValue.orElse(null))
Messages messages = new Messages() messages.getMessages().add(message)
JsonOutput.toJson(messages) } |
Method that logs in to Process and gets a Workflow token
Description |
Gets a workflow session token |
Input |
baseUrl Username Password orgId |
Output | LoginResult |
Support Classes |
LoginResult |
/** * Logs in to XTRAC Workflow * @param baseUrl server url * @param username pxUserName * @param password password * @param orgId orgId * @return XTRAC Workflow session token */ static LoginResult login(String baseUrl, String username, String password, String orgId) { def url = baseUrl + "/pxs-execution-rs/pxs/execution/login"
def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/json") def stringEntity = new StringEntity('{"username":"' + username + '","password":"' + password + '","orgId":"' + orgId + '"}')
request.setEntity(stringEntity)
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper() def result = slurper.parseText(jsonString)
def loginResult = new LoginResult() loginResult.setToken(result.xtracToken as String) loginResult.setOrgId(result.orgId as String) loginResult.setOrgName(result.org as String)
return loginResult } |
Login and return session token
import groovy.json.JsonSlurper import org.apache.http.client.methods.HttpPost import org.apache.http.entity.StringEntity import org.apache.http.impl.client.* import org.apache.http.util.EntityUtils
/** * Logs in to XTRAC Workflow * @param baseUrl server url * @param username pxUserName * @param password password * @param orgId orgId * @return XTRAC Workflow session token */ static String login(String baseUrl, String username, String password, String orgId) { def url = baseUrl + "/pxs-execution-rs/pxs/execution/login"
def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/json") def stringEntity = new StringEntity('{"username":"' + username + '","password":"' + password + '","orgId":"' + orgId + '"}')
request.setEntity(stringEntity)
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper() def result = slurper.parseText(jsonString)
return result.xtracToken } sessionToken = login("http://pm-devint1.xtrac.fmr.com", "pxuser", "exteaw0rkb5nch", "1007") |
Start an Instance
Description |
Starts a process instance |
Input |
|
Output | StartInstanceWebServiceResult |
Support Classes |
StartInstanceWebServiceResult PMWebServiceHeaders StartInstanceResult |
/** * * @param baseUrl * @param sessionToken * @param username * @param orgName * @param orgId * @param processDefinitionId * @return */ static StartInstanceWebServiceResult startInstance(String baseUrl, PMWebServiceHeaders headers, String processDefinitionId) { def url = "${baseUrl}/pxs-execution-rs/pxs/execution/startprocess/${processDefinitionId}" def client = HttpClientBuilder.create().build()
def request = new HttpGet(url) request.setHeader("Content-Type", "application/xml") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def response = client.execute(request)
def startInstanceWebServiceResult = new StartInstanceWebServiceResult()
startInstanceWebServiceResult.setStatusCode(response.getStatusLine().statusCode)
def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper() def result = slurper.parseText(jsonString)
StartInstanceResult startInstanceResult = new StartInstanceResult()
startInstanceResult.setProcessInstanceId(result.processInstanceId) startInstanceResult.setNotificationId(result.startProcessStatus.notifUuid) startInstanceWebServiceResult.setStartStatus(result.startProcessStatus.startStatus)
return startInstanceWebServiceResult } |
Message Start an Instance
Description |
Starts a process instance |
Input |
baseUrl |
Output | StartInstanceWebServiceResult |
Support Classes |
StartInstanceWebServiceResult PMWebServiceHeaders StartInstanceResult |
static StartInstanceWebServiceResult startInstanceWithMessage(String baseUrl, PMWebServiceHeaders headers, String jsonMessage) { def url = "${baseUrl}/pxs-execution-rs/pxs/execution/startprocess" def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/json") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def stringEntity = new StringEntity(jsonMessage)
request.setEntity(stringEntity)
def response = client.execute(request)
def startInstanceWebServiceResult = new StartInstanceWebServiceResult()
startInstanceWebServiceResult.setStatusCode(response.getStatusLine().statusCode)
def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper() def result = slurper.parseText(jsonString)
def statuses = result.getAt("messageStatuses")
statuses instanceof NodeChildren
statuses.each { status -> StartInstanceResult startInstanceResult = new StartInstanceResult() startInstanceResult.setProcessInstanceId(status.processInstanceId) startInstanceResult.setNotificationId(status.notifUuid) startInstanceResult.setStartStatus(status.startStatus) startInstanceResult.setCorrelationId(Optional.ofNullable(status.correlationId as String)) startInstanceResult.setErrored(Optional.ofNullable(status.error as Boolean))
startInstanceWebServiceResult.startInstanceResultList.add(startInstanceResult) } return startInstanceWebServiceResult } |
List Process Instances
Description |
Starts a process instance |
Input |
baseUrl |
Output | ListProcessInstancesResult |
Support Classes |
PMWebServiceHeaders ListProcessInstancesResult |
static ListProcessInstancesResult listProcessInstances(String baseUrl, PMWebServiceHeaders headers, int offset, int blocksize) { def url = "${baseUrl}/pxs-execution-query-rs/pxs/execution/listprocessinstances/${offset}/${blocksize}"
def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/xml") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper() def slurpedResponse = slurper.parseText(jsonString) def rows = slurpedResponse.rows def mappings = slurpedResponse.mappings def columns = slurpedResponse.columns def totalRows = slurpedResponse.pageInfo.totalRows
assert mappings != null assert mappings instanceof Map assert rows != null assert rows instanceof ArrayList assert columns != null assert columns instanceof ArrayList<HashMap>
def jeopardyStatusMappings = mappings.jeopardyStatus def stateMappings = mappings.state
def nameIndex = findIndexOfItemInColumns(columns, "name") def idIndex = findIndexOfItemInColumns(columns, "_id") def versionIndex = findIndexOfItemInColumns(columns, "version") def descriptionIndex = findIndexOfItemInColumns(columns, "desc") def jeopardyStatusIndex = findIndexOfItemInColumns(columns, "jeopardyStatus") def stateIndex = findIndexOfItemInColumns(columns, "state") def instanceStartIndex = findIndexOfItemInColumns(columns, "instanceStart") def completionDateIndex = findIndexOfItemInColumns(columns, "completionDate")
def instanceList = [] def instanceListEntry = new ProcessInstanceListEntry()
def instancesResult = new ListProcessInstancesResult() instancesResult.setTotalRows(totalRows)
for (row in rows) { assert row instanceof ArrayList def castRow = (ArrayList) row if (nameIndex >= 0) { def name = castRow.get(nameIndex) as String instanceListEntry.setName(name) } if (idIndex >= 0) { def id = castRow.get(idIndex) as String instanceListEntry.setId(id) } if (versionIndex >= 0) { def version = castRow.get(versionIndex) as String instanceListEntry.setVersion(version) } if (descriptionIndex >= 0) { def description = castRow.get(descriptionIndex) as String instanceListEntry.setDescription(description) } if (jeopardyStatusIndex >= 0) { def jeopardyStatus = castRow.get(jeopardyStatusIndex) as String def jeopardyStatusValue = findMappingValue(jeopardyStatusMappings, jeopardyStatus) instanceListEntry.setJeopardyStatus(jeopardyStatusValue) } if (stateIndex >= 0) { def state = castRow.get(stateIndex) as String def stateValue = findMappingValue(stateMappings, state) instanceListEntry.setState(stateValue) } if (instanceStartIndex >= 0) { def instanceStart = castRow.get(instanceStartIndex) as String instanceListEntry.setInstanceStart(instanceStart) } if (completionDateIndex >= 0) { def completionDate = castRow.get(completionDateIndex) as String instanceListEntry.setCompletionDate(completionDate) } instanceList.add(instanceListEntry) } instancesResult.setInstances(instanceList) return instancesResult } |
List User Tasks
Description |
Starts a process instance |
Input |
baseUrl |
Output | StartInstanceWebServiceResult |
Support Classes |
PMWebServiceHeaders UserTaskEntry |
static List<UserTaskEntry> listProcessInstanceUserTasks(String baseUrl, PMWebServiceHeaders headers, String processInstanceId) { def url = "${baseUrl}/pxs-execution-query-rs/pxs/execution/listprocessinstanceusertasks/${processInstanceId}"
def client = HttpClientBuilder.create().build()
def request = new HttpGet(url) request.setHeader("Content-Type", "application/xml") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new XmlParser() def slurpedResponse = slurper.parseText(jsonString)
def userTaskList = slurpedResponse["userTaskList"]
assert userTaskList instanceof NodeList
List<UserTaskEntry> userTaskEntryList = []
userTaskList.each { userTask -> def userTaskListEntry = userTask["userTaskListEntry"]
assert userTaskListEntry instanceof NodeList
userTaskListEntry.each { Node entry -> def userTaskEntry = new UserTaskEntry()
assert entry instanceof Node
def values = entry.value()
assert values instanceof NodeList
def workItemNumber = findXmlValue(values, "workItemNumber") def creationDate = findXmlValue(values, "creationDate") def definitionId = findXmlValue(values, "definitionId") def id = findXmlValue(values, "id") def name = findXmlValue(values, "name") def processName = findXmlValue(values, "processName") def stateNumber = findXmlValue(values, "stateNumber")
userTaskEntry.setWorkItemNumber(workItemNumber)
if (!creationDate.empty) userTaskEntry.setCreationDate(creationDate.toLong())
userTaskEntry.setDefinitionId(definitionId) userTaskEntry.setInstanceId(id) userTaskEntry.setName(name) userTaskEntry.setProcessName(processName) userTaskEntry.setStateNumber(stateNumber)
userTaskEntryList.add(userTaskEntry) } } return userTaskEntryList } |
private static String findXmlValue(NodeList values, String property) { def node = values.find { element -> element.name().equals(property) }
if (node == null) return ""
assert node instanceof Node def nodeValue = node.text()
if (nodeValue.empty) "" else nodeValue } |
private static String findMappingValue(ArrayList<HashMap> mappings, String name) { for (mapping in mappings) { if (mapping.get("key").equals(name)) return mapping.get("value") } return name } |
static private int findIndexOfItemInColumns(ArrayList<HashMap> columns, String name) { def index = 0 for (column in columns) { if (column.get("id").equals(name)) return index index += 1 } return -1 } |
static Optional<String> findDefinitionIdByNameAndVersion(List<ExecutableDefinitionEntry> definitions, String name, String version) { def result = Optional.empty() for (definition in definitions) { if (definition.name.equals(name) && definition.version.equals(version)) result = Optional.ofNullable(definition.id) } result } |
List Executable Definitions
Description |
Lists definitions that can be executed |
Input |
baseUrl |
Output | StartInstanceWebServiceResult |
Support Classes |
PMWebServiceHeaders ListExecutableDefinitionsResult ExecutableDefinitionEntry |
static ListExecutableDefinitionsResult listExecutableDefinitions(String baseUrl, PMWebServiceHeaders headers, int pageNumber, int resultCount) { def url = "${baseUrl}/pxs-execution-query-rs/pxs/execution/listexecutableprocesses/${pageNumber}/${resultCount}" def client = HttpClientBuilder.create().build() def request = new HttpPost(url) request.setHeader("Content-Type", "application/xml") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper()
def parsedText = slurper.parseText(jsonString)
def rows = parsedText.rows
assert rows != null
assert rows instanceof ArrayList
def totalRows = parsedText.pageInfo.totalRows
def executableList = []
def result = new ListExecutableDefinitionsResult()
result.setTotalRows(totalRows)
for (row in rows) { assert row instanceof ArrayList def castRow = row as ArrayList
assert castRow.size() >= 6
def id = castRow.get(0) def name = castRow.get(1) def version = castRow.get(2) def description = castRow.get(3) def deploymentDate = castRow.get(4) def appVersion = castRow.get(5)
def entry = new ExecutableDefinitionEntry() entry.setId(id as String) entry.setName(name as String) entry.setVersion(version as String) entry.setDescription(description as String) entry.setDeploymentDate(deploymentDate as String) entry.setAppVersion(appVersion as String)
executableList.add(entry) } result.setList(executableList)
return result } |
Get Deployed Model XML for a Process Instance
Description | Returns Model XML |
Input | baseUrl |
Output | Optional String of XML |
Support Classes | PMWebServiceHeaders |
static Optional<String> getModelDeploymentBundleXmlByProcessInstanceId(String baseUrl, PMWebServiceHeaders headers, String processInstanceId) { def url = "${baseUrl}/pxs-execution-query-rs/pxs/execution/processdefinitionxml/${processInstanceId}"
def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/xml") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def response = client.execute(request) def xmlResponse = EntityUtils.toString(response.getEntity())
int index = xmlResponse.indexOf("<modelDeploymentBundle>") int index2 = xmlResponse.indexOf("</modelDeploymentBundle>")
String bundle = null if (index > 0 && index2 > index) bundle = xmlResponse.substring(index, index2 + 25)
return Optional.ofNullable(bundle) } |
static Optional<String> getModelDeploymentBundleXmlByProcessDefinitionId(String baseUrl, PMWebServiceHeaders headers, String processDefinitionId) { def url = "${baseUrl}/pxs-execution-query-rs/pxs/execution/processdefinitionxml/def/${processDefinitionId}"
def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/xml") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def response = client.execute(request) def xmlResponse = EntityUtils.toString(response.getEntity())
int index = xmlResponse.indexOf("<modelDeploymentBundle>") int index2 = xmlResponse.indexOf("</modelDeploymentBundle>")
String bundle = null if (index > 0 && index2 > index) bundle = xmlResponse.substring(index, index2 + 25)
return Optional.ofNullable(bundle) } |
static PMBpmnModel parseModelDeploymentBundleXml(String xml) { def slurper = new XmlSlurper() def slurpedResponse = slurper.parseText(xml)
def metadata = slurpedResponse.getAt("modelMetadata") def configuration = slurpedResponse.getAt("modelConfig") def modelBundle = slurpedResponse.getAt("modelBundle")
assert modelBundle instanceof NodeChildren assert modelBundle.size() == 1
def definitionsList = modelBundle.getAt("definitions") assert definitionsList instanceof NodeChildren assert definitionsList.size() == 1
def definitions = definitionsList[0] assert definitions instanceof NodeChild
assert metadata instanceof NodeChildren assert configuration instanceof NodeChildren
def pmBpmnModel = new PMBpmnModel() def name = metadata.getAt("name").toString() def modelDefinitionId = metadata.getAt("modelId").toString() def appVersion = metadata.getAt("appVersion").toString() def reusable = metadata.getAt("globalProcess") as boolean def deploymentDateList = metadata.getAt("deploymentDate")
assert deploymentDateList instanceof NodeChildren assert deploymentDateList.size() == 1 def deploymentDateChild = deploymentDateList[0] assert deploymentDateChild instanceof NodeChild def deploymentDate = deploymentDateChild.text() as Long
def versionList = metadata.getAt("version")
assert versionList instanceof NodeChildren assert versionList.size() == 1
def version = versionList[0]
assert version instanceof NodeChild
def major = version.attributes().get("major") as int def minor = version.attributes().get("minor") as int
pmBpmnModel.setName(name) pmBpmnModel.setModelDefinitionId(modelDefinitionId) pmBpmnModel.setIsReusable(reusable) pmBpmnModel.setDeploymentDate(deploymentDate) pmBpmnModel.setMajorVersion(major) pmBpmnModel.setMinorVersion(minor) pmBpmnModel.setDeployedWithAppVersion(appVersion)
def processNode = definitions.getAt("process")
assert processNode instanceof NodeChildren assert processNode.size() >= 1
def process = processNode[0]
assert process instanceof NodeChild
def processChildren = process.children().list()
def startEventsList = processChildren.findAll { entry -> assert entry instanceof NodeChild entry.name().equals("startEvent") } startEventsList.each { entry -> assert entry instanceof NodeChild def startEventName = entry.attributes().get("name") as String def messageEventDefinition = entry.getAt("messageEventDefinition")
def startEvent = new PMBpmnStartEvent() startEvent.setName(startEventName)
if (messageEventDefinition != null) { assert messageEventDefinition instanceof NodeChildren assert messageEventDefinition.size() >= 1
def messageDefinition = messageEventDefinition[0]
assert messageDefinition instanceof NodeChild def messageRef = messageDefinition.attributes().get("messageRef") as String
assert messageRef != null && !messageRef.isEmpty()
def split = messageRef.split(":")
assert split.size() == 2
startEvent.setMessageId(Optional.ofNullable(split[1])) } pmBpmnModel.addStartEvent(startEvent) } def receiveTaskList = processChildren.findAll { entry -> assert entry instanceof NodeChild entry.name().equals("receiveTask") } receiveTaskList.each { entry -> assert entry instanceof NodeChild def receiveTaskName = entry.attributes().get("name") as String def messageEventDefinition = entry.getAt("messageEventDefinition")
def receiveTask = new PMBpmnReceiveTask() receiveTask.setName(receiveTaskName)
if (messageEventDefinition != null) { assert messageEventDefinition instanceof NodeChildren assert messageEventDefinition.size() == 1 def messageDefinition = messageEventDefinition[0] assert messageDefinition instanceof NodeChild def messageRef = messageDefinition.attributes().get("messageRef") as String assert messageRef != null && !messageRef.isEmpty() def split = messageRef.split(":") assert split.size() == 2 receiveTask.setMessageId(Optional.ofNullable(split[1])) } pmBpmnModel.addReceiveTask(receiveTask) } pmBpmnModel } |
Get Notification
Descriptioin | Returns a notification |
Input | baseUrl |
Output | Optional String XML |
Support Classes | NotificationResult |
static NotificationResult getNotification(String baseUrl, String notificationId) { def url = "${baseUrl}/pxs-events-rs/v1/notifications/${notificationId}"
def client = HttpClientBuilder.create().build()
def request = new HttpGet(url) request.setHeader("Content-Type", "application/json")
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper() def parsed = slurper.parseText(jsonString)
def result = new NotificationResult() result.setCommandName(parsed.commandName as String) result.setPhase(parsed.phase as String) result.setCompletePercent(parsed.completePct as int) result.setEndMillis(parsed.endMillis as Long) result.setStartMillis(parsed.startMillis as Long) result.setMessage(parsed.message as String) result.setNotificationStatus(parsed.notificationStatus as String)
return result } |
static List<ReceiveTaskMessageEntry> sendMessageToReceiveTaskAsJSON(String baseUrl, PMWebServiceHeaders headers, String jsonMessage) { def url = "${baseUrl}/pxs-execution-rs/messages/"
def client = HttpClientBuilder.create().build()
def request = new HttpPost(url) request.setHeader("Content-Type", "application/json") request.setHeader("PXUSERNAME", headers.pxUserName) request.setHeader("PXORGID", headers.orgId) request.setHeader("PXORGNAME", headers.orgName) request.setHeader("PXSESSIONTOKEN", headers.sessionToken)
def stringEntity = new StringEntity(jsonMessage)
request.setEntity(stringEntity)
def response = client.execute(request) def jsonString = EntityUtils.toString(response.getEntity())
def slurper = new JsonSlurper() def parsed = slurper.parseText(jsonString)
def messageStatuses = parsed.messageStatuses
assert messageStatuses != null assert messageStatuses instanceof ArrayList<Map>
def messageStatusesList = messageStatuses as ArrayList<Map>
def resultList = []
for (entry in messageStatusesList) { def processInstanceId = entry.get("processInstanceId") def correlationId = entry.get("correlationId") def notificationId = entry.get("notifUuid") def statusMessage = entry.get("statusMessage") def error = entry.get("error")
def messageEntry = new ReceiveTaskMessageEntry() messageEntry.setProcessInstanceId(processInstanceId as String) messageEntry.setCorrelationId(correlationId as String) messageEntry.setError(error as boolean) messageEntry.setStatusMessage(statusMessage as String) messageEntry.setNotificationId(notificationId as String)
resultList.add(messageEntry) } return resultList } |
Supporting Classes for Code Snippets
NotificationResult
class NotificationResult { private String commandName private String phase private Long startMillis private Long endMillis private int completePercent private String message private String notificationStatus
String getCommandName() { return commandName }
void setCommandName(String commandName) { this.commandName = commandName }
String getPhase() { return phase }
void setPhase(String phase) { this.phase = phase }
Long getStartMillis() { return startMillis }
void setStartMillis(Long startMillis) { this.startMillis = startMillis }
Long getEndMillis() { return endMillis }
void setEndMillis(Long endMillis) { this.endMillis = endMillis }
int getCompletePercent() { return completePercent }
void setCompletePercent(int completePercent) { this.completePercent = completePercent }
String getMessage() { return message }
void setMessage(String message) { this.message = message }
String getNotificationStatus() { return notificationStatus }
void setNotificationStatus(String notificationStatus) { this.notificationStatus = notificationStatus } } |
LoginResult
class LoginResult { private String token private String orgId private String orgName
String getOrgName() { return orgName }
void setOrgName(String orgName) { this.orgName = orgName }
String getToken() { return token }
void setToken(String token) { this.token = token }
String getOrgId() { return orgId }
void setOrgId(String orgId) { this.orgId = orgId } } |
ProcessInstanceSearchEntry
class ProcessInstanceSearchEntry { String defEntityId String orgTxt String nameTxt Integer majorVersion Integer minorVersion String procDefBpmn String modelBpmn String descTxt String instanceEntityId String createTs String workItemId String targetCompletionDate String workflowQueue String statusTxt String parentId } |
StartInstanceWebServiceResult
class StartInstanceWebServiceResult { int statusCode
String startStatus
List<StartInstanceResult> startInstanceResultList = new ArrayList<StartInstanceResult>() } |
StartInstanceResult
class StartInstanceResult { String processInstanceId String notificationId Optional<String> correlationId = Optional.empty() Optional<Boolean> errored = Optional.empty() String startStatus } |
PMWebServiceHeaders
class PMWebServiceHeaders { private String sessionToken private String pxUserName private String orgName private String orgId private String loggingLevel
String getSessionToken() { return sessionToken }
void setSessionToken(String sessionToken) { this.sessionToken = sessionToken }
String getPxUserName() { return pxUserName }
void setPxUserName(String username) { this.pxUserName = username }
String getOrgName() { return orgName }
void setOrgName(String orgName) { this.orgName = orgName }
String getOrgId() { return orgId }
void setOrgId(String orgId) { this.orgId = orgId }
String getLoggingLevel() { return loggingLevel }
void setLoggingLevel(String loggingLevel) { this.loggingLevel = loggingLevel } } |
Message
class Message { String correlationId String messageId Object data DataInfo dataInfo ProcessInfo processInfo } |
Messages
class Messages { List<Message> messages = new ArrayList<Message>() } |
ProcessInfo
class ProcessInfo { String name Integer major Integer minor String id String orgName } |
DataInfo
class DataInfo { String dataTypeNamespace String dataType } |
ProcessInstanceListEntry
class ProcessInstanceListEntry { private String name private String id private String version private String description private String jeopardyStatus private String state private String instanceStart private String completionDate
String getName() { return name }
void setName(String name) { this.name = name }
String getId() { return id }
void setId(String id) { this.id = id }
String getVersion() { return version }
void setVersion(String version) { this.version = version }
String getDescription() { return description }
void setDescription(String description) { this.description = description }
String getJeopardyStatus() { return jeopardyStatus }
void setJeopardyStatus(String jeopardyStatus) { this.jeopardyStatus = jeopardyStatus }
String getState() { return state }
void setState(String state) { this.state = state }
String getInstanceStart() { return instanceStart }
void setInstanceStart(String instanceStart) { this.instanceStart = instanceStart }
String getCompletionDate() { return completionDate }
void setCompletionDate(String completionDate) { this.completionDate = completionDate } } |
UserTaskEntry
class UserTaskEntry { private Long creationDate private String definitionId private String instanceId private String name private String processName private String workItemNumber private String stateNumber
Long getCreationDate() { return creationDate }
void setCreationDate(Long creationDate) { this.creationDate = creationDate }
String getDefinitionId() { return definitionId }
void setDefinitionId(String definitionId) { this.definitionId = definitionId }
String getInstanceId() { return instanceId }
void setInstanceId(String instanceId) { this.instanceId = instanceId }
String getName() { return name }
void setName(String name) { this.name = name }
String getProcessName() { return processName }
void setProcessName(String processName) { this.processName = processName }
String getWorkItemNumber() { return workItemNumber }
void setWorkItemNumber(String workItemNumber) { this.workItemNumber = workItemNumber }
String getStateNumber() { return stateNumber }
void setStateNumber(String stateNumber) { this.stateNumber = stateNumber } } |
ListProcessInstancesResult
class ListProcessInstancesResult { private Long totalRows private List<ProcessInstanceListEntry> instances
Long getTotalRows() { return totalRows }
void setTotalRows(Long totalRows) { this.totalRows = totalRows }
List<ProcessInstanceListEntry> getInstances() { return instances }
void setInstances(List<ProcessInstanceListEntry> instances) { this.instances = instances } } |
ListExecutableDefinitionsResult
class ListExecutableDefinitionsResult { private Long totalRows private List<ExecutableDefinitionEntry> list
Long getTotalRows() { return totalRows }
void setTotalRows(Long totalRows) { this.totalRows = totalRows }
List<ExecutableDefinitionEntry> getList() { return list }
void setList(List<ExecutableDefinitionEntry> list) { this.list = list } } |
ExecutableDefinitionEntry
class ExecutableDefinitionEntry { private String id private String name private String version private String description private String deploymentDate private String appVersion
String getId() { return id }
void setId(String id) { this.id = id }
String getName() { return name }
void setName(String name) { this.name = name }
String getVersion() { return version }
void setVersion(String version) { this.version = version }
String getDescription() { return description }
void setDescription(String description) { this.description = description }
String getDeploymentDate() { return deploymentDate }
void setDeploymentDate(String deploymentDate) { this.deploymentDate = deploymentDate }
String getAppVersion() { return appVersion }
void setAppVersion(String appVersion) { this.appVersion = appVersion } } |
XTRAC Community |
![]() |