org.camunda.bpm.engine.impl.el.ExpressionManager Java Examples
The following examples show how to use
org.camunda.bpm.engine.impl.el.ExpressionManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SentryHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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); }
Example #2
Source File: DefaultFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse) { this.deploymentId = deployment.getId(); ExpressionManager expressionManager = Context .getProcessEngineConfiguration() .getExpressionManager(); Element extensionElement = activityElement.element("extensionElements"); if (extensionElement != null) { // provide support for deprecated form properties parseFormProperties(bpmnParse, expressionManager, extensionElement); // provide support for new form field metadata parseFormData(bpmnParse, expressionManager, extensionElement); } }
Example #3
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override protected void initializeActivity(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) { // execute standard initialization super.initializeActivity(element, activity, context); // create a taskDefinition TaskDefinition taskDefinition = createTaskDefinition(element, context); // get the caseDefinition... CaseDefinitionEntity caseDefinition = (CaseDefinitionEntity) context.getCaseDefinition(); // ... and taskDefinition to caseDefinition caseDefinition.getTaskDefinitions().put(taskDefinition.getKey(), taskDefinition); ExpressionManager expressionManager = context.getExpressionManager(); // create decorator TaskDecorator taskDecorator = new TaskDecorator(taskDefinition, expressionManager); // set taskDecorator on behavior HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior(); behavior.setTaskDecorator(taskDecorator); // task listeners initializeTaskListeners(element, activity, context, taskDefinition); }
Example #4
Source File: ItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected Expression getExpressionValue(CamundaField field, ExpressionManager expressionManager) { CamundaExpression expression = field.getCamundaExpressionChild(); String value = null; if (expression != null) { value = expression.getTextContent(); } if (value == null) { value = field.getCamundaExpression(); } if (value != null) { return expressionManager.createExpression(value); } return null; }
Example #5
Source File: DefaultStartFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse) { super.parseConfiguration(activityElement, deployment, processDefinition, bpmnParse); ExpressionManager expressionManager = Context .getProcessEngineConfiguration() .getExpressionManager(); String formKeyAttribute = activityElement.attributeNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "formKey"); if (formKeyAttribute != null) { this.formKey = expressionManager.createExpression(formKeyAttribute); } if (formKey != null) { processDefinition.setStartFormKey(true); } }
Example #6
Source File: DefaultFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected void parseProperties(Element formField, FormFieldHandler formFieldHandler, BpmnParse bpmnParse, ExpressionManager expressionManager) { Element propertiesElement = formField.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "properties"); if(propertiesElement != null) { List<Element> propertyElements = propertiesElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "property"); // use linked hash map to preserve item ordering as provided in XML Map<String, String> propertyMap = new LinkedHashMap<String, String>(); for (Element property : propertyElements) { String id = property.attribute("id"); String value = property.attribute("value"); propertyMap.put(id, value); } formFieldHandler.setProperties(propertyMap); } }
Example #7
Source File: DefaultFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected void parseValidation(Element formField, FormFieldHandler formFieldHandler, BpmnParse bpmnParse, ExpressionManager expressionManager) { Element validationElement = formField.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "validation"); if(validationElement != null) { List<Element> constraintElements = validationElement.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "constraint"); for (Element property : constraintElements) { FormFieldValidator validator = Context.getProcessEngineConfiguration() .getFormValidators() .createValidator(property, bpmnParse, expressionManager); String validatorName = property.attribute("name"); String validatorConfig = property.attribute("config"); if(validator != null) { FormFieldValidationConstraintHandler handler = new FormFieldValidationConstraintHandler(); handler.setName(validatorName); handler.setConfig(validatorConfig); handler.setValidator(validator); formFieldHandler.getValidationHandlers().add(handler); } } } }
Example #8
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected void initializeTaskDefinitionAssignee(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) { HumanTask definition = getDefinition(element); Role performer = definition.getPerformer(); String assignee = null; if (performer != null) { assignee = performer.getName(); } else { assignee = definition.getCamundaAssignee(); } if (assignee != null) { ExpressionManager expressionManager = context.getExpressionManager(); Expression assigneeExpression = expressionManager.createExpression(assignee); taskDefinition.setAssigneeExpression(assigneeExpression); } }
Example #9
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initializeTaskDefinitionDueDate(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) { HumanTask definition = getDefinition(element); String dueDate = definition.getCamundaDueDate(); if (dueDate != null) { ExpressionManager expressionManager = context.getExpressionManager(); Expression dueDateExpression = expressionManager.createExpression(dueDate); taskDefinition.setDueDateExpression(dueDateExpression); } }
Example #10
Source File: HumanTaskPlanItemHandlerTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testExpressionManager() { // given: a plan item // when CmmnActivity activity = handler.handleElement(planItem, context); // then HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior(); ExpressionManager expressionManager = behavior.getExpressionManager(); assertNotNull(expressionManager); assertEquals(context.getExpressionManager(), expressionManager); }
Example #11
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initializeTaskDefinitionCandidateGroups(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) { HumanTask definition = getDefinition(element); ExpressionManager expressionManager = context.getExpressionManager(); List<String> candidateGroups = definition.getCamundaCandidateGroupsList(); for (String candidateGroup : candidateGroups) { Expression candidateGroupExpression = expressionManager.createExpression(candidateGroup); taskDefinition.addCandidateGroupIdExpression(candidateGroupExpression); } }
Example #12
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initializeTaskDefinitionCandidateUsers(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) { HumanTask definition = getDefinition(element); ExpressionManager expressionManager = context.getExpressionManager(); List<String> candidateUsers = definition.getCamundaCandidateUsersList(); for (String candidateUser : candidateUsers) { Expression candidateUserExpression = expressionManager.createExpression(candidateUser); taskDefinition.addCandidateUserIdExpression(candidateUserExpression); } }
Example #13
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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); } }
Example #14
Source File: DefaultFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void parseFormFields(Element formData, BpmnParse bpmnParse, ExpressionManager expressionManager) { // parse fields: List<Element> formFields = formData.elementsNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, FORM_FIELD_ELEMENT); for (Element formField : formFields) { parseFormField(formField, bpmnParse, expressionManager); } }
Example #15
Source File: DefaultFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void parseFormData(BpmnParse bpmnParse, ExpressionManager expressionManager, Element extensionElement) { Element formData = extensionElement.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "formData"); if(formData != null) { this.businessKeyFieldId = formData.attribute(BUSINESS_KEY_ATTRIBUTE); parseFormFields(formData, bpmnParse, expressionManager); } }
Example #16
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initializeTaskDefinitionFormKey(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) { HumanTask definition = getDefinition(element); String formKey = definition.getCamundaFormKey(); if (formKey != null) { ExpressionManager expressionManager = context.getExpressionManager(); Expression formKeyExpression = expressionManager.createExpression(formKey); taskDefinition.setFormKey(formKeyExpression); } }
Example #17
Source File: CallingTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected ParameterValueProvider createParameterValueProvider(String value, ExpressionManager expressionManager) { if (value == null) { return new NullValueProvider(); } else if (isCompositeExpression(value, expressionManager)) { Expression expression = expressionManager.createExpression(value); return new ElValueProvider(expression); } else { return new ConstantValueProvider(value); } }
Example #18
Source File: CallingTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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); }
Example #19
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initializeTaskDefinitionFollowUpDate(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) { HumanTask definition = getDefinition(element); String followUpDate = definition.getCamundaFollowUpDate(); if (followUpDate != null) { ExpressionManager expressionManager = context.getExpressionManager(); Expression followUpDateExpression = expressionManager.createExpression(followUpDate); taskDefinition.setFollowUpDateExpression(followUpDateExpression); } }
Example #20
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void initializeTaskDefinitionPriority(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) { HumanTask definition = getDefinition(element); String priority = definition.getCamundaPriority(); if (priority != null) { ExpressionManager expressionManager = context.getExpressionManager(); Expression priorityExpression = expressionManager.createExpression(priority); taskDefinition.setPriorityExpression(priorityExpression); } }
Example #21
Source File: HumanTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected TaskListener initializeTaskListener(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaTaskListener listener) { Collection<CamundaField> fields = listener.getCamundaFields(); List<FieldDeclaration> fieldDeclarations = initializeFieldDeclarations(element, activity, context, fields); ExpressionManager expressionManager = context.getExpressionManager(); TaskListener taskListener = null; String className = listener.getCamundaClass(); String expression = listener.getCamundaExpression(); String delegateExpression = listener.getCamundaDelegateExpression(); CamundaScript scriptElement = listener.getCamundaScript(); if (className != null) { taskListener = new ClassDelegateTaskListener(className, fieldDeclarations); } else if (expression != null) { Expression expressionExp = expressionManager.createExpression(expression); taskListener = new ExpressionTaskListener(expressionExp); } else if (delegateExpression != null) { Expression delegateExp = expressionManager.createExpression(delegateExpression); taskListener = new DelegateExpressionTaskListener(delegateExp, fieldDeclarations); } else if (scriptElement != null) { ExecutableScript executableScript = initializeScript(element, activity, context, scriptElement); if (executableScript != null) { taskListener = new ScriptTaskListener(executableScript); } } return taskListener; }
Example #22
Source File: ItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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; }
Example #23
Source File: ItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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; }
Example #24
Source File: ItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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); }
Example #25
Source File: ProcessOrCaseTaskItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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); } }
Example #26
Source File: ScriptUtil.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * Creates a new {@link ExecutableScript} from a source. It excepts static and dynamic sources. * Dynamic means that the source is an expression which will be evaluated during execution. * * @param language the language of the script * @param source the source code of the script or an expression which evaluates to the source code * @param expressionManager the expression manager to use to generate the expressions of dynamic scripts * @param scriptFactory the script factory used to create the script * @return the newly created script * @throws NotValidException if language is null or empty or source is null */ public static ExecutableScript getScriptFormSource(String language, String source, ExpressionManager expressionManager, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotNull(NotValidException.class, "Script source", source); if (isDynamicScriptExpression(language, source)) { Expression sourceExpression = expressionManager.createExpression(source); return getScriptFromSourceExpression(language, sourceExpression, scriptFactory); } else { return getScriptFromSource(language, source, scriptFactory); } }
Example #27
Source File: ScriptUtil.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * Creates a new {@link ExecutableScript} from a resource. It excepts static and dynamic resources. * Dynamic means that the resource is an expression which will be evaluated during execution. * * @param language the language of the script * @param resource the resource path of the script code or an expression which evaluates to the resource path * @param expressionManager the expression manager to use to generate the expressions of dynamic scripts * @param scriptFactory the script factory used to create the script * @return the newly created script * @throws NotValidException if language or resource are null or empty */ public static ExecutableScript getScriptFromResource(String language, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotEmpty(NotValidException.class, "Script resource", resource); if (isDynamicScriptExpression(language, resource)) { Expression resourceExpression = expressionManager.createExpression(resource); return getScriptFromResourceExpression(language, resourceExpression, scriptFactory); } else { return getScriptFromResource(language, resource, scriptFactory); } }
Example #28
Source File: ParseUtil.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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; } }
Example #29
Source File: ItemHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected CaseControlRule initializeCaseControlRule(ConditionExpression condition, CmmnHandlerContext context) { Expression expression = null; if (condition != null) { String rule = condition.getText(); if (rule != null && !rule.isEmpty()) { ExpressionManager expressionManager = context.getExpressionManager(); expression = expressionManager.createExpression(rule); } } return new CaseControlRuleImpl(expression); }
Example #30
Source File: TaskDecorator.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public TaskDecorator(TaskDefinition taskDefinition, ExpressionManager expressionManager) { this.taskDefinition = taskDefinition; this.expressionManager = expressionManager; }