提交 ea1743c1 编写于 作者: B bernd.ruecker

ACT-1202: Adding events to HistoricActivityInstance, marked old...

ACT-1202: Adding events to HistoricActivityInstance, marked old "getEndActivityId" deprecated and added the explanation why
上级 dea2ed40
......@@ -43,7 +43,12 @@ public interface HistoricProcessInstance {
/** The difference between {@link #getEndTime()} and {@link #getStartTime()} . */
Long getDurationInMillis();
/** Reference to the activity in which this process instance ended. */
/** Reference to the activity in which this process instance ended.
* Note that a process instance can have multiple end events, in this case it might not be deterministic
* which activity id will be referenced here. Use a {@link HistoricActivityInstanceQuery} instead to query
* for end events of the process instance (use the activityTYpe attribute)
* */
@Deprecated
String getEndActivityId();
/** The authenticated user that started this process instance.
......
......@@ -30,6 +30,7 @@ import org.activiti.engine.impl.variable.VariableDeclaration;
* @author Tom Baeyens
* @author Joram Barrez
* @author Falko Menge
* @author Bernd Ruecker (camunda)
*/
public class HistoryParseListener implements BpmnParseListener {
......@@ -114,9 +115,11 @@ public class HistoryParseListener implements BpmnParseListener {
}
public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
addActivityHandlers(activity);
}
public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) {
addActivityHandlers(activity);
}
public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) {
......@@ -140,6 +143,7 @@ public class HistoryParseListener implements BpmnParseListener {
public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) {
}
public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) {
// TODO: Shall we add audit logging here as well?
}
public void parseMultiInstanceLoopCharacteristics(Element activityElement,
......@@ -179,12 +183,15 @@ public class HistoryParseListener implements BpmnParseListener {
}
public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
addActivityHandlers(activity);
}
public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
addActivityHandlers(activity);
}
public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) {
public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl activity) {
// TODO: Add to audit logging? Discuss
}
public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) {
......
......@@ -18,6 +18,7 @@ import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.test.PluggableActivitiTestCase;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.test.Deployment;
......@@ -142,6 +143,35 @@ public class HistoricActivityInstanceTest extends PluggableActivitiTestCase {
}
}
@Deployment
public void testHistoricActivityInstanceForEventsQuery() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("eventProcess");
assertEquals(1, taskService.createTaskQuery().count());
runtimeService.signalEventReceived("signal");
assertProcessEnded(pi.getId());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("noop").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("userTask").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("intermediate-event").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("start").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("end").list().size());
// TODO: Discuss if boundary events will occur in the log!
// assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("boundaryEvent").list().size());
HistoricActivityInstance intermediateEvent = historyService.createHistoricActivityInstanceQuery().activityId("intermediate-event").singleResult();
assertNotNull(intermediateEvent.getStartTime());
assertNotNull(intermediateEvent.getEndTime());
HistoricActivityInstance startEvent = historyService.createHistoricActivityInstanceQuery().activityId("start").singleResult();
assertNotNull(startEvent.getStartTime());
assertNotNull(startEvent.getEndTime());
HistoricActivityInstance endEvent = historyService.createHistoricActivityInstanceQuery().activityId("end").singleResult();
assertNotNull(endEvent.getStartTime());
assertNotNull(endEvent.getEndTime());
}
@Deployment
public void testHistoricActivityInstanceAssignee() {
// Start process instance
......
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<signal id="signal" name="signal"/>
<process id="eventProcess">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="intermediate-event" />
<intermediateThrowEvent id="intermediate-event" name="catch event" />
<sequenceFlow id="flow2" sourceRef="intermediate-event" targetRef="noop" />
<serviceTask id="noop" name="No operation" activiti:class="org.activiti.engine.test.history.Noop" />
<sequenceFlow id="flow3" sourceRef="noop" targetRef="userTask" />
<userTask id="userTask" name="User Task" />
<boundaryEvent id="boundaryEvent" name="Boundary event" attachedToRef="userTask" >
<signalEventDefinition id="signalDef" signalRef="signal"/>
</boundaryEvent>
<sequenceFlow id="flow4" sourceRef="userTask" targetRef="end" />
<sequenceFlow id="flow5" sourceRef="boundaryEvent" targetRef="end" />
<endEvent id="end" />
</process>
</definitions>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册