snaker-core/src/main/java/org/snaker/engine/core/TaskService.java
public TaskModel getTaskModel(String taskId) {
        Task task = access().getTask(taskId);
        AssertHelper.notNull(task);
        Order order = access().getOrder(task.getOrderId());
        AssertHelper.notNull(order);
        Process process = ServiceContext.getEngine().process().getProcessById(order.getProcessId());
        ProcessModel model = process.getModel();
        NodeModel nodeModel = model.getNode(task.getTaskName());
        AssertHelper.notNull(nodeModel, "任务id无法找到节点模型.");
        if(nodeModel instanceof TaskModel) {
            return (TaskModel)nodeModel;
        } else {
            throw new IllegalArgumentException("任务id找到的节点模型不匹配");
        }
    }
public TaskModel getTaskModel(String taskId) {
        Task task = access().getTask(taskId);
        AssertHelper.notNull(task);
        Order order = access().getOrder(task.getOrderId());
        AssertHelper.notNull(order);
        Process process = ServiceContext.getEngine().process().getProcessById(order.getProcessId());
        ProcessModel model = process.getModel();
        NodeModel nodeModel = model.getNode(task.getTaskName());
        AssertHelper.notNull(nodeModel, "任务id无法找到节点模型.");
        if(nodeModel instanceof TaskModel) {
            return (TaskModel)nodeModel;
        } else {
            throw new IllegalArgumentException("任务id找到的节点模型不匹配");
        }
    }
public TaskModel getTaskModel ( String taskId ) { Task task = access ( ) . getTask ( taskId ) ; AssertHelper . notNull ( task ) ; Order order = access ( ) . getOrder ( task . getOrderId ( ) ) ; AssertHelper . notNull ( order ) ; Process process = ServiceContext . getEngine ( ) . process ( ) . getProcessById ( order . getProcessId ( ) ) ; ProcessModel model = process . getModel ( ) ; NodeModel nodeModel = model . getNode ( task . getTaskName ( ) ) ; AssertHelper . notNull ( nodeModel , "任务id无法找到节点模型."); if ( nodeModel instanceof TaskModel ) { return ( TaskModel ) nodeModel ; } else { throw new IllegalArgumentException ( "任务id找到的节点模型不匹配"); } }
获取任务模型
@param taskId 任务id
@return TaskModel
获取任务模型