Java Code Examples for org.activiti.engine.impl.variable.StringType

The following examples show how to use org.activiti.engine.impl.variable.StringType. These examples are extracted from open source projects. 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 Project: herd   Source File: HerdProcessEngineConfigurator.java    License: Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 2
Source Project: lemon   Source File: MockVariableScope.java    License: Apache License 2.0 6 votes vote down vote up
public MockVariableScope(Integer eventCode, String eventName,
        ModelInfoDTO modelInfo, String userId, String activityId,
        String activityName) {
    usedVariablesCache.put("eventCode", VariableInstanceEntity.create(
            "eventCode", new IntegerType(), eventCode));
    usedVariablesCache.put("eventName", VariableInstanceEntity.create(
            "eventName", new StringType(64), eventName));
    usedVariablesCache.put("modelInfo", VariableInstanceEntity.create(
            "modelInfo", new SerializableType(), modelInfo));
    usedVariablesCache.put("userId", VariableInstanceEntity.create(
            "userId", new StringType(64), userId));
    usedVariablesCache.put("activityId", VariableInstanceEntity.create(
            "activityId", new StringType(64), activityId));
    usedVariablesCache.put("activityName", VariableInstanceEntity.create(
            "activityName", new StringType(64), activityName));
}
 
Example 3
Source Project: herd   Source File: HerdProcessEngineConfiguratorTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Activiti by default configures StringType and LongStringType VariableType in configuration.
 * This method tests the scenarios where no StringType and LongStringType is already configured in configuration.
 */
@Test
public void testNoStringAndLongStringType() throws Exception
{
    SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
    configuration.setVariableTypes(new DefaultVariableTypes());
    
    herdProcessEngineConfigurator.configure(configuration);
    VariableType type = configuration.getVariableTypes().findVariableType(StringUtils.repeat("a", 2000));
    assertEquals(StringType.class, type.getClass());
    
    type = configuration.getVariableTypes().findVariableType(StringUtils.repeat("a", 2001));
    assertEquals(LongStringType.class, type.getClass());
}