Search in sources :

Example 6 with VariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity in project camunda-bpm-platform by camunda.

the class DbOperationsOrderingTest method setup.

@Before
public void setup() {
    TestIdGenerator idGenerator = new TestIdGenerator();
    entityManager = new ExposingDbEntityManager(idGenerator, null);
    execution1 = new ExecutionEntity();
    execution1.setId("101");
    execution2 = new ExecutionEntity();
    execution2.setId("102");
    execution3 = new ExecutionEntity();
    execution3.setId("103");
    execution4 = new ExecutionEntity();
    execution4.setId("104");
    execution5 = new ExecutionEntity();
    execution5.setId("105");
    execution6 = new ExecutionEntity();
    execution6.setId("106");
    execution7 = new ExecutionEntity();
    execution7.setId("107");
    execution8 = new ExecutionEntity();
    execution8.setId("108");
    task1 = new TaskEntity();
    task1.setId("104");
    task2 = new TaskEntity();
    task2.setId("105");
    task3 = new TaskEntity();
    task3.setId("106");
    task4 = new TaskEntity();
    task4.setId("107");
    variable1 = new VariableInstanceEntity();
    variable1.setId("108");
    variable2 = new VariableInstanceEntity();
    variable2.setId("109");
    variable3 = new VariableInstanceEntity();
    variable3.setId("110");
    variable4 = new VariableInstanceEntity();
    variable4.setId("111");
}
Also used : TaskEntity(org.camunda.bpm.engine.impl.persistence.entity.TaskEntity) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) VariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity) Before(org.junit.Before)

Example 7 with VariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity in project camunda-bpm-platform by camunda.

the class FilterResourceImpl method getSortedVariableInstances.

protected Map<String, List<VariableInstance>> getSortedVariableInstances(Collection<String> variableNames, Collection<String> variableScopeIds) {
    List<VariableInstance> variableInstances = queryVariablesInstancesByVariableScopeIds(variableNames, variableScopeIds);
    Map<String, List<VariableInstance>> sortedVariableInstances = new HashMap<String, List<VariableInstance>>();
    for (VariableInstance variableInstance : variableInstances) {
        String variableScopeId = ((VariableInstanceEntity) variableInstance).getVariableScopeId();
        if (!sortedVariableInstances.containsKey(variableScopeId)) {
            sortedVariableInstances.put(variableScopeId, new ArrayList<VariableInstance>());
        }
        sortedVariableInstances.get(variableScopeId).add(variableInstance);
    }
    return sortedVariableInstances;
}
Also used : HalTaskList(org.camunda.bpm.engine.rest.hal.task.HalTaskList) VariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance)

Example 8 with VariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity in project camunda-bpm-platform by camunda.

the class UserTaskActivityBehavior method onParseMigratingInstance.

@Override
public void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) {
    ExecutionEntity execution = migratingInstance.resolveRepresentativeExecution();
    for (TaskEntity task : execution.getTasks()) {
        migratingInstance.addMigratingDependentInstance(new MigratingUserTaskInstance(task, migratingInstance));
        parseContext.consume(task);
        Collection<VariableInstanceEntity> variables = task.getVariablesInternal();
        if (variables != null) {
            for (VariableInstanceEntity variable : variables) {
                // we don't need to represent task variables in the migrating instance structure because
                // they are migrated by the MigratingTaskInstance as well
                parseContext.consume(variable);
            }
        }
    }
}
Also used : TaskEntity(org.camunda.bpm.engine.impl.persistence.entity.TaskEntity) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) MigratingUserTaskInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingUserTaskInstance) VariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)

Example 9 with VariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity in project camunda-bpm-platform by camunda.

the class ActivityInstanceHandler method collectActivityInstanceVariables.

protected List<VariableInstanceEntity> collectActivityInstanceVariables(MigratingActivityInstance instance) {
    List<VariableInstanceEntity> variables = new ArrayList<VariableInstanceEntity>();
    ExecutionEntity representativeExecution = instance.resolveRepresentativeExecution();
    ExecutionEntity parentExecution = representativeExecution.getParent();
    // decide for representative execution and parent execution whether to none/all/concurrentLocal variables
    // belong to this activity instance
    boolean addAllRepresentativeExecutionVariables = instance.getSourceScope().isScope() || representativeExecution.isConcurrent();
    if (addAllRepresentativeExecutionVariables) {
        variables.addAll(representativeExecution.getVariablesInternal());
    } else {
        variables.addAll(getConcurrentLocalVariables(representativeExecution));
    }
    boolean addAnyParentExecutionVariables = parentExecution != null && instance.getSourceScope().isScope();
    if (addAnyParentExecutionVariables) {
        boolean addAllParentExecutionVariables = parentExecution.isConcurrent();
        if (addAllParentExecutionVariables) {
            variables.addAll(parentExecution.getVariablesInternal());
        } else {
            variables.addAll(getConcurrentLocalVariables(parentExecution));
        }
    }
    return variables;
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ArrayList(java.util.ArrayList) VariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)

Example 10 with VariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity in project camunda-bpm-platform by camunda.

the class CompensationInstanceHandler method parseDependentEntities.

protected void parseDependentEntities(MigratingInstanceParseContext parseContext, MigratingEventScopeInstance migratingInstance) {
    ExecutionEntity representativeExecution = migratingInstance.resolveRepresentativeExecution();
    List<VariableInstanceEntity> variables = new ArrayList<VariableInstanceEntity>(representativeExecution.getVariablesInternal());
    parseContext.handleDependentVariables(migratingInstance, variables);
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ArrayList(java.util.ArrayList) VariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)

Aggregations

VariableInstanceEntity (org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)13 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)9 ArrayList (java.util.ArrayList)3 TaskEntity (org.camunda.bpm.engine.impl.persistence.entity.TaskEntity)3 CoreVariableInstance (org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance)2 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)2 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)2 VariableInstanceLifecycleListener (org.camunda.bpm.engine.impl.core.variable.scope.VariableInstanceLifecycleListener)1 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1 MigratingActivityInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance)1 MigratingUserTaskInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingUserTaskInstance)1 MigratingVariableInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingVariableInstance)1 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)1 ExternalTaskEntity (org.camunda.bpm.engine.impl.persistence.entity.ExternalTaskEntity)1 IncidentEntity (org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity)1 JobDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionEntity)1 JobEntity (org.camunda.bpm.engine.impl.persistence.entity.JobEntity)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1 ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)1 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)1