Search in sources :

Example 56 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class TaskParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, Task task) {
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, task, BpmnXMLConstants.ELEMENT_TASK);
    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createTaskActivityBehavior(task));
    activity.setAsync(task.isAsynchronous());
    activity.setExclusive(!task.isNotExclusive());
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl)

Example 57 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class UserTaskParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, UserTask userTask) {
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, userTask, BpmnXMLConstants.ELEMENT_TASK_USER);
    activity.setAsync(userTask.isAsynchronous());
    activity.setExclusive(!userTask.isNotExclusive());
    TaskDefinition taskDefinition = parseTaskDefinition(bpmnParse, userTask, userTask.getId(), (ProcessDefinitionEntity) bpmnParse.getCurrentScope().getProcessDefinition());
    activity.setProperty(PROPERTY_TASK_DEFINITION, taskDefinition);
    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createUserTaskActivityBehavior(userTask, taskDefinition));
}
Also used : TaskDefinition(org.activiti.engine.impl.task.TaskDefinition) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl)

Example 58 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class ErrorEventDefinitionParseHandler method createBoundaryErrorEventDefinition.

public void createBoundaryErrorEventDefinition(ErrorEventDefinition errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
    nestedErrorEventActivity.setProperty("type", "boundaryError");
    ScopeImpl catchingScope = nestedErrorEventActivity.getParent();
    ((ActivityImpl) catchingScope).setScope(true);
    org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition definition = new org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition(nestedErrorEventActivity.getId());
    definition.setErrorCode(errorEventDefinition.getErrorCode());
    addErrorEventDefinition(definition, catchingScope);
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) ScopeImpl(org.activiti.engine.impl.pvm.process.ScopeImpl)

Example 59 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class TimerExecuteNestedActivityJobHandler method execute.

public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
    String nestedActivityId = TimerEventHandler.getActivityIdFromConfiguration(configuration);
    ActivityImpl borderEventActivity = execution.getProcessDefinition().findActivity(nestedActivityId);
    if (borderEventActivity == null) {
        throw new ActivitiException("Error while firing timer: border event activity " + nestedActivityId + " not found");
    }
    try {
        if (commandContext.getEventDispatcher().isEnabled()) {
            commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.TIMER_FIRED, job));
            dispatchActivityTimeoutIfNeeded(job, execution, commandContext);
        }
        borderEventActivity.getActivityBehavior().execute(execution);
    } catch (RuntimeException e) {
        log.error("exception during timer execution", e);
        throw e;
    } catch (Exception e) {
        log.error("exception during timer execution", e);
        throw new ActivitiException("exception during timer execution: " + e.getMessage(), e);
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ActivitiException(org.activiti.engine.ActivitiException)

Example 60 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class TimerExecuteNestedActivityJobHandler method dispatchExecutionTimeOut.

protected void dispatchExecutionTimeOut(JobEntity timerEntity, ExecutionEntity execution, CommandContext commandContext) {
    // subprocesses
    for (ExecutionEntity subExecution : execution.getExecutions()) {
        dispatchExecutionTimeOut(timerEntity, subExecution, commandContext);
    }
    // call activities
    ExecutionEntity subProcessInstance = commandContext.getExecutionEntityManager().findSubProcessInstanceBySuperExecutionId(execution.getId());
    if (subProcessInstance != null) {
        dispatchExecutionTimeOut(timerEntity, subProcessInstance, commandContext);
    }
    // activity with timer boundary event
    ActivityImpl activity = execution.getActivity();
    if (activity != null && activity.getActivityBehavior() != null) {
        dispatchActivityTimeOut(timerEntity, activity, execution, commandContext);
    }
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl)

Aggregations

ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)70 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)12 ActivitiException (org.activiti.engine.ActivitiException)9 TransitionImpl (org.activiti.engine.impl.pvm.process.TransitionImpl)9 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)8 PvmTransition (org.activiti.engine.impl.pvm.PvmTransition)7 ActivityExecution (org.activiti.engine.impl.pvm.delegate.ActivityExecution)6 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)6 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)6 ArrayList (java.util.ArrayList)5 IOSpecification (org.activiti.engine.impl.bpmn.data.IOSpecification)4 ActivityBehavior (org.activiti.engine.impl.pvm.delegate.ActivityBehavior)4 HashMap (java.util.HashMap)3 PvmProcessDefinition (org.activiti.engine.impl.pvm.PvmProcessDefinition)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 List (java.util.List)2 DataAssociation (org.activiti.bpmn.model.DataAssociation)2 EventDefinition (org.activiti.bpmn.model.EventDefinition)2