public virtual void AddAuthorizationsFromIterator(ISet <IExpression> exprSet, ESS.FW.Bpm.Engine.Persistence.Entity.ProcessDefinitionEntity processDefinition, ExprType exprType) { if (exprSet != null) { foreach (IExpression expr in exprSet) { IdentityLinkEntity identityLink = new IdentityLinkEntity(); identityLink.ProcessDef = processDefinition; if (exprType.Equals(ExprType.User)) { identityLink.UserId = expr.ToString(); } else if (exprType.Equals(ExprType.Group)) { identityLink.GroupId = expr.ToString(); } identityLink.Type = ESS.FW.Bpm.Engine.Task.IdentityLinkType.Candidate; identityLink.Insert(); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings({"unchecked", "rawtypes" }) public java.util.List<org.camunda.bpm.engine.task.IdentityLink> execute(org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) public virtual IList <IdentityLink> execute(CommandContext commandContext) { ensureNotNull("taskId", taskId); TaskManager taskManager = commandContext.TaskManager; TaskEntity task = taskManager.findTaskById(taskId); ensureNotNull("Cannot find task with id " + taskId, "task", task); checkGetIdentityLink(task, commandContext); IList <IdentityLink> identityLinks = (System.Collections.IList)task.IdentityLinks; // assignee is not part of identity links in the db. // so if there is one, we add it here. // @Tom: we discussed this long on skype and you agreed ;-) // an assignee *is* an identityLink, and so must it be reflected in the API // // Note: we cant move this code to the TaskEntity (which would be cleaner), // since the task.delete cascased to all associated identityLinks // and of course this leads to exception while trying to delete a non-existing identityLink if (!string.ReferenceEquals(task.Assignee, null)) { IdentityLinkEntity identityLink = new IdentityLinkEntity(); identityLink.UserId = task.Assignee; identityLink.Task = task; identityLink.Type = IdentityLinkType.ASSIGNEE; identityLinks.Add(identityLink); } if (!string.ReferenceEquals(task.Owner, null)) { IdentityLinkEntity identityLink = new IdentityLinkEntity(); identityLink.UserId = task.Owner; identityLink.Task = task; identityLink.Type = IdentityLinkType.OWNER; identityLinks.Add(identityLink); } return((System.Collections.IList)task.IdentityLinks); }
public virtual IList <IIdentityLink> Execute(CommandContext commandContext) { EnsureUtil.EnsureNotNull("taskId", TaskId); ITaskManager taskManager = commandContext.TaskManager; TaskEntity task = taskManager.FindTaskById(TaskId); EnsureUtil.EnsureNotNull("Cannot find ITask with id " + TaskId, "ITask", task); CheckGetIdentityLink(task, commandContext); var identityLinks = (IList <IIdentityLink>)task.IdentityLinks; //assignee is not part of identity links in the db. // so if there is one, we add it here. // @Tom: we discussed this long on skype and you agreed; -) // an assigneeis*an identityLink, and so must it be reflected in the API //Note: we cant move this code to the TaskEntity(which would be cleaner), //since the ITask.delete cascased to all associated identityLinks //and of course this leads to exception while trying to delete a non-existing identityLink if (!ReferenceEquals(task.Assignee, null)) { var identityLink = new IdentityLinkEntity(); identityLink.UserId = task.Assignee; identityLink.Task = task; identityLink.Type = IdentityLinkType.Assignee; identityLinks.Add(identityLink); } if (!ReferenceEquals(task.Owner, null)) { var identityLink = new IdentityLinkEntity(); identityLink.UserId = task.Owner; identityLink.Task = task; identityLink.Type = IdentityLinkType.Owner; identityLinks.Add(identityLink); } return((IList <IIdentityLink>)task.IdentityLinks); }