Reputation: 613
I am developing the go back
function.
This go back
function only work to user task activity for now.
For make this clearly I simulate a process definition.
StartEvent → → →squenceFlow_A→ → →A_UserTask→ → →squenceFlow_B → → →B_UserTask → → → endEvent.
Assume the current activity at B_UserTask
This function need to do two step:
1.Start an execution at squenceFlow_A
2.Cancel the B_UserTask activity instance after the above step done.
But the question is how to get the info of squenceFlow_A
from the BpmnInstance in java ?
I mean how to get the squenceflow info of between two activity from BpmnInstance in java ?
Maybe it is will be clearly if change the question to "How to get the first sequence Flow info that is before the given activity from BpmnInstance in java ?"
In aboce case this question is "how to get the first sequence Flow info that is before the B_UserTask
from BpmnInstance in java ?"
My english is so bad. Hope i will not make you guys feel bad from me.
By the way thank you all.
Upvotes: 0
Views: 785
Reputation: 613
I finded the solution by myself.
Here is the code.
String givenActivityId = "activityId";
BpmnModelInstance instance = repositoryService.getBpmnModelInstance("definitionId");
Collection<SequenceFlow> sequenceFlows = instance.getModelElementsByType(SequenceFlow.class);
for (SequenceFlow flow : sequenceFlows) {
if (flow.getTarget().getId().equals(givenActivityId)) {
LOG.info("Founded the sequenceFlow.");
return flow;
}
}
LOG.error("No such sequenceFlow");
cheers!!!
Upvotes: 1