Transaction
Purpose¶
XML transaction manipulation and processing.
Note
MI stands for MessageInfo and is the most commonly used business transaction manipulated by Platform 6. For backward compatibility a MessageInfo transaction has a dataClusterName (B2BOX) and a concept (MessageInfo).
Methods¶
Binding name: transaction
Method: ItemPK buildPK(String dataClusterName, String concept, String... itemIds)
Build a transaction item primary key (ItemPK
) from it’s constituent parts.
Method: ItemPK buildMIPK(String... itemIds)
Build a transaction item primary key (ItemPK
) for a MessageInfo using supplied itemIds
.
Method: String getSerialForm(ItemPK pk)
Use JAXB to serialize the POJO item containing the business transaction using the supplied item primary key.
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.cluster
- platform6.request.concept
- platform6.request.ids
Method: ItemPK getPKUsingPipelineRequest()
Get the primary key of the transaction using the primary key values in the current pipeline.
Method: String get(ItemPK pk)
Get the XML transaction as a String using the supplied item primary key.
Method: String exists(ItemPK pk)
Return the XML transaction as a String using the supplied item primary key or null if not found.
Method: String remove(ItemPK 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: ItemPK put(String xml, ItemPK pk)
Stores the supplied XML transaction using the supplied item primary key.
Method: ItemPK putMI(String xml, String... itemIds)
Stores the supplied XML as a MessageInfo using supplied itemIds
.
Method: ItemPK projectMI(String xml, String... itemIds)
Projects the supplied XML (validates against a data model and stores) as a MessageInfo using supplied itemIds
.
Method: ItemPK project(String xml, String dataModelName, ItemPK pk)
Projects the supplied XML (using the supplied data model for content validation) using the supplied item primary key.
Method: ItemPK projectAndRouteMI(String xml, String... itemIds)
Projects the supplied XML as a MessageInfo using supplied itemIds
and notifies the Platform 6 routing engine to route the transaction.
Method: ItemPK p6projectAndRouteMI(String xml, String endpointUrl, String... itemIds)
Projects the supplied XML as a MessageInfo using supplied itemIds
and sends as a camel Exchange to the given Platform 6 routing endpoint.
Method: ItemPK projectAndRoute(String xml, String dataModelName, ItemPK pk)
Projects the supplied XML (using the supplied data model for content validation) using the supplied item primary key and notifies the Platform 6 routing engine to route the transaction.
Method: ItemPK p6projectAndRoute(String xml, String dataModelName, ItemPK 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: ItemPK route(ItemPK pk)
Notifies the Platform 6 routing engine to route the transaction using the supplied item primary key.
Method: ItemPK p6route(ItemPK 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 ipk = transaction.buildPK("B2BOX", "MessageInfo", "123", "456") println ipk ipk = transaction.buildMIPK("Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210") println ipk def serialBean = transaction.getSerialForm( ipk ) println serialBean def miXml = transaction.get(ipk) println miXml def xml = transaction.exists(ipk) println xml ipk = transaction.buildMIPK("Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy") xml = transaction.exists(ipk) println xml ipk = transaction.put("<xml></xml>", ipk) println ipk ipk = transaction.remove(ipk) println ipk ipk = transaction.putMI("<xml></xml>", "Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy") println ipk ipk = transaction.projectMI(miXml, "Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy") println ipk ipk = transaction.project(miXml, "MessageInfo", ipk) println ipk ipk = transaction.projectAndRoute(miXml, "MessageInfo", ipk) println ipk def valid = transaction.validate(miXml, "file://${b2box.data}/resources/schemas/pidx_v1_0/PIDX-Invoice-2002-02-14-V1-0.xsd") println valid