use of org.camunda.bpm.engine.impl.persistence.entity.IdentityLinkEntity 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.impl.persistence.entity.IdentityLinkEntity in project camunda-bpm-platform by camunda.
the class GetIdentityLinksForTaskCmd method execute.
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<IdentityLink> execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("Cannot find task with id " + taskId, "task", task);
checkGetIdentityLink(task, commandContext);
List<IdentityLink> identityLinks = (List) task.getIdentityLinks();
// and of course this leads to exception while trying to delete a non-existing identityLink
if (task.getAssignee() != null) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setUserId(task.getAssignee());
identityLink.setTask(task);
identityLink.setType(IdentityLinkType.ASSIGNEE);
identityLinks.add(identityLink);
}
if (task.getOwner() != null) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setUserId(task.getOwner());
identityLink.setTask(task);
identityLink.setType(IdentityLinkType.OWNER);
identityLinks.add(identityLink);
}
return (List) task.getIdentityLinks();
}
Aggregations