Skip to content

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: p6.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.
  • TypedContent put( String variableName, String value ): add or replace the String value of a named pipeline variable. Charset defaults to: text/plain; charset=”utf-8”.
  • TypedContent put( String variableName, String value, String charset): add or replace the String value of a named pipeline variable using the given charset.
  • TypedContent put( String variableName, byte[] bytes ): add or replace the byte[] value of a named pipeline variable.
  • 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/p6core.dom’)

  • TypedContent put( String variableName, org.w3c.dom.Document value ): add or replace the W3C DOM value of a named pipeline variable. Charset defaults to: application/p6core.dom

  • BaseItemPK getPk( String variableName ): get the named BaseItemPK object (internal content type is ‘application/p6core.itempk’)

  • TypedContent putPk( String variableName, BaseItemPK baseItemPk ): add the named BaseItemPK object (internal content type is ‘application/p6core.itempk’)

  • TypedContent put( String variableName, ItemPK itemPk ): add or replace the ItemPK value of a named pipeline variable. Charset defaults to: application/p6core.itempk

  • TypedContent put( String variableName, Object value, String charset): add or replace the Object value of a named pipeline variable using the given charset.

Examples

p6.pipeline.put 'hello', 'world'
def var = p6.pipeline.get 'hello'
println 'Result is: ' + var
p6.pipeline.remove 'hello'

for ( i in 0..9 ) {
    p6.pipeline.put 'var'+i, 'value'+i
}

p6.pipeline.variables().each() {
    println "${it}"
}
def itemPK = p6.transaction.buildTIPK("Invoice_PSI387354_041968f8-c806-405c-a33c-6039d1273bb2")
p6.pipeline.put('itemPK', itemPK, 'application/b2box.itempk')
def pk1 = p6.pipeline.getPk('itemPK')

println pk1

def itemPK2 = p6.transaction.buildTIPK("Invoice_PSI387354_041968f8-c806-405c-a33c-6039d1273bb2")
p6.pipeline.putPk('itemPK', itemPK2)
def pk2 = p6.pipeline.getPk('itemPK')

println pk2

p6.pipeline.putPk('itemPK', p6.transaction.buildTIPK("Invoice_PSI387354_041968f8-c806-405c-a33c-6039d1273bb2"))
def pk3 = p6.pipeline.getPk('itemPK')

println pk3