Java Code Examples for org.activiti.engine.impl.el.ExpressionManager#createExpression()
The following examples show how to use
org.activiti.engine.impl.el.ExpressionManager#createExpression() .
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: CallActivityBehavior.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws Exception { // only data. no control flow available on this execution. ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); // copy process variables ExecutionEntity executionEntity = (ExecutionEntity) execution; CallActivity callActivity = (CallActivity) executionEntity.getCurrentFlowElement(); for (IOParameter ioParameter : callActivity.getOutParameters()) { Object value = null; if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) { Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim()); value = expression.getValue(subProcessInstance); } else { value = subProcessInstance.getVariable(ioParameter.getSource()); } execution.setVariable(ioParameter.getTarget(), value); } }
Example 2
Source File: WebServiceActivityBehavior.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected AbstractDataAssociation createDataInputAssociation(DataAssociation dataAssociationElement) { if (dataAssociationElement.getAssignments().isEmpty()) { return new MessageImplicitDataInputAssociation(dataAssociationElement.getSourceRef(), dataAssociationElement.getTargetRef()); } else { SimpleDataInputAssociation dataAssociation = new SimpleDataInputAssociation(dataAssociationElement.getSourceRef(), dataAssociationElement.getTargetRef()); ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); for (org.activiti.bpmn.model.Assignment assignmentElement : dataAssociationElement.getAssignments()) { if (StringUtils.isNotEmpty(assignmentElement.getFrom()) && StringUtils.isNotEmpty(assignmentElement.getTo())) { Expression from = expressionManager.createExpression(assignmentElement.getFrom()); Expression to = expressionManager.createExpression(assignmentElement.getTo()); Assignment assignment = new Assignment(from, to); dataAssociation.addAssignment(assignment); } } return dataAssociation; } }
Example 3
Source File: DelegateHelper.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
/** * Creates an {@link Expression} for the {@link FieldExtension}. */ public static Expression createExpressionForField(FieldExtension fieldExtension) { if (StringUtils.isNotEmpty(fieldExtension.getExpression())) { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); return expressionManager.createExpression(fieldExtension.getExpression()); } else { return new FixedValue(fieldExtension.getStringValue()); } }
Example 4
Source File: DefaultFormHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void parseConfiguration(List<org.activiti.bpmn.model.FormProperty> formProperties, String formKey, DeploymentEntity deployment, ProcessDefinition processDefinition) { this.deploymentId = deployment.getId(); ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); if (StringUtils.isNotEmpty(formKey)) { this.formKey = expressionManager.createExpression(formKey); } FormTypes formTypes = Context.getProcessEngineConfiguration().getFormTypes(); for (org.activiti.bpmn.model.FormProperty formProperty : formProperties) { FormPropertyHandler formPropertyHandler = new FormPropertyHandler(); formPropertyHandler.setId(formProperty.getId()); formPropertyHandler.setName(formProperty.getName()); AbstractFormType type = formTypes.parseFormPropertyType(formProperty); formPropertyHandler.setType(type); formPropertyHandler.setRequired(formProperty.isRequired()); formPropertyHandler.setReadable(formProperty.isReadable()); formPropertyHandler.setWritable(formProperty.isWriteable()); formPropertyHandler.setVariableName(formProperty.getVariable()); if (StringUtils.isNotEmpty(formProperty.getExpression())) { Expression expression = expressionManager.createExpression(formProperty.getExpression()); formPropertyHandler.setVariableExpression(expression); } if (StringUtils.isNotEmpty(formProperty.getDefaultExpression())) { Expression defaultExpression = expressionManager.createExpression(formProperty.getDefaultExpression()); formPropertyHandler.setDefaultExpression(defaultExpression); } formPropertyHandlers.add(formPropertyHandler); } }
Example 5
Source File: WebServiceActivityBehavior.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected AbstractDataAssociation createDataOutputAssociation(DataAssociation dataAssociationElement) { if (StringUtils.isNotEmpty(dataAssociationElement.getSourceRef())) { return new MessageImplicitDataOutputAssociation(dataAssociationElement.getTargetRef(), dataAssociationElement.getSourceRef()); } else { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); Expression transformation = expressionManager.createExpression(dataAssociationElement.getTransformation()); AbstractDataAssociation dataOutputAssociation = new TransformationDataOutputAssociation(null, dataAssociationElement.getTargetRef(), transformation); return dataOutputAssociation; } }
Example 6
Source File: SequenceFlowParseHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected void executeParse(BpmnParse bpmnParse, SequenceFlow sequenceFlow) { ScopeImpl scope = bpmnParse.getCurrentScope(); ActivityImpl sourceActivity = scope.findActivity(sequenceFlow.getSourceRef()); ActivityImpl destinationActivity = scope.findActivity(sequenceFlow.getTargetRef()); Expression skipExpression; if (StringUtils.isNotEmpty(sequenceFlow.getSkipExpression())) { ExpressionManager expressionManager = bpmnParse.getExpressionManager(); skipExpression = expressionManager.createExpression(sequenceFlow.getSkipExpression()); } else { skipExpression = null; } TransitionImpl transition = sourceActivity.createOutgoingTransition(sequenceFlow.getId(), skipExpression); bpmnParse.getSequenceFlows().put(sequenceFlow.getId(), transition); transition.setProperty("name", sequenceFlow.getName()); transition.setProperty("documentation", sequenceFlow.getDocumentation()); transition.setDestination(destinationActivity); if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { Condition expressionCondition = new UelExpressionCondition(sequenceFlow.getConditionExpression()); transition.setProperty(PROPERTYNAME_CONDITION_TEXT, sequenceFlow.getConditionExpression()); transition.setProperty(PROPERTYNAME_CONDITION, expressionCondition); } createExecutionListenersOnTransition(bpmnParse, sequenceFlow.getExecutionListeners(), transition); }
Example 7
Source File: SkipEventListener.java From lemon with Apache License 2.0 | 5 votes |
public void doSkip(DelegateTask delegateTask) { delegateTask.getExecution().setVariableLocal( "_ACTIVITI_SKIP_EXPRESSION_ENABLED", true); TaskDefinition taskDefinition = ((TaskEntity) delegateTask) .getTaskDefinition(); ExpressionManager expressionManager = Context .getProcessEngineConfiguration().getExpressionManager(); Expression expression = expressionManager .createExpression("${_ACTIVITI_SKIP_EXPRESSION_ENABLED}"); taskDefinition.setSkipExpression(expression); }
Example 8
Source File: DefaultFormHandler.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void parseConfiguration(List<org.flowable.bpmn.model.FormProperty> formProperties, String formKey, DeploymentEntity deployment, ProcessDefinition processDefinition) { this.deploymentId = deployment.getId(); ExpressionManager expressionManager = Context .getProcessEngineConfiguration() .getExpressionManager(); if (StringUtils.isNotEmpty(formKey)) { this.formKey = expressionManager.createExpression(formKey); } FormTypes formTypes = Context .getProcessEngineConfiguration() .getFormTypes(); for (org.flowable.bpmn.model.FormProperty formProperty : formProperties) { FormPropertyHandler formPropertyHandler = new FormPropertyHandler(); formPropertyHandler.setId(formProperty.getId()); formPropertyHandler.setName(formProperty.getName()); AbstractFormType type = formTypes.parseFormPropertyType(formProperty); formPropertyHandler.setType(type); formPropertyHandler.setRequired(formProperty.isRequired()); formPropertyHandler.setReadable(formProperty.isReadable()); formPropertyHandler.setWritable(formProperty.isWriteable()); formPropertyHandler.setVariableName(formProperty.getVariable()); if (StringUtils.isNotEmpty(formProperty.getExpression())) { Expression expression = expressionManager.createExpression(formProperty.getExpression()); formPropertyHandler.setVariableExpression(expression); } if (StringUtils.isNotEmpty(formProperty.getDefaultExpression())) { Expression defaultExpression = expressionManager.createExpression(formProperty.getDefaultExpression()); formPropertyHandler.setDefaultExpression(defaultExpression); } formPropertyHandlers.add(formPropertyHandler); } }
Example 9
Source File: TimerEventDefinitionParseHandler.java From flowable-engine with Apache License 2.0 | 4 votes |
protected TimerDeclarationImpl createTimer(BpmnParse bpmnParse, TimerEventDefinition timerEventDefinition, ScopeImpl timerActivity, String jobHandlerType) { TimerDeclarationType type = null; Expression expression = null; Expression endDate = null; Expression calendarName = null; ExpressionManager expressionManager = bpmnParse.getExpressionManager(); if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDate())) { // TimeDate type = TimerDeclarationType.DATE; expression = expressionManager.createExpression(timerEventDefinition.getTimeDate()); } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeCycle())) { // TimeCycle type = TimerDeclarationType.CYCLE; expression = expressionManager.createExpression(timerEventDefinition.getTimeCycle()); // support for endDate if (StringUtils.isNotEmpty(timerEventDefinition.getEndDate())) { endDate = expressionManager.createExpression(timerEventDefinition.getEndDate()); } } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDuration())) { // TimeDuration type = TimerDeclarationType.DURATION; expression = expressionManager.createExpression(timerEventDefinition.getTimeDuration()); } if (StringUtils.isNotEmpty(timerEventDefinition.getCalendarName())) { calendarName = expressionManager.createExpression(timerEventDefinition.getCalendarName()); } // neither date, cycle or duration configured! if (expression == null) { LOGGER.warn("Timer needs configuration (either timeDate, timeCycle or timeDuration is needed) ({})", timerActivity.getId()); } String jobHandlerConfiguration = timerActivity.getId(); if (jobHandlerType.equalsIgnoreCase(TimerExecuteNestedActivityJobHandler.TYPE) || jobHandlerType.equalsIgnoreCase(TimerCatchIntermediateEventJobHandler.TYPE) || jobHandlerType.equalsIgnoreCase(TimerStartEventJobHandler.TYPE)) { jobHandlerConfiguration = TimerStartEventJobHandler.createConfiguration(timerActivity.getId(), endDate, calendarName); } // Parse the timer declaration // TODO move the timer declaration into the bpmn activity or next to the // TimerSession TimerDeclarationImpl timerDeclaration = new TimerDeclarationImpl(expression, type, jobHandlerType, endDate, calendarName); timerDeclaration.setJobHandlerConfiguration(jobHandlerConfiguration); timerDeclaration.setExclusive(true); return timerDeclaration; }
Example 10
Source File: AutoCompleteFirstTaskEventListener.java From lemon with Apache License 2.0 | 4 votes |
public void onCreate(DelegateTask delegateTask) throws Exception { String initiatorId = Authentication.getAuthenticatedUserId(); if (initiatorId == null) { return; } String assignee = delegateTask.getAssignee(); if (assignee == null) { return; } if (!initiatorId.equals(assignee)) { return; } PvmActivity targetActivity = this.findFirstActivity(delegateTask .getProcessDefinitionId()); logger.debug("targetActivity : {}", targetActivity); if (!targetActivity.getId().equals( delegateTask.getExecution().getCurrentActivityId())) { return; } logger.debug("auto complete first task : {}", delegateTask); for (IdentityLink identityLink : delegateTask.getCandidates()) { String userId = identityLink.getUserId(); String groupId = identityLink.getGroupId(); if (userId != null) { delegateTask.deleteCandidateUser(userId); } if (groupId != null) { delegateTask.deleteCandidateGroup(groupId); } } // 对提交流程的任务进行特殊处理 HumanTaskDTO humanTaskDto = humanTaskConnector .findHumanTaskByTaskId(delegateTask.getId()); humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START); humanTaskConnector.saveHumanTask(humanTaskDto); // ((TaskEntity) delegateTask).complete(); // Context.getCommandContext().getHistoryManager().recordTaskId((TaskEntity) delegateTask); // Context.getCommandContext().getHistoryManager().recordTaskId((TaskEntity) delegateTask); // new CompleteTaskWithCommentCmd(delegateTask.getId(), null, "发起流程") // .execute(Context.getCommandContext()); // 因为recordTaskId()会判断endTime,而complete以后会导致endTime!=null, // 所以才会出现record()放在complete后面导致taskId没记录到historyActivity里的情况 delegateTask.getExecution().setVariableLocal( "_ACTIVITI_SKIP_EXPRESSION_ENABLED", true); TaskDefinition taskDefinition = ((TaskEntity) delegateTask) .getTaskDefinition(); ExpressionManager expressionManager = Context .getProcessEngineConfiguration().getExpressionManager(); Expression expression = expressionManager .createExpression("${_ACTIVITI_SKIP_EXPRESSION_ENABLED}"); taskDefinition.setSkipExpression(expression); }