本文整理了Java中org.activiti.engine.task.Task.getAssignee()
方法的一些代码示例,展示了Task.getAssignee()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getAssignee()
方法的具体详情如下:
包路径:org.activiti.engine.task.Task
类名称:Task
方法名:getAssignee
[英]The User.getId() userId of the person to which this task is delegated.
[中]用户。getId()此任务委托给的人员的用户ID。
代码示例来源:origin: Activiti/Activiti
private Task.TaskStatus calculateStatus(org.activiti.engine.task.Task source) {
if (source instanceof TaskEntity &&
(((TaskEntity) source).isDeleted() || ((TaskEntity) source).isCanceled())) {
return Task.TaskStatus.CANCELLED;
} else if (source.isSuspended()) {
return Task.TaskStatus.SUSPENDED;
} else if (source.getAssignee() != null && !source.getAssignee().isEmpty()) {
return Task.TaskStatus.ASSIGNED;
}
return Task.TaskStatus.CREATED;
}
}
代码示例来源:origin: Activiti/Activiti
private org.activiti.engine.task.Task getTaskToUpdate(String taskId) {
String authenticatedUserId = getAuthenticatedUser();
org.activiti.engine.task.Task internalTask = getInternalTaskWithChecks(taskId);
// validate that you are trying to update task where you are the assignee
if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) {
throw new IllegalStateException("You cannot update a task where you are not the assignee");
}
return internalTask;
}
代码示例来源:origin: Activiti/Activiti
@Override
public void deleteCandidateGroups(CandidateGroupsPayload candidateGroupsPayload) {
org.activiti.engine.task.Task internalTask;
try {
internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateGroupsPayload.getTaskId());
} catch (IllegalStateException ex) {
throw new IllegalStateException("The authenticated user cannot update the task" + candidateGroupsPayload.getTaskId() + " due it is not the current assignee");
}
String authenticatedUserId = securityManager.getAuthenticatedUserId();
// validate that you are trying to add CandidateGroups to the task where you are the assignee
if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) {
throw new IllegalStateException("You cannot update a task where you are not the assignee");
}
if (candidateGroupsPayload.getCandidateGroups() != null && !candidateGroupsPayload.getCandidateGroups().isEmpty()) {
for (String g : candidateGroupsPayload.getCandidateGroups()) {
taskService.deleteCandidateGroup(internalTask.getId(),
g);
}
}
}
代码示例来源:origin: Activiti/Activiti
@Override
public void addCandidateUsers(CandidateUsersPayload candidateUsersPayload) {
org.activiti.engine.task.Task internalTask;
try {
internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateUsersPayload.getTaskId());
} catch (IllegalStateException ex) {
throw new IllegalStateException("The authenticated user cannot update the task" + candidateUsersPayload.getTaskId() + " due it is not the current assignee");
}
String authenticatedUserId = securityManager.getAuthenticatedUserId();
// validate that you are trying to add CandidateUsers to the task where you are the assignee
if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) {
throw new IllegalStateException("You cannot update a task where you are not the assignee");
}
if (candidateUsersPayload.getCandidateUsers() != null && !candidateUsersPayload.getCandidateUsers().isEmpty()) {
for (String u : candidateUsersPayload.getCandidateUsers()) {
taskService.addCandidateUser(internalTask.getId(),
u);
}
}
}
代码示例来源:origin: Activiti/Activiti
@Override
public void deleteCandidateUsers(CandidateUsersPayload candidateUsersPayload) {
org.activiti.engine.task.Task internalTask;
try {
internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateUsersPayload.getTaskId());
} catch (IllegalStateException ex) {
throw new IllegalStateException("The authenticated user cannot update the task" + candidateUsersPayload.getTaskId() + " due it is not the current assignee");
}
String authenticatedUserId = securityManager.getAuthenticatedUserId();
// validate that you are trying to add CandidateUsers to the task where you are the assignee
if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) {
throw new IllegalStateException("You cannot update a task where you are not the assignee");
}
if (candidateUsersPayload.getCandidateUsers() != null && !candidateUsersPayload.getCandidateUsers().isEmpty()) {
for (String u : candidateUsersPayload.getCandidateUsers()) {
taskService.deleteCandidateUser(internalTask.getId(),
u);
}
}
}
代码示例来源:origin: Activiti/Activiti
@Override
public void addCandidateGroups(CandidateGroupsPayload candidateGroupsPayload) {
org.activiti.engine.task.Task internalTask;
try {
internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateGroupsPayload.getTaskId());
} catch (IllegalStateException ex) {
throw new IllegalStateException("The authenticated user cannot update the task" + candidateGroupsPayload.getTaskId() + " due it is not the current assignee");
}
String authenticatedUserId = securityManager.getAuthenticatedUserId();
// validate that you are trying to add CandidateGroups to the task where you are the assignee
if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) {
throw new IllegalStateException("You cannot update a task where you are not the assignee");
}
if (candidateGroupsPayload.getCandidateGroups() != null && !candidateGroupsPayload.getCandidateGroups().isEmpty()) {
for (String g : candidateGroupsPayload.getCandidateGroups()) {
taskService.addCandidateGroup(internalTask.getId(),
g);
}
}
}
代码示例来源:origin: hs-web/hsweb-framework
.forEach(t -> {
setCandidate(task.getAssignee(), t);
newTaskConsumer.accept(t);
});
代码示例来源:origin: hs-web/hsweb-framework
@Override
public void claim(String taskId, String userId) {
Task task = taskService.createTaskQuery().
taskId(taskId)
.taskCandidateUser(userId)
.active()
.singleResult();
if (task == null) {
throw new NotFoundException("无法签收此任务");
}
if (!StringUtils.isNullOrEmpty(task.getAssignee())) {
throw new BusinessException("任务已签售");
} else {
taskService.claim(taskId, userId);
}
}
代码示例来源:origin: hs-web/hsweb-framework
String assignee = task.getAssignee();
Objects.requireNonNull(assignee, "任务未签收");
if (!assignee.equals(request.getCompleteUserId())) {
代码示例来源:origin: Activiti/Activiti
public Task from(org.activiti.engine.task.Task internalTask,
Task.TaskStatus status) {
TaskImpl task = new TaskImpl(internalTask.getId(),
internalTask.getName(),
status);
task.setProcessDefinitionId(internalTask.getProcessDefinitionId());
task.setProcessInstanceId(internalTask.getProcessInstanceId());
task.setAssignee(internalTask.getAssignee());
task.setClaimedDate(internalTask.getClaimTime());
task.setCreatedDate(internalTask.getCreateTime());
task.setDueDate(internalTask.getDueDate());
task.setDescription(internalTask.getDescription());
task.setOwner(internalTask.getOwner());
task.setParentTaskId(internalTask.getParentTaskId());
task.setPriority(internalTask.getPriority());
task.setFormKey(internalTask.getFormKey());
return task;
}
代码示例来源:origin: bill1012/AdminEAP
/**
* 签收任务 TODO 考虑撤回
*
* @param taskId 任务ID
* @param userId 用户ID
* @return
*/
@RequestMapping(value = "/task/claim/{taskId}/{userId}", method = RequestMethod.POST)
@ResponseBody
public Result claimTask(@PathVariable("taskId") String taskId, @PathVariable("userId") String userId) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (!StrUtil.isEmpty(task.getAssignee())) {
String userName = "";
if (!task.getAssignee().equals(userId))
userName = "【" + identityPageService.getUserNamesByUserIds(task.getAssignee()) + "】";
return new Result(false, "任务已被签收", "签收任务失败,该任务已被" + userName + "签收");
}
return taskPageService.claimTask(taskId, userId);
}
代码示例来源:origin: bill1012/AdminEAP
/**
* 用户办理之前确认是否被该用户签收 TODO 考虑撤回
*/
@RequestMapping(value = "/task/checkClaim/{taskId}/{userId}", method = RequestMethod.POST)
@ResponseBody
public Result checkClaim(@PathVariable("taskId") String taskId, @PathVariable("userId") String userId) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (StrUtil.isEmpty(task.getAssignee())) {
return new Result(true, false, "该任务尚未签收,是否签收并办理该任务?");
} else if (!task.getAssignee().equals(userId)) {
String userName = identityPageService.getUserNamesByUserIds(task.getAssignee());
return new Result(false, "被其他用户签收", "该任务已被【" + userName + "】签收,您无法办理");
} else {
return new Result(true, true);
}
}
代码示例来源:origin: bluejoe2008/openwebflow
String assignee = task.getAssignee();
代码示例来源:origin: bill1012/AdminEAP
@Override
public Result unclaimTask(String taskId, String assignee) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (StrUtil.isEmpty(task.getAssignee())) {
return new Result(false, "取消失败", "取消签收失败,该任务未被任何人签收");
} else if (!assignee.equals(task.getAssignee())) {
String assgineeName = identityPageService.getUserNamesByUserIds(task.getAssignee());
return new Result(false, "取消失败", "取消签收失败,任务已被【" + assgineeName + "】签收");
} else {
taskService.unclaim(taskId);
//List<IdentityLink> identityLinks=taskService.getIdentityLinksForTask(taskId);
//taskService.deleteUserIdentityLink(taskId,assignee, IdentityLinkType.PARTICIPANT);
//runtimeService.deleteUserIdentityLink(task.getProcessInstanceId(),assignee,IdentityLinkType.PARTICIPANT);
return new Result(true);
}
}
代码示例来源:origin: bill1012/AdminEAP
@Override
public Result claimTask(String taskId, String assignee) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (StrUtil.isEmpty(task.getAssignee())) {
taskService.claim(taskId, assignee);
return new Result(true);
} else {
String assgineeName = identityPageService.getUserNamesByUserIds(task.getAssignee());
return new Result(false, "签收失败", "签收任务失败,该任务已被【" + assgineeName + "】签收");
}
}
代码示例来源:origin: bill1012/AdminEAP
BeanUtils.copyProperties(taskEntity, vo);
vo.setProcessInstanceName(taskEntity.getProcessInstance().getName());
if (!StrUtil.isEmpty(task.getAssignee()) && needDelegate(taskEntity, moduleId)) {
代码示例来源:origin: bill1012/AdminEAP
taskCandidateOrAssigned(approver).list();
for (Task task1 : tasks) {
String assignee = task1.getAssignee();
代码示例来源:origin: bill1012/AdminEAP
BeanUtils.copyProperties(task, vo);
if (!StrUtil.isEmpty(task.getAssignee())) {
vo.setAssigneeName(identityPageService.getUser(task.getAssignee()).getFirstName());
代码示例来源:origin: org.activiti/activiti-explorer
public void buttonClick(ClickEvent event) {
// If no owner, make assignee owner (will go into archived then)
if (task.getOwner() == null) {
task.setOwner(task.getAssignee());
taskService.setOwner(task.getId(), task.getAssignee());
}
taskService.complete(task.getId());
notificationManager.showInformationNotification(Messages.TASK_COMPLETED, task.getName());
taskPage.refreshSelectNext();
}
});
代码示例来源:origin: org.activiti/activiti-explorer
public void notifyAssigneeChanged() {
if (ExplorerApp.get().getLoggedInUser().getId().equals(task.getAssignee())) { // switch view to inbox if assignee is current user
viewManager.showInboxPage(task.getId());
} else {
involvedPeople.refreshAssignee();
taskPage.getTaskEventPanel().refreshTaskEvents();
}
}
内容来源于网络,如有侵权,请联系作者删除!