Package org.activiti.engine.task

Examples of org.activiti.engine.task.Task


    }

    @Action
    public void startWorkAction() {
        String taskKey = (String) pendingTasksList.getSelectedValue();
        Task task = tasks.get(taskKey);
        String userKey = (String) usersList.getSelectedValue();
        System.out.println("complete task user: " + userKey);
        WriteDocumentDialog frame = new WriteDocumentDialog(this.getFrame(), task, userKey, client, null);
        frame.setModal(true);
        frame.setVisible(true);
View Full Code Here


 
  /**
   * 查询任务之前表单数据
   */
  public List<HistoricDetail> listHistoricDetail( String taskId ){
    Task task = this.getTask(taskId);
    if( task == null )
      return null;
   
    List<HistoricTaskInstance> historyTaskList = historyService.createHistoricTaskInstanceQuery()
      .processInstanceId(task.getProcessInstanceId())
      .finished()
      .orderByTaskId().desc()
      .listPage(0,1);
   
    if( historyTaskList == null || historyTaskList.isEmpty() )
View Full Code Here

 
  /**
   * 认领流程
   */
  public void claim( String taskId,String userId ){
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+taskId+"]不存在!");
   
    if( StringUtil.hasText( task.getAssignee() ) )
      throw new ApplicationException("任务["+taskId+"]已被用户["+task.getAssignee()+"]认领!");
   
    this.taskLogManager.save(task.getProcessInstanceId(),task.getId()
        ,ExecutionType.CLAIM, userId, "用户["+userId+"]签收任务");
   
    taskService.claim(taskId, userId);
  }
View Full Code Here

   */
  public void claimAndComplete(String procInstId,String operator){
    if( StringUtils.isEmpty(operator) )
      throw new ApplicationException("操作人不能为空!");
   
    Task task = this.getCurrentTask( procInstId );
   
    if( task == null )
      throw new ApplicationException("无法获取活动的任务[流程实例ID="+procInstId+"]");
   
    taskService.claim( task.getId(), operator );
    taskService.complete(task.getId());
  }
View Full Code Here

 
  /**
   * 变更认领人
   */
  public void changeAssignee( String taskId,String userId ){
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+taskId+"]不存在!");
   
    taskService.setAssignee(taskId, userId);
  }
View Full Code Here

  @Deprecated
  public void addAssignee( String taskId,List<String> userIds ){
    if( userIds == null || userIds.isEmpty() )
      throw new ApplicationException("添加的会签人不能为空!");
   
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+taskId+"]不存在!");
   
    if( StringUtils.isNotEmpty(task.getParentTaskId()) )
      throw new ApplicationException("任务["+task.getName()+"]已是会签任务!");
   
    //taskService.
   
    for( String user:userIds ){
      TaskEntity newTask = (TaskEntity) taskService.newTask(); //TODO 更改ID规则
     
      newTask.setAssignee(user)
      newTask.setName( task.getName() + "-[会签]")
      newTask.setProcessDefinitionId(task.getProcessDefinitionId())
      newTask.setProcessInstanceId(task.getProcessInstanceId() )
      newTask.setParentTaskId(taskId)
      newTask.setDescription( task.getName() + "-添加会签人["+user+"]")
            taskService.saveTask(newTask);
    }
  }
View Full Code Here

   
    String message = myTask.getMessage();
    if( StringUtils.isEmpty(message)  )
      throw new ApplicationException("流转意见不能为空!");
   
    Task task = taskService.createTaskQuery().taskId(myTask.getId()).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+myTask.getId()+"]不存在!");
   
    //task.getParentTaskId();
    //identityService.setAuthenticatedUserId( user );
   
    //保存操作日志
    taskLogManager.save(task.getProcessInstanceId(),task.getId(),type,user, message);
   
    Map<String,Object> variables = new HashMap<String,Object>();
    variables.put(WorkflowConstant.TASK_ACTIOIN_VARIABLE_NAME,type.name());
    variables.put("passed", ExecutionType.SUBMIT.equals(type)); //TODO
   
View Full Code Here

        newTransition.setDestination( targetActivity )
 
        // 执行转向任务 
        taskService.complete(task.getId(), variables)
        //获取新Task
        Task newTask = getCurrentTask( task.getProcessInstanceId() );
        if( newTask != null ){
          //新任务从流程定义恢复,原签收人从历史任务中得到
          taskService.claim(newTask.getId(), histTask.getAssignee() );
        }
        // 删除目标节点新流入 
        targetActivity.getIncomingTransitions().remove(newTransition)
 
        // 还原以前流向 
View Full Code Here

    List<Task> activeTasks = taskService.createTaskQuery()
        .processInstanceId(procInstId).active().list();
    if( activeTasks == null || activeTasks.size() != 1 )
      throw new ApplicationException("流程活动任务不存在或存在多个,无法回退!");
   
    Task task = activeTasks.get(0); //当前任务节点
    if( task == null )
      throw new ApplicationException("无法获取当前任务,无法回退!");
   
    List<HistoricTaskInstance> histTaskList = historyService
        .createHistoricTaskInstanceQuery().finished()
View Full Code Here

      throw new ApplicationException("会签任务ID不能为空!");
   
    if( users == null )
      throw new ApplicationException("会签用户不能为空!");
   
    Task task = getTask(taskId);
    if( task == null )
      throw new ApplicationException("任务ID["+taskId+"]不存在!");
   
    if( StringUtils.isEmpty(operator) ){
      operator = task.getAssignee();
      log.warn("会签操作人为空,使用任务签收人[{}]",task.getAssignee());
    }
   
    StringBuffer message = new StringBuffer("添加会签人[");
    int i = 0;
   
    //对用户不能重复添加会签
    List<Task> subTasks = taskService.getSubTasks(taskId); //子任务
    Map<String,Task> subTaskMap = new HashMap<String,Task>();
    if( subTasks != null && subTasks.size() > 0 ){
      for(Task item: subTasks){
        subTaskMap.put(item.getAssignee(), item);
      }
    }
   
    for( String user:users ){
      if( task.getAssignee().equals(user) )
        throw new ApplicationException("不能添加自己["+user+"]为会签人");
       
      if( subTaskMap.get(user) != null )
        throw new ApplicationException("任务已添加会签人["+user+"]");
     
      TaskEntity subTask = (TaskEntity)taskService.newTask();
      subTask.setParentTaskId(taskId); //上级Task
      subTask.setName( task.getName() + "-["+user+"]会签");
      subTask.setAssignee( user ); //会签用户
      subTask.setProcessDefinitionId( task.getProcessDefinitionId() );
      subTask.setProcessInstanceId( task.getProcessInstanceId() );
      subTask.setDescription("会签");
     
      taskService.saveTask(subTask);
     
      message.append((i==0?"":",") +user);
      ++i;
    }
    message.append("]");
   
    taskLogManager.save(task.getProcessInstanceId(),task.getId()
        ,ExecutionType.SIGN, operator, message.toString());
   
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.task.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.