use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class ItemHandler method initializeVariableListener.
protected CaseVariableListener initializeVariableListener(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaVariableListener listener) {
Collection<CamundaField> fields = listener.getCamundaFields();
List<FieldDeclaration> fieldDeclarations = initializeFieldDeclarations(element, activity, context, fields);
ExpressionManager expressionManager = context.getExpressionManager();
String className = listener.getCamundaClass();
String expression = listener.getCamundaExpression();
String delegateExpression = listener.getCamundaDelegateExpression();
CamundaScript scriptElement = listener.getCamundaScript();
CaseVariableListener variableListener = null;
if (className != null) {
variableListener = new ClassDelegateCaseVariableListener(className, fieldDeclarations);
} else if (expression != null) {
Expression expressionExp = expressionManager.createExpression(expression);
variableListener = new ExpressionCaseVariableListener(expressionExp);
} else if (delegateExpression != null) {
Expression delegateExp = expressionManager.createExpression(delegateExpression);
variableListener = new DelegateExpressionCaseVariableListener(delegateExp, fieldDeclarations);
} else if (scriptElement != null) {
ExecutableScript executableScript = initializeScript(element, activity, context, scriptElement);
if (executableScript != null) {
variableListener = new ScriptCaseVariableListener(executableScript);
}
}
return variableListener;
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class ItemHandler method initializeCaseExecutionListener.
protected CaseExecutionListener initializeCaseExecutionListener(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaCaseExecutionListener listener) {
Collection<CamundaField> fields = listener.getCamundaFields();
List<FieldDeclaration> fieldDeclarations = initializeFieldDeclarations(element, activity, context, fields);
ExpressionManager expressionManager = context.getExpressionManager();
CaseExecutionListener caseExecutionListener = null;
String className = listener.getCamundaClass();
String expression = listener.getCamundaExpression();
String delegateExpression = listener.getCamundaDelegateExpression();
CamundaScript scriptElement = listener.getCamundaScript();
if (className != null) {
caseExecutionListener = new ClassDelegateCaseExecutionListener(className, fieldDeclarations);
} else if (expression != null) {
Expression expressionExp = expressionManager.createExpression(expression);
caseExecutionListener = new ExpressionCaseExecutionListener(expressionExp);
} else if (delegateExpression != null) {
Expression delegateExp = expressionManager.createExpression(delegateExpression);
caseExecutionListener = new DelegateExpressionCaseExecutionListener(delegateExp, fieldDeclarations);
} else if (scriptElement != null) {
ExecutableScript executableScript = initializeScript(element, activity, context, scriptElement);
if (executableScript != null) {
caseExecutionListener = new ScriptCaseExecutionListener(executableScript);
}
}
return caseExecutionListener;
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class ProcessOrCaseTaskItemHandler method initializeInputParameter.
protected void initializeInputParameter(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CallableElement callableElement) {
ExpressionManager expressionManager = context.getExpressionManager();
List<CamundaIn> inputs = getInputs(element);
for (CamundaIn input : inputs) {
// businessKey
String businessKey = input.getCamundaBusinessKey();
if (businessKey != null && !businessKey.isEmpty()) {
ParameterValueProvider businessKeyValueProvider = createParameterValueProvider(businessKey, expressionManager);
callableElement.setBusinessKeyValueProvider(businessKeyValueProvider);
} else {
// create new parameter
CallableElementParameter parameter = new CallableElementParameter();
callableElement.addInput(parameter);
if (input.getCamundaLocal()) {
parameter.setReadLocal(true);
}
// all variables
String variables = input.getCamundaVariables();
if ("all".equals(variables)) {
parameter.setAllVariables(true);
continue;
}
// source/sourceExpression
String source = input.getCamundaSource();
if (source == null || source.isEmpty()) {
source = input.getCamundaSourceExpression();
}
ParameterValueProvider sourceValueProvider = createParameterValueProvider(source, expressionManager);
parameter.setSourceValueProvider(sourceValueProvider);
// target
String target = input.getCamundaTarget();
parameter.setTarget(target);
}
}
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class CallingTaskItemHandler method initializeVersion.
protected void initializeVersion(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement) {
ExpressionManager expressionManager = context.getExpressionManager();
String version = getVersion(element, activity, context);
ParameterValueProvider versionProvider = createParameterValueProvider(version, expressionManager);
callableElement.setVersionValueProvider(versionProvider);
}
use of org.camunda.bpm.engine.impl.el.ExpressionManager in project camunda-bpm-platform by camunda.
the class CallingTaskItemHandler method initializeTenantId.
protected void initializeTenantId(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement) {
ParameterValueProvider tenantIdProvider;
ExpressionManager expressionManager = context.getExpressionManager();
String tenantId = getTenantId(element, activity, context);
if (tenantId != null && tenantId.length() > 0) {
tenantIdProvider = createParameterValueProvider(tenantId, expressionManager);
} else {
tenantIdProvider = new DefaultCallableElementTenantIdProvider();
}
callableElement.setTenantIdProvider(tenantIdProvider);
}
Aggregations