public void notify(DelegateTask delegateTask) { Set<IdentityLink> candidates = delegateTask.getCandidates(); Set<String> candidateUsers = new HashSet<String>(); Set<String> candidateGroups = new HashSet<String>(); for (IdentityLink candidate : candidates) { if (candidate.getUserId() != null) { candidateUsers.add(candidate.getUserId()); } else if (candidate.getGroupId() != null) { candidateGroups.add(candidate.getGroupId()); } } delegateTask.setVariable(VARNAME_CANDIDATE_USERS, candidateUsers); delegateTask.setVariable(VARNAME_CANDIDATE_GROUPS, candidateGroups); }
private static Set<String> linkIds(DelegateTask task, Function<IdentityLink, String> extract, String type) { return Optional.ofNullable(task.getCandidates()).orElseGet(HashSet::new) .stream() .filter(link -> type == null || type.equals(link.getType())) .map(extract) .filter(Objects::nonNull) .collect(Collectors.toSet()); }
public void notify(DelegateTask delegateTask) { Set<IdentityLink> candidates = delegateTask.getCandidates(); Set<String> candidateUsers = new HashSet<String>(); Set<String> candidateGroups = new HashSet<String>(); for (IdentityLink candidate : candidates) { if (candidate.getUserId() != null) { candidateUsers.add(candidate.getUserId()); } else if (candidate.getGroupId() != null) { candidateGroups.add(candidate.getGroupId()); } } delegateTask.setVariable(VARNAME_CANDIDATE_USERS, candidateUsers); delegateTask.setVariable(VARNAME_CANDIDATE_GROUPS, candidateGroups); }