use of org.camunda.bpm.engine.impl.el.CommandContextFunctionMapper in project camunda-bpm-platform by camunda.
the class ProcessEngineConfigurationImpl method initExpressionManager.
protected void initExpressionManager() {
if (expressionManager == null) {
expressionManager = new ExpressionManager(beans);
}
// add function mapper for command context (eg currentUser(), currentUserGroups())
expressionManager.addFunctionMapper(new CommandContextFunctionMapper());
// add function mapper for date time (eg now(), dateTime())
expressionManager.addFunctionMapper(new DateTimeFunctionMapper());
}
use of org.camunda.bpm.engine.impl.el.CommandContextFunctionMapper in project camunda-bpm-platform by camunda.
the class CustomExpressionManagerTest method testBuiltinFunctionMapperRegistration.
@Test
public void testBuiltinFunctionMapperRegistration() {
// given a process engine configuration with a custom function mapper
ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda" + getClass().getSimpleName());
CustomExpressionManager customExpressionManager = new CustomExpressionManager();
Assert.assertTrue(customExpressionManager.getFunctionMappers().isEmpty());
config.setExpressionManager(customExpressionManager);
// when the engine is initialized
engine = config.buildProcessEngine();
// then two default function mappers should be registered
Assert.assertSame(customExpressionManager, config.getExpressionManager());
Assert.assertEquals(2, customExpressionManager.getFunctionMappers().size());
boolean commandContextMapperFound = false;
boolean dateTimeMapperFound = false;
for (FunctionMapper functionMapper : customExpressionManager.getFunctionMappers()) {
if (functionMapper instanceof CommandContextFunctionMapper) {
commandContextMapperFound = true;
}
if (functionMapper instanceof DateTimeFunctionMapper) {
dateTimeMapperFound = true;
}
}
Assert.assertTrue(commandContextMapperFound && dateTimeMapperFound);
}
Aggregations