Search in sources :

Example 16 with ExecutionEntity

use of org.activiti.engine.impl.persistence.entity.ExecutionEntity in project Activiti by Activiti.

the class ProcessInstanceEndedEventHandler method generateEventLogEntry.

@Override
public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {
    ExecutionEntity processInstanceEntity = getEntityFromEvent();
    Map<String, Object> data = new HashMap<String, Object>();
    putInMapIfNotNull(data, Fields.ID, processInstanceEntity.getId());
    putInMapIfNotNull(data, Fields.BUSINESS_KEY, processInstanceEntity.getBusinessKey());
    putInMapIfNotNull(data, Fields.PROCESS_DEFINITION_ID, processInstanceEntity.getProcessDefinitionId());
    putInMapIfNotNull(data, Fields.NAME, processInstanceEntity.getName());
    putInMapIfNotNull(data, Fields.END_TIME, timeStamp);
    return createEventLogEntry(TYPE, processInstanceEntity.getProcessDefinitionId(), processInstanceEntity.getId(), null, null, data);
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) HashMap(java.util.HashMap)

Example 17 with ExecutionEntity

use of org.activiti.engine.impl.persistence.entity.ExecutionEntity in project Activiti by Activiti.

the class ProcessInstanceStartedEventHandler method generateEventLogEntry.

@Override
public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {
    ActivitiEntityWithVariablesEvent eventWithVariables = (ActivitiEntityWithVariablesEvent) event;
    ExecutionEntity processInstanceEntity = (ExecutionEntity) eventWithVariables.getEntity();
    Map<String, Object> data = new HashMap<String, Object>();
    putInMapIfNotNull(data, Fields.ID, processInstanceEntity.getId());
    putInMapIfNotNull(data, Fields.BUSINESS_KEY, processInstanceEntity.getBusinessKey());
    putInMapIfNotNull(data, Fields.PROCESS_DEFINITION_ID, processInstanceEntity.getProcessDefinitionId());
    putInMapIfNotNull(data, Fields.NAME, processInstanceEntity.getName());
    putInMapIfNotNull(data, Fields.CREATE_TIME, timeStamp);
    if (eventWithVariables.getVariables() != null && !eventWithVariables.getVariables().isEmpty()) {
        Map<String, Object> variableMap = new HashMap<String, Object>();
        for (Object variableName : eventWithVariables.getVariables().keySet()) {
            putInMapIfNotNull(variableMap, (String) variableName, eventWithVariables.getVariables().get(variableName));
        }
        putInMapIfNotNull(data, Fields.VARIABLES, variableMap);
    }
    return createEventLogEntry(TYPE, processInstanceEntity.getProcessDefinitionId(), processInstanceEntity.getId(), null, null, data);
}
Also used : ActivitiEntityWithVariablesEvent(org.activiti.engine.delegate.event.ActivitiEntityWithVariablesEvent) ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) HashMap(java.util.HashMap)

Example 18 with ExecutionEntity

use of org.activiti.engine.impl.persistence.entity.ExecutionEntity in project Activiti by Activiti.

the class RecorderExecutionListener method notify.

public void notify(DelegateExecution execution) throws Exception {
    ExecutionEntity executionCasted = ((ExecutionEntity) execution);
    recordedEvents.add(new //
    RecordedEvent(executionCasted.getActivityId(), (String) executionCasted.getActivity().getProperties().get("name"), execution.getEventName(), (String) parameter.getValue(execution)));
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity)

Example 19 with ExecutionEntity

use of org.activiti.engine.impl.persistence.entity.ExecutionEntity in project Activiti by Activiti.

the class GatewayActivityBehavior method lockConcurrentRoot.

protected void lockConcurrentRoot(ActivityExecution execution) {
    ActivityExecution concurrentRoot = null;
    if (execution.isConcurrent()) {
        concurrentRoot = execution.getParent();
    } else {
        concurrentRoot = execution;
    }
    ((ExecutionEntity) concurrentRoot).forceUpdate();
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ActivityExecution(org.activiti.engine.impl.pvm.delegate.ActivityExecution)

Example 20 with ExecutionEntity

use of org.activiti.engine.impl.persistence.entity.ExecutionEntity in project Activiti by Activiti.

the class InclusiveGatewayActivityBehavior method activeConcurrentExecutionsExist.

public boolean activeConcurrentExecutionsExist(ActivityExecution execution) {
    PvmActivity activity = execution.getActivity();
    if (execution.isConcurrent()) {
        for (ActivityExecution concurrentExecution : getLeaveExecutions(execution.getParent())) {
            if (concurrentExecution.isActive() && concurrentExecution.getId().equals(execution.getId()) == false) {
                // TODO: when is transitionBeingTaken cleared? Should we clear it?
                boolean reachable = false;
                PvmTransition pvmTransition = ((ExecutionEntity) concurrentExecution).getTransitionBeingTaken();
                if (pvmTransition != null) {
                    reachable = isReachable(pvmTransition.getDestination(), activity, new HashSet<PvmActivity>());
                } else {
                    reachable = isReachable(concurrentExecution.getActivity(), activity, new HashSet<PvmActivity>());
                }
                if (reachable) {
                    if (log.isDebugEnabled()) {
                        log.debug("an active concurrent execution found: '{}'", concurrentExecution.getActivity());
                    }
                    return true;
                }
            }
        }
    } else if (execution.isActive()) {
        // is this ever true?
        if (log.isDebugEnabled()) {
            log.debug("an active concurrent execution found: '{}'", execution.getActivity());
        }
        return true;
    }
    return false;
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ActivityExecution(org.activiti.engine.impl.pvm.delegate.ActivityExecution) PvmActivity(org.activiti.engine.impl.pvm.PvmActivity) PvmTransition(org.activiti.engine.impl.pvm.PvmTransition) HashSet(java.util.HashSet)

Aggregations

ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)58 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)15 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)15 ActivitiException (org.activiti.engine.ActivitiException)12 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)11 ActivityExecution (org.activiti.engine.impl.pvm.delegate.ActivityExecution)8 HashMap (java.util.HashMap)7 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)7 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)5 CompensateEventSubscriptionEntity (org.activiti.engine.impl.persistence.entity.CompensateEventSubscriptionEntity)5 Deployment (org.activiti.engine.test.Deployment)5 ArrayList (java.util.ArrayList)4 DeploymentManager (org.activiti.engine.impl.persistence.deploy.DeploymentManager)4 AttachmentEntity (org.activiti.engine.impl.persistence.entity.AttachmentEntity)3 TaskEntity (org.activiti.engine.impl.persistence.entity.TaskEntity)3 PvmTransition (org.activiti.engine.impl.pvm.PvmTransition)3 List (java.util.List)2 ActivitiEntityEvent (org.activiti.engine.delegate.event.ActivitiEntityEvent)2