Pipeline
Purpose¶
The execution pipeline map is used to pass variables between services. The pipeline allows variables to be passed to scripts and services as well as allowing multiple return values. Values are typically Strings however there are specialisations for XML processing and Platform 6 message item keys.
Methods¶
Binding name: pipeline
- String get( String variableName ): get the value of a named pipeline variable as a String.
Note
If the content-type of the variable is not suitable for conversion to a String, it will be represented as a ‘hashed unknown’ including it’s content-type: ###Unknown:[content-type]###
- byte[] getBytes( String variableName ): get the value of a named pipeline variable as a byte array.
- put( String variableName, String value ): add or replace the String value of a named pipeline variable. Charset defaults to: text/plain; charset=”utf-8”.
- put( String variableName, String value, String charset): add or replace the String value of a named pipeline variable using the given charset.
- String remove( String variableName ): remove the value of a named pipeline variable. The value of the removed variable is returned.
- String[] variables(): returns a collection of all pipeline variable names.
- Map
toStringMap() : returns a Map of all pipeline variables expressed as Strings
None String Variables
- GPathResult getXml( String variableName ): get the value of a named pipeline variable as a GPathResult (assumed the variable is an Xml String)
- GPathResult getXml( String variableName, boolean validating, boolean namespaceAware, boolean allowDocTypeDeclaration): extended variant of the above method allowing greater control over the XmlSlurper
Note
GPath is a path expression language integrated into Groovy which allows parts of nested structured data to be identified. In this sense, it has similar aims and scope as XPath does for XML. The two main places where you use GPath expressions is when dealing with nested POJOs or when dealing with XML.
- org.w3c.dom.Document getDom( String variableName ): get the value of a named pipeline variable as a W3C DOM(internal content type is ‘application/b2box.dom’)
- put( String variableName, org.w3c.dom.Document value ): add or replace the W3C DOM value of a named pipeline variable. Charset defaults to: application/b2box.dom
- ItemPK getPk( String variableName ): get the named ItemPK object (internal content type is ‘application/b2box.itempk’)
Examples¶
pipeline.put 'hello', 'world' def var = pipeline.get 'hello' println 'Result is: ' + var pipeline.remove 'hello' for ( i in 0..9 ) { pipeline.put 'var'+i, 'value'+i } pipeline.variables().each() { println "${it}" }