本文整理汇总了Java中org.camunda.bpm.engine.delegate.DelegateTask.getCandidates方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateTask.getCandidates方法的具体用法?Java DelegateTask.getCandidates怎么用?Java DelegateTask.getCandidates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.delegate.DelegateTask
的用法示例。
在下文中一共展示了DelegateTask.getCandidates方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyPool
import org.camunda.bpm.engine.delegate.DelegateTask; //导入方法依赖的package包/类
/**
* Notifies about unassigned (pooled) task.
*
* @param task task no notify about
*/
public void notifyPool(DelegateTask task) {
Set<IdentityLink> links = task.getCandidates();
links.stream()
.filter(link -> link.getUserId() != null)
.map(IdentityLink::getUserId)
.forEach(username -> {
UserDetails user = userDetailsService.loadUserById(username);
notNull(user, () -> new MissingObject(UserDetails.class, username));
if (hasTaskNotifyEnabled(task)) {
mailCenter.sendPoolAssignment(user.getEmail(), task.getExecution().getBusinessKey(),
task.getId(), task.getName(), task.getTaskDefinitionKey(),
task.getCreateTime().toInstant(),
task.getDueDate() != null ? task.getDueDate().toInstant() : null);
}
});
}
示例2: notifyPoolDueDate
import org.camunda.bpm.engine.delegate.DelegateTask; //导入方法依赖的package包/类
/**
* Notifies about unassigned (pooled) task due date imminent.
*
* @param task task no notify about
*/
public void notifyPoolDueDate(DelegateTask task) {
Set<IdentityLink> links = task.getCandidates();
links.stream()
.filter(link -> link.getUserId() != null)
.map(IdentityLink::getUserId)
.forEach(username -> {
UserDetails user = userDetailsService.loadUserById(username);
notNull(user, () -> new MissingObject(UserDetails.class, username));
if (hasTaskNotifyEnabled(task)) {
mailCenter.sendPoolAssignment(user.getEmail(), task.getExecution().getBusinessKey(),
task.getId(), task.getName(), task.getTaskDefinitionKey(),
task.getCreateTime().toInstant(),
task.getDueDate() != null ? task.getDueDate().toInstant() : null);
}
});
}
示例3: notifyAssign
import org.camunda.bpm.engine.delegate.DelegateTask; //导入方法依赖的package包/类
/**
* Notifies about assigned task.
*
* @param task task no notify about
*/
public void notifyAssign(DelegateTask task) {
String assignee = task.getAssignee();
notNull(assignee, () -> new MissingAttribute(task, "assignee"));
UserDetails user = userDetailsService.loadUserById(assignee);
notNull(user, () -> new MissingObject(UserDetails.class, assignee));
if (hasTaskNotifyEnabled(task)) {
mailCenter.sendAssignment(user.getEmail(), task.getExecution().getBusinessKey(),
task.getId(), task.getName(), task.getTaskDefinitionKey(),
task.getCreateTime().toInstant(),
task.getDueDate() != null ? task.getDueDate().toInstant() : null);
}
// send pool assigned mail to other candidates
Set<IdentityLink> links = task.getCandidates();
links.stream()
.filter(link -> link.getUserId() != null)
.map(IdentityLink::getUserId)
.filter(username -> !assignee.equals(username))
.forEach(username -> {
UserDetails otherUser = userDetailsService.loadUserById(username);
notNull(otherUser, () -> new MissingObject(UserDetails.class, username));
if (hasTaskNotifyEnabled(task)) {
mailCenter.sendPoolAssignmentOther(otherUser.getEmail(), task.getExecution().getBusinessKey(),
task.getId(), task.getName(), task.getTaskDefinitionKey(),
task.getCreateTime().toInstant(),
task.getDueDate() != null ? task.getDueDate().toInstant() : null,
user.getFullName());
}
});
}
示例4: notify
import org.camunda.bpm.engine.delegate.DelegateTask; //导入方法依赖的package包/类
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);
}