Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.cloudfoundry.multiapps.controller.web.configuration;

import org.flowable.common.engine.impl.AbstractEngineConfiguration;
import org.flowable.common.engine.impl.EngineConfigurator;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.variable.api.types.VariableType;
import org.flowable.variable.api.types.VariableTypes;
import org.flowable.variable.service.impl.types.LongStringType;

public class CustomEngineConfigurator implements EngineConfigurator {

@Override
public void beforeInit(AbstractEngineConfiguration engineConfiguration) {

}

@Override
public void configure(AbstractEngineConfiguration engineConfiguration) {
ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) engineConfiguration;
VariableTypes variableTypes = configuration.getVariableTypes();
VariableType longStringVariableType = variableTypes.getVariableType(LongStringType.TYPE_NAME);
int longStringVariableTypeIndex = variableTypes.getTypeIndex(LongStringType.TYPE_NAME);
// We are first removing the Flowable LongStringType, and then we add our custom
variableTypes.removeType(longStringVariableType);
variableTypes.addType(new CustomLongStringType(configuration.getMaxLengthString()), longStringVariableTypeIndex);
}

@Override
public int getPriority() {
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@

public class CustomLongStringType extends LongStringType {

private static final String CUSTOM_TYPE_NAME = "deployServiceLongString";

public CustomLongStringType() {
super(4000);
}

@Override
public String getTypeName() {
return CUSTOM_TYPE_NAME;
public CustomLongStringType(int minLength) {
super(minLength);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.cloudfoundry.multiapps.controller.web.configuration;

import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
Expand Down Expand Up @@ -61,10 +60,10 @@ public SpringProcessEngineConfiguration processEngineConfiguration(DataSource da
AsyncExecutor jobExecutor,
@Lazy FailedJobCommandFactory abortFailedProcessCommandFactory) {
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
//We set custom variable type because when we update a value in the context, we see in your code that it has been updated
//We set custom engine configurator because when we update a value in the context, we see in your code that it has been updated
//but the cache isn't. That's why with custom type we manually update the cache
//Link to the Flowable Github issue: https://github.com/flowable/flowable-engine/issues/4130
processEngineConfiguration.setCustomPreVariableTypes(List.of(new CustomLongStringType()));
processEngineConfiguration.addConfigurator(new CustomEngineConfigurator());
processEngineConfiguration.setDatabaseSchemaUpdate(DATABASE_SCHEMA_UPDATE);
processEngineConfiguration.setDataSource(dataSource);
processEngineConfiguration.setTransactionManager(transactionManager);
Expand Down
Loading