public Set<IdentityLink> getCandidates() {
   Set<IdentityLink> potentialOwners = new HashSet<IdentityLink>();
   for (IdentityLinkEntity identityLinkEntity : getIdentityLinks()) {
     if (IdentityLinkType.CANDIDATE.equals(identityLinkEntity.getType())) {
       potentialOwners.add(identityLinkEntity);
     }
   }
   return potentialOwners;
 }
  public void deleteIdentityLink(String userId, String groupId) {
    List<IdentityLinkEntity> identityLinks =
        Context.getCommandContext()
            .getIdentityLinkManager()
            .findIdentityLinkByProcessDefinitionUserAndGroup(id, userId, groupId);

    for (IdentityLinkEntity identityLink : identityLinks) {
      Context.getCommandContext()
          .getDbSqlSession()
          .delete(IdentityLinkEntity.class, identityLink.getId());
    }
  }
 public IdentityLinkEntity addIdentityLink(String userId, String groupId) {
   IdentityLinkEntity identityLinkEntity = IdentityLinkEntity.createAndInsert();
   getIdentityLinks().add(identityLinkEntity);
   identityLinkEntity.setProcessDef(this);
   identityLinkEntity.setUserId(userId);
   identityLinkEntity.setGroupId(groupId);
   identityLinkEntity.setType(IdentityLinkType.CANDIDATE);
   return identityLinkEntity;
 }
 public IdentityLinkEntity addIdentityLink(String userId, String groupId, String type) {
   IdentityLinkEntity identityLinkEntity = new IdentityLinkEntity();
   getIdentityLinks().add(identityLinkEntity);
   identityLinkEntity.setTask(this);
   identityLinkEntity.setUserId(userId);
   identityLinkEntity.setGroupId(groupId);
   identityLinkEntity.setType(type);
   identityLinkEntity.insert();
   if (userId != null && processInstanceId != null) {
     getProcessInstance().involveUser(userId, IdentityLinkType.PARTICIPANT);
   }
   return identityLinkEntity;
 }
Example #5
0
 private void addAuthorizationsFromIterator(
     Set<Expression> exprSet, ProcessDefinitionEntity processDefinition, ExprType exprType) {
   if (exprSet != null) {
     Iterator<Expression> iterator = exprSet.iterator();
     while (iterator.hasNext()) {
       Expression expr = (Expression) iterator.next();
       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.insert();
     }
   }
 }