class HerdProcessEngineConfigurator implements ProcessEngineConfigurator {

    @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);
    }

}