提交 856e5c71 编写于 作者: F fheremans

Merge branch 'pull-TASK_TIMEOUT' of https://github.com/martin-grofcik/Activiti...

Merge branch 'pull-TASK_TIMEOUT' of https://github.com/martin-grofcik/Activiti into martin-grofcik-pull-TASK_TIMEOUT
......@@ -133,6 +133,11 @@ public enum ActivitiEventType {
*/
ACTIVITY_ERROR_RECEIVED,
/**
* An activity was interrupted by an interrupting timer boundary event.
*/
ACTIVITY_TIMEOUT,
/**
* Indicates the engine has taken (ie. followed) a sequenceflow from a source activity to a target activity.
*/
......
......@@ -15,9 +15,11 @@ package org.activiti.engine.impl.jobexecutor;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.delegate.event.ActivitiEventType;
import org.activiti.engine.delegate.event.impl.ActivitiEventBuilder;
import org.activiti.engine.impl.bpmn.behavior.BoundaryEventActivityBehavior;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.impl.pvm.delegate.ActivityBehavior;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -48,6 +50,7 @@ public class TimerExecuteNestedActivityJobHandler implements JobHandler {
if (commandContext.getEventDispatcher().isEnabled()) {
commandContext.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(ActivitiEventType.TIMER_FIRED, job));
dispatchActivityTimeoutIfNeeded(job, execution, commandContext);
}
borderEventActivity
......@@ -62,4 +65,27 @@ public class TimerExecuteNestedActivityJobHandler implements JobHandler {
throw new ActivitiException("exception during timer execution: "+e.getMessage(), e);
}
}
protected void dispatchActivityTimeoutIfNeeded(JobEntity timerEntity, ExecutionEntity execution, CommandContext commandContext) {
ActivityImpl boundaryEventActivity = execution.getProcessDefinition().findActivity(timerEntity.getJobHandlerConfiguration());
ActivityBehavior boundaryActivityBehavior = boundaryEventActivity.getActivityBehavior();
if (boundaryActivityBehavior instanceof BoundaryEventActivityBehavior) {
BoundaryEventActivityBehavior boundaryEventActivityBehavior = (BoundaryEventActivityBehavior) boundaryActivityBehavior;
if (boundaryEventActivityBehavior.isInterrupting()) {
ActivityImpl activity = execution.getActivity();
if (activity != null && activity.getActivityBehavior() != null) {
commandContext.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createActivityEvent(ActivitiEventType.ACTIVITY_COMPLETED, execution.getActivity().getId(),
(String) activity.getProperties().get("name"),
execution.getId(),
execution.getProcessInstanceId(), execution.getProcessDefinitionId(),
(String) activity.getProperties().get("type"),
activity.getActivityBehavior().getClass().getCanonicalName()));
}
}
}
}
}
......@@ -1107,6 +1107,11 @@ in your subclass, BPMN-event throwing can be prevented. The classes involved are
<entry>An activity is completed successfully</entry>
<entry><literal>org.activiti...ActivitiActivityEvent</literal></entry>
</row>
<row>
<entry>ACTIVITY_TIMOUT</entry>
<entry>An activity is interupted due to an interrupting timer boundary event.</entry>
<entry><literal>org.activiti...ActivitiActivityEvent</literal></entry>
</row>
<row>
<entry>ACTIVITY_SIGNALED</entry>
<entry>An activity received a signal</entry>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册