当前位置: 首页>>代码示例>>Java>>正文


Java TaskEntity.getAssignee方法代码示例

本文整理汇总了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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:ClaimTaskCmd.java

示例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);
        }
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:18,代码来源:TaskAutoRedirectGlobalEventListener.java

示例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();
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:GetIdentityLinksForTaskCmd.java

示例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;
  }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:ClaimTaskCmd.java

示例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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:31,代码来源:ClaimTaskCmd.java


注:本文中的org.activiti.engine.impl.persistence.entity.TaskEntity.getAssignee方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。