Runtime components : Core components : Operations : Tasks : Operation policy management
  
Operation policy management
Policy Management handles the policy of transaction scope by inserting an opStep.
1 If you want to use the transaction scope policy, you need:
Implement AbstractPolicyOperationStep class. UDTT provides an abstract opStep - AbstractPolicyOperationStep - to handle the policy in the transaction level. Execute method in AbstractPolicyOperationStep provides a default implementation to use rule service to connect to the rule engine, and you can extend it based on your need. And then, implement two abstract methods:
getInputParameter, to construct the input parameters for execute method using the data from the operation context or getting from data store;
processResult, to parse the result returned from rule engine; The outcome of processResult method is used to control the state transition between opSteps.
Configure the opStep. After you implement the AbstractPolicyOperationStep, you need to configure the related operation to use it. The format of configuration as following:
<Op_Payment>
<operation context="paymentCtx" id="paymentOp"
implClass="com.ibm.btt.sample.operation.PaymentOperation">
<refFormat name="csReplyFormat" refId="paymentSecondRecFmt"/>
<opStep id="paymentPolicyStep"
refRuleService="checkPaymentAmountRule" on0Do="return" on1Do="return"/>
</operation>
</Op_Payment>
The paymentPolicyStep is the id of the opStep, which has implemented the AbstractPolicyOperationStep.
The ruleService value is the id of rule service.
2 If the input and output are all bean, you can use the following way to use the transaction scope policy:
Use the PolicyOperationStep class. The toolkit provides a concrete opStep--- PolicyOperationStep, which can help you to use the input and output property to generate the input/output parameters of the rule service, and use the result property for the state transition.
Configure the opStep The format of operation configuration as following:
<op_Account_Transfer>
  <operation context="accountTransferCtx" id="accountTransferOp"
implClass="com.ibm.btt.sample.operation.transferOperation">
  <refFormat name="csReplyFormat" refId="transferSecondRecFmt"/>
  <opStep id="beanPolicyStep"
refRuleService="checkTransferAmountRule" on0Do="Step1" on1Do="Step2"
    input="." output="bean3,bean2" result="TrxReplyCode"/>
  <opStep id="Step1" on0Do="return"/> <opStep
id="Step2" on0Do="return"/> </operation>
</op_Account_Transfer>
The beanPolicyStep is the id of the opStep, whose implementation is PolicyOperationStep.
The ruleService value is the id of rule service.
Input is the key list of input to the rule service.
Output is the key list of output from the rule service.
Result is the field as the result of opStep; if result is “true”, opStep will transform to on0Do, or to on1Do.
Notes
Input and output must be bean;
beanPolicyStep support “.” as input and output, which is used when top level of context is beancoll, and you want to use it as input and output. The class name of beancoll is used as the key.
When “.” is used as input or output, no other fields can be used.
Go up to
Tasks