JBoss Community

Created workflow definition programmatically - How to assign variables to switch on SplitNode?

created by pras mn in jBPM - View the full discussion

I am creating a workflow definition programmatically and am able to invoke the workflow and execute any action nodes and work item nodes ( which in turn calls a WorkItemHandler). However I am stuck in transitioning outaide of a SplitNode.

 

I have a HumanTaskNode assigned to a user. When the user approves or rejects an order, I have a split node which will redirect to 2 different nodes. The constraint I have added for the SplitNode is as follows:

 

SplitFactory splitFactory = factory.splitNode( 1000)

                .type(Split.TYPE_XOR)

                .name("SplitNode");

                       

           

    splitFactory.constraint(2000, "orderApproved?", "code","java","return !orderApproved").done();

    splitFactory.constraint(2500, "orderApproved?", "code","java","return orderApproved).done();

 

My question is how do we set the value of orderApproved at runtime so that the SplitNode can redirect to either node 2000 or node 2500? Should it be done in a WorkItemHandler? If So, what needs to be passed in to the workitem handler and how to read the value of the orderApproved back ?

 

I receive the value of the orderApproved via a web service call and need to assign it to the process variable "orderApproved". Any assistance with code samples or pointers will be greatly appreciated

 

orderApproved is declared earlier as

 

factory

            .name("name")

                .packageName(workflow.getName("name")               

                .variable("orderApproved",new ObjectDataType(Boolean.class.getCanonicalName()))

Reply to this message by going to Community

Start a new discussion in jBPM at Community