Java Code Examples for org.activiti.engine.impl.variable.VariableTypes#findVariableType()
The following examples show how to use
org.activiti.engine.impl.variable.VariableTypes#findVariableType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VariableScopeImpl.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: VariableScopeImpl.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
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 (newType != null && !newType.equals(variableInstance.getType())) { 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); }
Example 3
Source File: VariableScopeImpl.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected VariableInstanceEntity createVariableInstance(String variableName, Object value, ExecutionEntity sourceActivityExecution) { VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes(); VariableType type = variableTypes.findVariableType(value); VariableInstanceEntity variableInstance = Context.getCommandContext() .getVariableInstanceEntityManager() .create(variableName, type, value); initializeVariableInstanceBackPointer(variableInstance); Context.getCommandContext().getVariableInstanceEntityManager().insert(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; }
Example 4
Source File: VariableScopeImpl.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
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 (newType != null && !newType.equals(variableInstance.getType())) { 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); }
Example 5
Source File: QueryVariableValue.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void initialize(VariableTypes types) { if(variableInstanceEntity == null) { VariableType type = types.findVariableType(value); if(type instanceof ByteArrayType) { throw new ActivitiIllegalArgumentException("Variables of type ByteArray cannot be used to query"); } else if(type instanceof JPAEntityVariableType && operator != QueryOperator.EQUALS) { throw new ActivitiIllegalArgumentException("JPA entity variables can only be used in 'variableValueEquals'"); } else if(type instanceof JPAEntityListVariableType) { throw new ActivitiIllegalArgumentException("Variables containing a list of JPA entities cannot be used to query"); } else { // Type implementation determines which fields are set on the entity variableInstanceEntity = VariableInstanceEntity.create(name, type, value); } } }
Example 6
Source File: QueryVariableValue.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void initialize(VariableTypes types) { if (variableInstanceEntity == null) { VariableType type = types.findVariableType(value); if (type instanceof ByteArrayType) { throw new ActivitiIllegalArgumentException("Variables of type ByteArray cannot be used to query"); } else if (type instanceof JPAEntityVariableType && operator != QueryOperator.EQUALS) { throw new ActivitiIllegalArgumentException("JPA entity variables can only be used in 'variableValueEquals'"); } else if (type instanceof JPAEntityListVariableType) { throw new ActivitiIllegalArgumentException("Variables containing a list of JPA entities cannot be used to query"); } else { // Type implementation determines which fields are set on the entity variableInstanceEntity = Context.getCommandContext().getVariableInstanceEntityManager().create(name, type, value); } } }