Skip to content

Transaction

Purpose

XML transaction manipulation and processing.

Note

TI stands for TransactionInfo and is the most commonly used business transaction manipulated by Platform 6. For backward compatibility a TransactionInfo transaction has a dataPartition (TRANSACTION) and a dataType (TransactionInfo).

Methods

Binding name: p6.transaction


buildPK

Build a transaction item primary key (TransactionPK) from it’s constituent parts.

Syntax

TransactionPK p6.transaction.buildPK(String dataType, String... itemIds)

The dataType is a free text string without constraint. If you create a transaction from a bundled script, it is important to use as a prefix the application key (ie. myApp.TransactionInfo). This way you will be able to use specific filters inside views and also for the transaction tag mechanism.

Example
println p6.transaction.buildPK("TransactionInfo", "123", "456")

buildTIPK

Build a transaction item primary key (TransactionPK) for a TransactionInfo using supplied itemIds.

Syntax

TransactionPK p6.transaction.buildTIPK(String... itemIds)
Example
println p6.transaction.buildTIPK("123", "456")

getUsingPipelineRequest

Get the XML transaction as a String using the primary key values in the current pipeline.

Syntax

String p6.transaction.getUsingPipelineRequest()

Tip

Pipeline keys used are:

  • platform6.request.dataType
  • platform6.request.ids
Example
println p6.transaction.getUsingPipelineRequest()

getPKUsingPipelineRequest

Get the primary key of the transaction using the primary key values in the current pipeline.

Syntax

TransactionPK p6.transaction.getPKUsingPipelineRequest()
Example
println p6.transaction.getPKUsingPipelineRequest()

get

Get the XML transaction as a String using the supplied item primary key.

Syntax

String p6.transaction.get(TransactionPK pk)
Example
def pk = p6.transaction.buildTIPK("123", "456")
def transaction = p6.transaction.get(pk)

Get the itemLinks of a transaction.

Syntax

List<ItemLink> p6.transaction.getItemLinks(TransactionPK pk, String viewId)
Definition: ItemLink

The ItemLink contains the following fields:

  • ids: array of ids
  • view: the view id
  • type
Example
def pk = p6.transaction.buildTIPK("123", "456")
def links = p6.transaction.getItemLinks(pk, "view")

exists

Return the XML transaction as a String using the supplied item primary key or null if not found.

Syntax

String p6.transaction.exists(TransactionPK pk)
Example
def pk = p6.transaction.buildTIPK("123", "456")
println p6.transaction.exists(pk)

remove

Remove the XML transaction and return it’s content as a String using the supplied item primary key or null if not found.

Syntax

String p6.transaction.remove(TransactionPK pk)
Example
def pk = p6.transaction.buildTIPK("123", "456")
p6.transaction.remove(pk)

put

Stores the supplied XML transaction using the supplied item primary key.

Syntax

TransactionPK p6.transaction.put(String xml, TransactionPK pk)
Example
def pk = p6.transaction.buildTIPK("123", "456")
p6.transaction.put("<xml></xml>", pk)

putTI

Stores the supplied XML as a TransactionInfo using supplied itemIds.

Syntax

TransactionPK p6.transaction.putTI(String xml, String... itemIds)
Example
p6.transaction.putTI("<xml></xml>", "123", "456")

saveTI

Projects the supplied XML (validates against a data model and stores) as a TransactionInfo using supplied itemIds.

Syntax

TransactionPK p6.transaction.saveTI(String xml, String... itemIds)
Example
p6.transaction.saveTI("<xml></xml>", "123", "456")

save

Projects the supplied XML (using the supplied data model for content validation) using the supplied item primary key.

Syntax

TransactionPK p6.transaction.save(String xml, String dataModelName, TransactionPK pk)
Example
def pk = p6.transaction.buildTIPK("123", "456")
p6.transaction.save("<xml></xml>", "TransactionInfo", pk)

saveAndRouteTI

Projects the supplied XML as a TransactionInfo using supplied itemIds and sends as a camel Exchange to the given Platform 6 routing endpoint.

Syntax

TransactionPK p6.transaction.saveAndRouteTI(String xml, String endpointUrl, String... itemIds)
Example
p6.transaction.saveAndRouteTI("<xml></xml>", "direct:p6router.1", "123", "456")

saveAndRoute

Projects the supplied XML (using the supplied data model for content validation) using the supplied item primary key and sends as a camel Exchange to the given Platform 6 routing endpoint.

Syntax

TransactionPK p6.transaction.saveAndRoute(
    String xml,
    String dataModelName,
    TransactionPK pk,
    String endpointUrl
)
Example
def pk = p6.transaction.buildTIPK("123", "456")
p6.transaction.saveAndRoute("<xml></xml>", "TransactionInfo", pk, "direct:p6router.1")

route

Sends the supplied item primary key as a camel Exchange to the given Platform 6 routing endpoint.

Syntax

TransactionPK p6.transaction.route(TransactionPK pk, String endpointUrl)
Example
def pk = p6.transaction.buildTIPK("123", "456")
p6.transaction.route(pk, "direct:p6router.1")

validate

Validate the supplied XML against the schema found at the supplied URI.

Syntax

boolean p6.transaction.validate(String xml, String schemaUri)

Tip

Any errors are added to the pipeline as entry errors encoded as a String.

Example
println p6.transaction.validate("<xml></xml>", "at.ebinterface:invoice:3.0")

Local schema

println p6.transaction.validate(miXml, "p6file://${P6_DATA}/resources/schemas/pidx_v1_0/schema.xsd")


validate (with provider)

Validate the supplied XML using the given validation provider and provider parameters

Syntax

boolean p6.transaction.validate(
    TransactionValidationProvider provider,
    String xml,
    String... providerParams
)
TransactionValidationProvider definition

Validation providers supported by Platform 6 in this release:

p6.transactionprovider.PHIVE

  • param[0]: VESID (mandatory)
  • param[1]: Locale Language (optional)
  • param[2]: Locale Country (optional)

Tip

Any errors are added to the pipeline as entry errors encoded as a String.

Example
println p6.transaction.validate(p6.transactionprovider.PHIVE, "<xml></xml>", "at.ebinterface:invoice:3.0", "en", "US")

updateFlags

Update the flags inside a transaction. Set a flag to true to add the flag and false to remove the flag.

Syntax

String p6.transaction.updateFlags(TransactionPK pk, String viewId, Map<String, Boolean> flags)

The transaction’s flags are returned by the method.

Example

Unmark as unread

def pk = p6.transaction.buildTIPK("123", "456")
p6.transaction.updateFlags(pk, "viewName", ["eunread": false])

Mark as visible and unread

def pk = p6.transaction.buildTIPK("123", "456")
p6.transaction.updateFlags(pk, "viewName", ["eunread": true, "aavisible": true])


getAsXML

Returns the parsed XML of the transaction.

Syntax

GPathResult p6.transaction.getAsXML(TransactionPK pk)
Example
def pk = p6.transaction.buildTIPK("123", "456")
def xml = p6.transaction.getAsXML(pk)

getTIAsXML

Returns the parsed XML of the TransactionInfo transaction based on the itemIds.

Syntax

GPathResult p6.transaction.getTIAsXML(String... itemsIds)
Example
def xml = p6.transaction.getAsXML("123", "456")