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


Method: TransactionPK buildPK(String dataType, String... itemIds)

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


Method: TransactionPK buildTIPK(String... itemIds)

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


Method: String getUsingPipelineRequest()

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

Pipeline keys used are: - platform6.request.dataType - platform6.request.ids


Method: TransactionPK getPKUsingPipelineRequest()

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


Method: String get(TransactionPK pk)

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


Method: String exists(TransactionPK pk)

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


Method: String remove(TransactionPK pk)

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


Method: TransactionPK put(String xml, TransactionPK pk)

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


Method: TransactionPK putTI(String xml, String... itemIds)

Stores the supplied XML as a TransactionInfo using supplied itemIds.


Method: TransactionPK saveTI(String xml, String... itemIds)

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


Method: TransactionPK save(String xml, String dataModelName, TransactionPK pk)

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


Method: TransactionPK saveAndRouteTI(String xml, String endpointUrl, String... itemIds)

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


Method: TransactionPK saveAndRoute(String xml, String dataModelName, TransactionPK pk, String endpointUrl)

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.


Method: TransactionPK route(TransactionPK pk, String endpointUrl)

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


Method: boolean validate(String xml, String schemaUri)

Validate the supplied XML against the schema found at the supplied URI. Any errors are added to the pipeline as entry errors encoded as a String.

Examples

def pk = p6.transaction.buildPK("TransactionInfo", "123", "456")
println pk

pk = p6.transaction.buildTIPK("Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210")
println pk

def serialBean = p6.transaction.getSerialForm( pk )
println serialBean

def miXml = p6.transaction.get(pk)
println miXml

def xml = p6.transaction.exists(pk)
println xml

pk = p6.transaction.buildTIPK("Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy")
xml = p6.transaction.exists(pk)
println xml

pk = p6.transaction.put("<xml></xml>", pk)
println pk

pk = p6.transaction.remove(pk)
println pk

pk = p6.transaction.putTI("<xml></xml>", "Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy")
println pk

pk = p6.transaction.saveTI(miXml, "Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy")
println pk

pk = p6.transaction.save(miXml, "TransactionInfo", pk)
println pk

pk = p6.transaction.saveAndRoute(miXml, "TransactionInfo", pk, "direct:p6router.1")
println pk

def valid = p6.transaction.validate(miXml, "file://${P6_DATA}/resources/schemas/pidx_v1_0/PIDX-Invoice-2002-02-14-V1-0.xsd")
println valid