use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class ItemHandler method initializeFieldDeclaration.
protected FieldDeclaration initializeFieldDeclaration(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaField field) {
String name = field.getCamundaName();
String type = Expression.class.getName();
Object value = getFixedValue(field);
if (value == null) {
ExpressionManager expressionManager = context.getExpressionManager();
value = getExpressionValue(field, expressionManager);
}
return new FieldDeclaration(name, type, value);
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class ProcessOrCaseTaskItemHandler method initializeOutputParameter.
protected void initializeOutputParameter(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CallableElement callableElement) {
ExpressionManager expressionManager = context.getExpressionManager();
List<CamundaOut> outputs = getOutputs(element);
for (CamundaOut output : outputs) {
// create new parameter
CallableElementParameter parameter = new CallableElementParameter();
callableElement.addOutput(parameter);
// all variables
String variables = output.getCamundaVariables();
if ("all".equals(variables)) {
parameter.setAllVariables(true);
continue;
}
// source/sourceExpression
String source = output.getCamundaSource();
if (source == null || source.isEmpty()) {
source = output.getCamundaSourceExpression();
}
ParameterValueProvider sourceValueProvider = createParameterValueProvider(source, expressionManager);
parameter.setSourceValueProvider(sourceValueProvider);
// target
String target = output.getCamundaTarget();
parameter.setTarget(target);
}
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class SentryHandler method initializeIfPart.
protected void initializeIfPart(IfPart ifPart, CmmnSentryDeclaration sentryDeclaration, CmmnHandlerContext context) {
if (ifPart == null) {
return;
}
Collection<ConditionExpression> conditions = ifPart.getConditions();
if (conditions.size() > 1) {
String id = sentryDeclaration.getId();
LOG.multipleIgnoredConditions(id);
}
ExpressionManager expressionManager = context.getExpressionManager();
ConditionExpression condition = conditions.iterator().next();
Expression conditionExpression = expressionManager.createExpression(condition.getText());
CmmnIfPartDeclaration ifPartDeclaration = new CmmnIfPartDeclaration();
ifPartDeclaration.setCondition(conditionExpression);
sentryDeclaration.setIfPart(ifPartDeclaration);
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class ParseUtil method parseRetryIntervals.
public static FailedJobRetryConfiguration parseRetryIntervals(String retryIntervals) {
if (retryIntervals != null && !retryIntervals.isEmpty()) {
if (StringUtil.isExpression(retryIntervals)) {
ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager();
Expression expression = expressionManager.createExpression(retryIntervals);
return new FailedJobRetryConfiguration(expression);
}
String[] intervals = StringUtil.split(retryIntervals, ",");
int retries = intervals.length + 1;
if (intervals.length == 1) {
try {
DurationHelper durationHelper = new DurationHelper(intervals[0]);
if (durationHelper.isRepeat()) {
retries = durationHelper.getTimes();
}
} catch (Exception e) {
LOG.logParsingRetryIntervals(intervals[0], e);
return null;
}
}
return new FailedJobRetryConfiguration(retries, Arrays.asList(intervals));
} else {
return null;
}
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class HumanTaskItemHandler method initializeTaskDefinitionName.
protected void initializeTaskDefinitionName(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
String name = getName(element);
if (name == null) {
HumanTask definition = getDefinition(element);
name = definition.getName();
}
if (name != null) {
ExpressionManager expressionManager = context.getExpressionManager();
Expression nameExpression = expressionManager.createExpression(name);
taskDefinition.setNameExpression(nameExpression);
}
}
Aggregations