use of org.activiti.engine.impl.el.ExpressionManager in project Activiti by Activiti.
the class SequenceFlowParseHandler method executeParse.
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);
}
use of org.activiti.engine.impl.el.ExpressionManager in project Activiti by Activiti.
the class UserTaskParseHandler method parseTaskDefinition.
public TaskDefinition parseTaskDefinition(BpmnParse bpmnParse, UserTask userTask, String taskDefinitionKey, ProcessDefinitionEntity processDefinition) {
TaskFormHandler taskFormHandler = new DefaultTaskFormHandler();
taskFormHandler.parseConfiguration(userTask.getFormProperties(), userTask.getFormKey(), bpmnParse.getDeployment(), processDefinition);
TaskDefinition taskDefinition = new TaskDefinition(taskFormHandler);
taskDefinition.setKey(taskDefinitionKey);
processDefinition.getTaskDefinitions().put(taskDefinitionKey, taskDefinition);
ExpressionManager expressionManager = bpmnParse.getExpressionManager();
if (StringUtils.isNotEmpty(userTask.getName())) {
taskDefinition.setNameExpression(expressionManager.createExpression(userTask.getName()));
}
if (StringUtils.isNotEmpty(userTask.getDocumentation())) {
taskDefinition.setDescriptionExpression(expressionManager.createExpression(userTask.getDocumentation()));
}
if (StringUtils.isNotEmpty(userTask.getAssignee())) {
taskDefinition.setAssigneeExpression(expressionManager.createExpression(userTask.getAssignee()));
}
if (StringUtils.isNotEmpty(userTask.getOwner())) {
taskDefinition.setOwnerExpression(expressionManager.createExpression(userTask.getOwner()));
}
for (String candidateUser : userTask.getCandidateUsers()) {
taskDefinition.addCandidateUserIdExpression(expressionManager.createExpression(candidateUser));
}
for (String candidateGroup : userTask.getCandidateGroups()) {
taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(candidateGroup));
}
// Task listeners
for (ActivitiListener taskListener : userTask.getTaskListeners()) {
taskDefinition.addTaskListener(taskListener.getEvent(), createTaskListener(bpmnParse, taskListener, userTask.getId()));
}
// Due date
if (StringUtils.isNotEmpty(userTask.getDueDate())) {
taskDefinition.setDueDateExpression(expressionManager.createExpression(userTask.getDueDate()));
}
// Business calendar name
if (StringUtils.isNotEmpty(userTask.getBusinessCalendarName())) {
taskDefinition.setBusinessCalendarNameExpression(expressionManager.createExpression(userTask.getBusinessCalendarName()));
} else {
taskDefinition.setBusinessCalendarNameExpression(expressionManager.createExpression(DueDateBusinessCalendar.NAME));
}
// Category
if (StringUtils.isNotEmpty(userTask.getCategory())) {
taskDefinition.setCategoryExpression(expressionManager.createExpression(userTask.getCategory()));
}
// Priority
if (StringUtils.isNotEmpty(userTask.getPriority())) {
taskDefinition.setPriorityExpression(expressionManager.createExpression(userTask.getPriority()));
}
if (StringUtils.isNotEmpty(userTask.getFormKey())) {
taskDefinition.setFormKeyExpression(expressionManager.createExpression(userTask.getFormKey()));
}
// CustomUserIdentityLinks
for (String customUserIdentityLinkType : userTask.getCustomUserIdentityLinks().keySet()) {
Set<Expression> userIdentityLinkExpression = new HashSet<Expression>();
for (String userIdentityLink : userTask.getCustomUserIdentityLinks().get(customUserIdentityLinkType)) {
userIdentityLinkExpression.add(expressionManager.createExpression(userIdentityLink));
}
taskDefinition.addCustomUserIdentityLinkExpression(customUserIdentityLinkType, userIdentityLinkExpression);
}
// CustomGroupIdentityLinks
for (String customGroupIdentityLinkType : userTask.getCustomGroupIdentityLinks().keySet()) {
Set<Expression> groupIdentityLinkExpression = new HashSet<Expression>();
for (String groupIdentityLink : userTask.getCustomGroupIdentityLinks().get(customGroupIdentityLinkType)) {
groupIdentityLinkExpression.add(expressionManager.createExpression(groupIdentityLink));
}
taskDefinition.addCustomGroupIdentityLinkExpression(customGroupIdentityLinkType, groupIdentityLinkExpression);
}
if (StringUtils.isNotEmpty(userTask.getSkipExpression())) {
taskDefinition.setSkipExpression(expressionManager.createExpression(userTask.getSkipExpression()));
}
return taskDefinition;
}
Aggregations