AnsweredAssumed Answered

stop timer intermediateCatchEvent lead processInstance to end

Question asked by tangwenqiang on Jun 6, 2017
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
    <process id="timerTest" name="timerTest" isExecutable="true">
        <startEvent id="start" name="start"></startEvent>
        <endEvent id="end" name="end"></endEvent>
        <intermediateCatchEvent id="timer" name="timer">
            <timerEventDefinition>
                <timeDuration>PT5M</timeDuration>
            </timerEventDefinition>
        </intermediateCatchEvent>
        <userTask id="A" name="A"></userTask>
        <sequenceFlow id="sid-AF22747D-2327-42C3-B41D-D510DF8EF278" sourceRef="start" targetRef="A"></sequenceFlow>
        <sequenceFlow id="sid-FB67AAB5-508D-4FF0-ADA9-0AB46285DF52" sourceRef="A" targetRef="timer"></sequenceFlow>
        <sequenceFlow id="sid-4930C85E-2764-4C70-B5A7-570268460404" sourceRef="timer" targetRef="end"></sequenceFlow>
    </process>
</definitions>

the workFlow is :  start -> A -> timer -> end

when i complete userTask "A", the processInstance is waiting on the "timer". then i execution the following code intended to make the workFlow change to userTask "A" again. but i find the ACT_HI_PROCINST table sets the 

END_TIME_ and DURATION_.  why ?

 

Command<Object> cmd = new JumpActivityCmd(processInstance.getId(), "A", "jump");
managementService.executeCommand(cmd);
public class JumpActivityCmd implements Command<Object> {
    private String activityId;
    private String processInstanceId;
    private String jumpOrigin;

    public JumpActivityCmd(String processInstanceId, String activityId) {
        this(processInstanceId, activityId, "jump");
    }

    public JumpActivityCmd(String processInstanceId, String activityId, String jumpOrigin) {
        this.activityId = activityId;
        this.processInstanceId = processInstanceId;
        this.jumpOrigin = jumpOrigin;
    }

    public Object execute(CommandContext commandContext) {
        ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId);
        executionEntity.destroyScope(jumpOrigin);
        ProcessDefinitionImpl processDefinition = executionEntity.getProcessDefinition();
        ActivityImpl activity = processDefinition.findActivity(activityId);
        executionEntity.executeActivity(activity);
        return executionEntity;
    }
}

Outcomes