use of org.activiti.engine.impl.variable.VariableType in project herd by FINRAOS.
the class HerdProcessEngineConfigurator method replaceVariableType.
/**
* Inserts the variableType in variableTypes at the given index. If variableType already exists, then it replaces the type at the location where it already
* exists.
*
* @param variableTypes the variableTypes
* @param variableTypeToReplace the variableType to insert
* @param indexToInsert the index to insert variableType
*
* @return the index where variableType was inserted.
*/
private int replaceVariableType(VariableTypes variableTypes, VariableType variableTypeToReplace, int indexToInsert) {
int indexToInsertReturn = indexToInsert;
VariableType existingVariableType = variableTypes.getVariableType(variableTypeToReplace.getTypeName());
if (existingVariableType != null) {
indexToInsertReturn = variableTypes.getTypeIndex(existingVariableType.getTypeName());
variableTypes.removeType(existingVariableType);
}
variableTypes.addType(variableTypeToReplace, indexToInsertReturn);
return indexToInsertReturn;
}
use of org.activiti.engine.impl.variable.VariableType 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 = 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;
}
use of org.activiti.engine.impl.variable.VariableType in project Activiti by Activiti.
the class ProcessEngineConfigurationImpl method initVariableTypes.
public void initVariableTypes() {
if (variableTypes == null) {
variableTypes = new DefaultVariableTypes();
if (customPreVariableTypes != null) {
for (VariableType customVariableType : customPreVariableTypes) {
variableTypes.addType(customVariableType);
}
}
variableTypes.addType(new NullType());
variableTypes.addType(new StringType(getMaxLengthString()));
variableTypes.addType(new LongStringType(getMaxLengthString() + 1));
variableTypes.addType(new BooleanType());
variableTypes.addType(new ShortType());
variableTypes.addType(new IntegerType());
variableTypes.addType(new LongType());
variableTypes.addType(new DateType());
variableTypes.addType(new JodaDateType());
variableTypes.addType(new JodaDateTimeType());
variableTypes.addType(new DoubleType());
variableTypes.addType(new UUIDType());
objectMapper.configOverride(BigDecimal.class).setFormat(JsonFormat.Value.forShape(JsonFormat.Shape.STRING));
JsonTypeConverter jsonTypeConverter = new JsonTypeConverter(objectMapper, javaClassFieldForJackson);
variableTypes.addType(new JsonType(getMaxLengthString(), objectMapper, serializePOJOsInVariablesToJson, jsonTypeConverter));
variableTypes.addType(new LongJsonType(getMaxLengthString() + 1, objectMapper, serializePOJOsInVariablesToJson, jsonTypeConverter));
// if java serliazation needed together with json defaulting then add to customPostVariableTypes
if (!serializePOJOsInVariablesToJson) {
variableTypes.addType(new ByteArrayType());
variableTypes.addType(new SerializableType(serializableVariableTypeTrackDeserializedObjects));
variableTypes.addType(new CustomObjectType("item", ItemInstance.class));
variableTypes.addType(new CustomObjectType("message", MessageInstance.class));
}
if (customPostVariableTypes != null) {
for (VariableType customVariableType : customPostVariableTypes) {
variableTypes.addType(customVariableType);
}
}
}
}
use of org.activiti.engine.impl.variable.VariableType in project Activiti by Activiti.
the class IbatisVariableTypeHandler method getResult.
public VariableType getResult(ResultSet rs, String columnName) throws SQLException {
String typeName = rs.getString(columnName);
VariableType type = getVariableTypes().getVariableType(typeName);
if (type == null && typeName != null) {
throw new ActivitiException("unknown variable type name " + typeName);
}
return type;
}
use of org.activiti.engine.impl.variable.VariableType in project herd by FINRAOS.
the class HerdProcessEngineConfigurator method configure.
@Override
public void configure(ProcessEngineConfigurationImpl processEngineConfiguration) {
// There is an issue when using Activiti with Oracle. When workflow variables have a length greater then 2000 and smaller than 4001,
// Activiti tries to store that as a String column, but the Oracle database column length (ACT_RU_VARIABLE.TEXT_, ACT_HI_VARINST.TEXT_) is 2000.
// Since Activiti uses NVARCHAR as the column type which requires 2 bytes for every character, the maximum size Oracle allows for the column is
// 2000 (i.e. 4000 bytes).
// Replace the StringType and LongType to store greater than 2000 length variables as blob.
VariableTypes variableTypes = processEngineConfiguration.getVariableTypes();
VariableType stringType = new StringType(2000);
int indexToInsert = replaceVariableType(variableTypes, stringType, 0);
VariableType longStringType = new LongStringType(2001);
replaceVariableType(variableTypes, longStringType, ++indexToInsert);
}
Aggregations