use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.
the class TaskDecoratorTest method testDecorateCandidateGroups.
public void testDecorateCandidateGroups() {
// given
List<String> aCandidateGroupList = new ArrayList<String>();
aCandidateGroupList.add("management");
aCandidateGroupList.add("accounting");
aCandidateGroupList.add("backoffice");
for (String candidateGroup : aCandidateGroupList) {
Expression candidateGroupExpression = expressionManager.createExpression(candidateGroup);
taskDefinition.addCandidateGroupIdExpression(candidateGroupExpression);
}
// when
decorate(task, taskDecorator);
// then
Set<IdentityLink> candidates = task.getCandidates();
assertEquals(3, candidates.size());
for (IdentityLink identityLink : candidates) {
String taskId = identityLink.getTaskId();
assertEquals(task.getId(), taskId);
assertEquals(IdentityLinkType.CANDIDATE, identityLink.getType());
String groupId = identityLink.getGroupId();
if ("management".equals(groupId)) {
assertEquals("management", groupId);
} else if ("accounting".equals(groupId)) {
assertEquals("accounting", groupId);
} else if ("backoffice".equals(groupId)) {
assertEquals("backoffice", groupId);
} else {
fail("Unexpected group: " + groupId);
}
}
}
use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.
the class ProcessEngineTestRule method defaultManualActivation.
public Object defaultManualActivation() {
Expression expression = new FixedValue(true);
CaseControlRuleImpl caseControlRule = new CaseControlRuleImpl(expression);
return caseControlRule;
}
use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.
the class SpinFunctionMapperTest method executeExpression.
@SuppressWarnings("unchecked")
protected <T> T executeExpression(String expression) {
final TestVariableScope varScope = new TestVariableScope();
final Expression compiledExpression = processEngineConfiguration.getExpressionManager().createExpression(expression);
return (T) processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
return compiledExpression.getValue(varScope);
}
});
}
use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.
the class BpmnDeployer method addAuthorizationsFromIterator.
protected void addAuthorizationsFromIterator(Set<Expression> exprSet, ProcessDefinitionEntity processDefinition, ExprType exprType) {
if (exprSet != null) {
for (Expression expr : exprSet) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setProcessDef(processDefinition);
if (exprType.equals(ExprType.USER)) {
identityLink.setUserId(expr.toString());
} else if (exprType.equals(ExprType.GROUP)) {
identityLink.setGroupId(expr.toString());
}
identityLink.setType(IdentityLinkType.CANDIDATE);
identityLink.setTenantId(processDefinition.getTenantId());
identityLink.insert();
}
}
}
use of org.camunda.bpm.engine.delegate.Expression in project camunda-bpm-platform by camunda.
the class DefaultTaskFormHandler method createTaskForm.
public TaskFormData createTaskForm(TaskEntity task) {
TaskFormDataImpl taskFormData = new TaskFormDataImpl();
Expression formKey = task.getTaskDefinition().getFormKey();
if (formKey != null) {
Object formValue = formKey.getValue(task);
if (formValue != null) {
taskFormData.setFormKey(formValue.toString());
}
}
taskFormData.setDeploymentId(deploymentId);
taskFormData.setTask(task);
initializeFormProperties(taskFormData, task.getExecution());
initializeFormFields(taskFormData, task.getExecution());
return taskFormData;
}
Aggregations