本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.TaskEntity.getAssignee方法的典型用法代码示例。如果您正苦于以下问题:Java TaskEntity.getAssignee方法的具体用法?Java TaskEntity.getAssignee怎么用?Java TaskEntity.getAssignee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.TaskEntity
的用法示例。
在下文中一共展示了TaskEntity.getAssignee方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
@Override
protected Void execute(CommandContext commandContext, TaskEntity task) {
if (userId != null) {
if (task.getAssignee() != null) {
if (!task.getAssignee().equals(userId)) {
// When the task is already claimed by another user, throw exception. Otherwise, ignore
// this, post-conditions of method already met.
throw new ActivitiTaskAlreadyClaimedException(task.getId(), task.getAssignee());
}
} else {
task.setAssignee(userId, true, true);
}
} else {
// Task should be assigned to no one
task.setAssignee(null, true, true);
}
// Add claim time
commandContext.getHistoryManager().recordTaskClaim(taskId);
return null;
}
示例2: onEvent
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
ActivitiEntityEvent entityEvent = (ActivitiEntityEvent) event;
Object entity = entityEvent.getEntity();
if (entity instanceof TaskEntity) {
TaskEntity task = (TaskEntity) entity;
String originUserId = task.getAssignee();
String newUserId = userMap.get(originUserId);
if (StringUtils.isNotBlank(newUserId)) {
task.setAssignee(newUserId);
TaskService taskService = event.getEngineServices().getTaskService();
String message = getClass().getName() + "-> 任务[" + task.getName() + "]的办理人[" +
originUserId + "]自动转办给了用户[" + newUserId + "]";
taskService.addComment(task.getId(), task.getProcessInstanceId(), "redirect", message);
}
}
}
示例3: execute
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked" })
public List<IdentityLink> execute(CommandContext commandContext) {
TaskEntity task = Context
.getCommandContext()
.getTaskManager()
.findTaskById(taskId);
List<IdentityLink> identityLinks = (List) task.getIdentityLinks();
// 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 (task.getAssignee() != null) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setUserId(task.getAssignee());
identityLink.setType(IdentityLinkType.ASSIGNEE);
identityLinks.add(identityLink);
}
return (List) task.getIdentityLinks();
}
示例4: execute
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
protected Void execute(CommandContext commandContext, TaskEntity task) {
if(userId != null) {
if (task.getAssignee() != null) {
if(!task.getAssignee().equals(userId)) {
// When the task is already claimed by another user, throw exception. Otherwise, ignore
// this, post-conditions of method already met.
throw new ActivitiTaskAlreadyClaimedException(task.getId(), task.getAssignee());
}
} else {
task.setAssignee(userId);
}
} else {
// Task should be assigned to no one
task.setAssignee(null);
}
// Add claim time
commandContext.getHistoryManager().recordTaskClaim( taskId);
return null;
}
示例5: execute
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
if(taskId == null) {
throw new ActivitiException("taskId is null");
}
TaskEntity task = Context
.getCommandContext()
.getTaskManager()
.findTaskById(taskId);
if (task == null) {
throw new ActivitiException("Cannot find task with id " + taskId);
}
if(userId != null) {
if (task.getAssignee() != null) {
if(!task.getAssignee().equals(userId)) {
// When the task is already claimed by another user, throw exception. Otherwise, ignore
// this, post-conditions of method already met.
throw new ActivitiException("Task " + taskId + " is already claimed by someone else");
}
} else {
task.setAssignee(userId);
}
} else {
// Task should be assigned to no one
task.setAssignee(null);
}
return null;
}