use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.
the class BpmnParseUtil method parseInputParameterElement.
/**
* Parses a input parameter and adds it to the {@link IoMapping}.
*
* @param inputParameterElement the input parameter element
* @param ioMapping the mapping to add the element
* @throws BpmnParseException if the input parameter element is malformed
*/
public static void parseInputParameterElement(Element inputParameterElement, IoMapping ioMapping) {
String nameAttribute = inputParameterElement.attribute("name");
if (nameAttribute == null || nameAttribute.isEmpty()) {
throw new BpmnParseException("Missing attribute 'name' for inputParameter", inputParameterElement);
}
ParameterValueProvider valueProvider = parseNestedParamValueProvider(inputParameterElement);
// add parameter
ioMapping.addInputParameter(new InputParameter(nameAttribute, valueProvider));
}
use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.
the class BpmnParseUtil method parseOutputParameterElement.
/**
* Parses a output parameter and adds it to the {@link IoMapping}.
*
* @param outputParameterElement the output parameter element
* @param ioMapping the mapping to add the element
* @throws BpmnParseException if the output parameter element is malformed
*/
public static void parseOutputParameterElement(Element outputParameterElement, IoMapping ioMapping) {
String nameAttribute = outputParameterElement.attribute("name");
if (nameAttribute == null || nameAttribute.isEmpty()) {
throw new BpmnParseException("Missing attribute 'name' for outputParameter", outputParameterElement);
}
ParameterValueProvider valueProvider = parseNestedParamValueProvider(outputParameterElement);
// add parameter
ioMapping.addOutputParameter(new OutputParameter(nameAttribute, valueProvider));
}
use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.
the class BpmnParse method parseDmnBusinessRuleTask.
/**
* Parse a Business Rule Task which references a decision.
*/
protected ActivityImpl parseDmnBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope) {
ActivityImpl activity = createActivityOnScope(businessRuleTaskElement, scope);
// the activity is a scope since the result variable is stored as local variable
activity.setScope(true);
parseAsynchronousContinuationForActivity(businessRuleTaskElement, activity);
String decisionRef = businessRuleTaskElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "decisionRef");
BaseCallableElement callableElement = new BaseCallableElement();
callableElement.setDeploymentId(deployment.getId());
ParameterValueProvider definitionKeyProvider = createParameterValueProvider(decisionRef, expressionManager);
callableElement.setDefinitionKeyValueProvider(definitionKeyProvider);
parseBinding(businessRuleTaskElement, activity, callableElement, "decisionRefBinding");
parseVersion(businessRuleTaskElement, activity, callableElement, "decisionRefBinding", "decisionRefVersion");
parseTenantId(businessRuleTaskElement, activity, callableElement, "decisionRefTenantId");
String resultVariable = parseResultVariable(businessRuleTaskElement);
DecisionResultMapper decisionResultMapper = parseDecisionResultMapper(businessRuleTaskElement);
DmnBusinessRuleTaskActivityBehavior behavior = new DmnBusinessRuleTaskActivityBehavior(callableElement, resultVariable, decisionResultMapper);
activity.setActivityBehavior(behavior);
parseExecutionListenersOnScope(businessRuleTaskElement, activity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseBusinessRuleTask(businessRuleTaskElement, scope, activity);
}
return activity;
}
use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.
the class BpmnParse method parseCallableElementProvider.
protected CallableElementParameter parseCallableElementProvider(Element parameterElement) {
CallableElementParameter parameter = new CallableElementParameter();
String variables = parameterElement.attribute("variables");
if (ALL.equals(variables)) {
parameter.setAllVariables(true);
} else {
boolean strictValidation = !Context.getProcessEngineConfiguration().getDisableStrictCallActivityValidation();
ParameterValueProvider sourceValueProvider = new NullValueProvider();
String source = parameterElement.attribute("source");
if (source != null) {
if (!source.isEmpty()) {
sourceValueProvider = new ConstantValueProvider(source);
} else {
if (strictValidation) {
addError("Empty attribute 'source' when passing variables", parameterElement);
} else {
source = null;
}
}
}
if (source == null) {
source = parameterElement.attribute("sourceExpression");
if (source != null) {
if (!source.isEmpty()) {
Expression expression = expressionManager.createExpression(source);
sourceValueProvider = new ElValueProvider(expression);
} else if (strictValidation) {
addError("Empty attribute 'sourceExpression' when passing variables", parameterElement);
}
}
}
if (strictValidation && source == null) {
addError("Missing parameter 'source' or 'sourceExpression' when passing variables", parameterElement);
}
parameter.setSourceValueProvider(sourceValueProvider);
String target = parameterElement.attribute("target");
if ((strictValidation || source != null && !source.isEmpty()) && target == null) {
addError("Missing attribute 'target' when attribute 'source' or 'sourceExpression' is set", parameterElement);
} else if (strictValidation && target != null && target.isEmpty()) {
addError("Empty attribute 'target' when attribute 'source' or 'sourceExpression' is set", parameterElement);
}
parameter.setTarget(target);
}
return parameter;
}
use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.
the class BpmnParse method parseInputParameter.
protected void parseInputParameter(Element elementWithParameters, CallableElement callableElement) {
Element extensionsElement = elementWithParameters.element("extensionElements");
if (extensionsElement != null) {
// input data elements
for (Element inElement : extensionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "in")) {
String businessKey = inElement.attribute("businessKey");
if (businessKey != null && !businessKey.isEmpty()) {
ParameterValueProvider businessKeyValueProvider = createParameterValueProvider(businessKey, expressionManager);
callableElement.setBusinessKeyValueProvider(businessKeyValueProvider);
} else {
CallableElementParameter parameter = parseCallableElementProvider(inElement);
if (attributeValueEquals(inElement, "local", TRUE)) {
parameter.setReadLocal(true);
}
callableElement.addInput(parameter);
}
}
}
}
Aggregations