Search in sources :

Example 1 with CoreVariableInstance

use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.

the class CaseExecutionEntity method remove.

// delete/remove ///////////////////////////////////////////////////////
@SuppressWarnings({ "unchecked", "rawtypes" })
public void remove() {
    super.remove();
    for (VariableInstanceEntity variableInstance : variableStore.getVariables()) {
        invokeVariableLifecycleListenersDelete(variableInstance, this, Arrays.<VariableInstanceLifecycleListener<CoreVariableInstance>>asList((VariableInstanceLifecycleListener) VariableInstanceEntityPersistenceListener.INSTANCE));
        variableStore.removeVariable(variableInstance.getName());
    }
    CommandContext commandContext = Context.getCommandContext();
    for (CaseSentryPartEntity sentryPart : getCaseSentryParts()) {
        commandContext.getCaseSentryPartManager().deleteSentryPart(sentryPart);
    }
    // finally delete this execution
    commandContext.getCaseExecutionManager().deleteCaseExecution(this);
}
Also used : CoreVariableInstance(org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) VariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity) VariableInstanceLifecycleListener(org.camunda.bpm.engine.impl.core.variable.scope.VariableInstanceLifecycleListener)

Example 2 with CoreVariableInstance

use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.

the class ExecutionEntity method moveVariableTo.

protected void moveVariableTo(VariableInstanceEntity variable, ExecutionEntity other) {
    if (other.variableStore.containsKey(variable.getName())) {
        CoreVariableInstance existingInstance = other.variableStore.getVariable(variable.getName());
        existingInstance.setValue(variable.getTypedValue(false));
        invokeVariableLifecycleListenersUpdate(existingInstance, this);
        invokeVariableLifecycleListenersDelete(variable, this, Collections.singletonList(getVariablePersistenceListener()));
    } else {
        other.variableStore.addVariable(variable);
    }
}
Also used : CoreVariableInstance(org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance)

Example 3 with CoreVariableInstance

use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.

the class AbstractVariableScope method setVariableLocalTransient.

/**
 * Sets a variable in the local scope. In contrast to
 * {@link #setVariableLocal(String, Object)}, the variable is transient that
 * means it will not be stored in the data base. For example, a transient
 * variable can be used for a result variable that is only available for
 * output mapping.
 */
public void setVariableLocalTransient(String variableName, Object value) {
    TypedValue typedValue = Variables.untypedValue(value);
    checkJavaSerialization(variableName, typedValue);
    CoreVariableInstance coreVariableInstance = getVariableInstanceFactory().build(variableName, typedValue, true);
    getVariableStore().addVariable(coreVariableInstance);
}
Also used : CoreVariableInstance(org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Example 4 with CoreVariableInstance

use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.

the class AbstractVariableScope method initializeVariableStore.

public void initializeVariableStore(Map<String, Object> variables) {
    for (String variableName : variables.keySet()) {
        TypedValue value = Variables.untypedValue(variables.get(variableName));
        CoreVariableInstance variableValue = getVariableInstanceFactory().build(variableName, value, false);
        getVariableStore().addVariable(variableValue);
    }
}
Also used : CoreVariableInstance(org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Example 5 with CoreVariableInstance

use of org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance in project camunda-bpm-platform by camunda.

the class AbstractVariableScope method removeVariableLocal.

protected void removeVariableLocal(String variableName, AbstractVariableScope sourceActivityExecution) {
    if (getVariableStore().containsKey(variableName)) {
        CoreVariableInstance variableInstance = getVariableStore().getVariable(variableName);
        invokeVariableLifecycleListenersDelete(variableInstance, sourceActivityExecution);
        getVariableStore().removeVariable(variableName);
    }
}
Also used : CoreVariableInstance(org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance)

Aggregations

CoreVariableInstance (org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance)8 VariableInstanceEntity (org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)2 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)2 VariableInstanceLifecycleListener (org.camunda.bpm.engine.impl.core.variable.scope.VariableInstanceLifecycleListener)1 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1