Search in sources :

Example 1 with VariableTypes

use of org.activiti.engine.impl.variable.VariableTypes in project Activiti by Activiti.

the class HistoricVariableInstanceQueryImpl method ensureVariablesInitialized.

protected void ensureVariablesInitialized() {
    if (this.queryVariableValue != null) {
        VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
        queryVariableValue.initialize(variableTypes);
    }
}
Also used : VariableTypes(org.activiti.engine.impl.variable.VariableTypes)

Example 2 with VariableTypes

use of org.activiti.engine.impl.variable.VariableTypes in project Activiti by Activiti.

the class VariableScopeImpl method createVariableInstance.

protected VariableInstanceEntity createVariableInstance(String variableName, Object value, ExecutionEntity sourceActivityExecution) {
    VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
    VariableType type = variableTypes.findVariableType(value);
    VariableInstanceEntity variableInstance = VariableInstanceEntity.createAndInsert(variableName, type, value);
    initializeVariableInstanceBackPointer(variableInstance);
    if (variableInstances != null) {
        variableInstances.put(variableName, variableInstance);
    }
    // Record historic variable
    Context.getCommandContext().getHistoryManager().recordVariableCreate(variableInstance);
    // Record historic detail
    Context.getCommandContext().getHistoryManager().recordHistoricDetailVariableCreate(variableInstance, sourceActivityExecution, isActivityIdUsedForDetails());
    return variableInstance;
}
Also used : VariableTypes(org.activiti.engine.impl.variable.VariableTypes) VariableType(org.activiti.engine.impl.variable.VariableType)

Example 3 with VariableTypes

use of org.activiti.engine.impl.variable.VariableTypes in project Activiti by Activiti.

the class VariableScopeImpl method updateVariableInstance.

protected void updateVariableInstance(VariableInstanceEntity variableInstance, Object value, ExecutionEntity sourceActivityExecution) {
    // Always check if the type should be altered. It's possible that the previous type is lower in the type
    // checking chain (e.g. serializable) and will return true on isAbleToStore(), even though another type
    // higher in the chain is eligible for storage.
    VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
    VariableType newType = variableTypes.findVariableType(value);
    if ((variableInstance != null) && (!variableInstance.getType().equals(newType))) {
        variableInstance.setValue(null);
        variableInstance.setType(newType);
        variableInstance.forceUpdate();
        variableInstance.setValue(value);
    } else {
        variableInstance.setValue(value);
    }
    Context.getCommandContext().getHistoryManager().recordHistoricDetailVariableCreate(variableInstance, sourceActivityExecution, isActivityIdUsedForDetails());
    Context.getCommandContext().getHistoryManager().recordVariableUpdate(variableInstance);
}
Also used : VariableTypes(org.activiti.engine.impl.variable.VariableTypes) VariableType(org.activiti.engine.impl.variable.VariableType)

Aggregations

VariableTypes (org.activiti.engine.impl.variable.VariableTypes)3 VariableType (org.activiti.engine.impl.variable.VariableType)2