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


Java Task.setAssignee方法代码示例

本文整理汇总了Java中org.activiti.engine.task.Task.setAssignee方法的典型用法代码示例。如果您正苦于以下问题:Java Task.setAssignee方法的具体用法?Java Task.setAssignee怎么用?Java Task.setAssignee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.task.Task的用法示例。


在下文中一共展示了Task.setAssignee方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTaskAssignee

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskAssignee() {
  Task task = taskService.newTask();
  task.setAssignee("johndoe");
  taskService.saveTask(task);

  // Fetch the task again and update
  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("johndoe", task.getAssignee());

  task.setAssignee("joesmoe");
  taskService.saveTask(task);

  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("joesmoe", task.getAssignee());

  // Finally, delete task
  taskService.deleteTask(task.getId(), true);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:TaskServiceTest.java

示例2: testHistoricTaskInstanceUpdate

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment
public void testHistoricTaskInstanceUpdate() {
  runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest").getId();
  
  Task task = taskService.createTaskQuery().singleResult();
  
  // Update and save the task's fields before it is finished
  task.setPriority(12345);
  task.setDescription("Updated description");
  task.setName("Updated name");
  task.setAssignee("gonzo");
  taskService.saveTask(task);   

  taskService.complete(task.getId());
  assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());

  HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
  assertEquals("Updated name", historicTaskInstance.getName());
  assertEquals("Updated description", historicTaskInstance.getDescription());
  assertEquals("gonzo", historicTaskInstance.getAssignee());
  assertEquals("task", historicTaskInstance.getTaskDefinitionKey());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:23,代码来源:HistoricTaskInstanceUpdateTest.java

示例3: endNormalTask

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
private WorkflowTask endNormalTask(String taskId, String localTaskId, String transition)
{
    // Retrieve task
    Task task = taskService.createTaskQuery().taskId(localTaskId).singleResult();
    
    if(task == null)
    {
        String msg = messageService.getMessage(ERR_END_UNEXISTING_TASK, taskId);
        throw new WorkflowException(msg);
    }
    
    // Check if the assignee is equal to the current logged-in user. If not, assign task before ending
    String currentUserName = AuthenticationUtil.getFullyAuthenticatedUser();
    if(task.getAssignee() == null || !task.getAssignee().equals(currentUserName)) {
        taskService.setAssignee(localTaskId, currentUserName);
        // Also update pojo used to set the outcome, this will read assignee as wel
        task.setAssignee(currentUserName);
        
        // Re-fetch the task-entity since it's revision has been updated by the setAssignee() call
        task = taskService.createTaskQuery().taskId(localTaskId).singleResult();
    }
    
    setOutcome(task, transition);
    taskService.complete(localTaskId);
    // The task should have a historicTaskInstance
    HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult();
    return typeConverter.convert(historicTask);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:ActivitiWorkflowEngine.java

示例4: addTask

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
protected Task addTask(String name, int priority) {
	TaskService taskService = processEngine.getTaskService();
	Task task = taskService.newTask();
	task.setName(name);
	task.setPriority(priority);
	task.setAssignee("john");
	task.setCategory("testCategory");
	task.setDueDate(new Date());
	task.setOwner("jane");
	task.setDescription("testDescription");
	task.setTenantId("testTenant");
	taskService.saveTask(task);
	return task;

}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:16,代码来源:ActivitiTestBase.java

示例5: changeTaskProperty

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
 * 更改任务属性
 *
 * @throws ParseException
 */
@RequestMapping("task/property/{taskId}")
@ResponseBody
public String changeTaskProperty(@PathVariable("taskId") String taskId, @RequestParam("propertyName") String propertyName, @RequestParam("value") String value)
        throws ParseException {
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    // 更改到期日
    if (StringUtils.equals(propertyName, "dueDate")) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = sdf.parse(value);
        task.setDueDate(parse);
        taskService.saveTask(task);
    } else if (StringUtils.equals(propertyName, "priority")) {
        // 更改任务优先级
        task.setPriority(Integer.parseInt(value));
        taskService.saveTask(task);
    } else if (StringUtils.equals(propertyName, "owner")) {
        // 更改拥有人
        task.setOwner(value);
        taskService.saveTask(task);
    } else if (StringUtils.equals(propertyName, "assignee")) {
        // 更改办理人
        task.setAssignee(value);
        taskService.saveTask(task);
    } else {
        return "不支持[" + propertyName + "]属性!";
    }
    return "success";
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:34,代码来源:TaskController.java

示例6: addSubTask

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
 * 添加子任务
 */
@RequestMapping("task/subtask/add/{taskId}")
public String addSubTask(@PathVariable("taskId") String parentTaskId, @RequestParam("taskName") String taskName,
                         @RequestParam(value = "description", required = false) String description, HttpSession session) {
    Task newTask = taskService.newTask();
    newTask.setParentTaskId(parentTaskId);
    String userId = UserUtil.getUserFromSession(session).getId();
    newTask.setOwner(userId);
    newTask.setAssignee(userId);
    newTask.setName(taskName);
    newTask.setDescription(description);

    taskService.saveTask(newTask);
    return "redirect:/chapter6/task/getform/" + parentTaskId;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:18,代码来源:TaskController.java

示例7: testTaskDelegation

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskDelegation() {
  Task task = taskService.newTask();
  task.setOwner("johndoe");
  task.delegate("joesmoe");
  taskService.saveTask(task);
  String taskId = task.getId();

  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals("johndoe", task.getOwner());
  assertEquals("joesmoe", task.getAssignee());
  assertEquals(DelegationState.PENDING, task.getDelegationState());

  taskService.resolveTask(taskId);
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals("johndoe", task.getOwner());
  assertEquals("johndoe", task.getAssignee());
  assertEquals(DelegationState.RESOLVED, task.getDelegationState());

  task.setAssignee(null);
  task.setDelegationState(null);
  taskService.saveTask(task);
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals("johndoe", task.getOwner());
  assertNull(task.getAssignee());
  assertNull(task.getDelegationState());

  task.setAssignee("jackblack");
  task.setDelegationState(DelegationState.RESOLVED);
  taskService.saveTask(task);
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals("johndoe", task.getOwner());
  assertEquals("jackblack", task.getAssignee());
  assertEquals(DelegationState.RESOLVED, task.getDelegationState());

  // Finally, delete task
  taskService.deleteTask(taskId, true);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:38,代码来源:TaskServiceTest.java

示例8: testSaveTaskUpdate

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testSaveTaskUpdate() throws Exception{
  
  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
  Task task = taskService.newTask();
  task.setDescription("description");
  task.setName("taskname");
  task.setPriority(0);
  task.setAssignee("taskassignee");
  task.setOwner("taskowner");
  Date dueDate = sdf.parse("01/02/2003 04:05:06");
  task.setDueDate(dueDate);
  taskService.saveTask(task);

  // Fetch the task again and update
  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("description", task.getDescription());
  assertEquals("taskname", task.getName());
  assertEquals("taskassignee", task.getAssignee());
  assertEquals("taskowner", task.getOwner());
  assertEquals(dueDate, task.getDueDate());
  assertEquals(0, task.getPriority());

  task.setName("updatedtaskname");
  task.setDescription("updateddescription");
  task.setPriority(1);
  task.setAssignee("updatedassignee");
  task.setOwner("updatedowner");
  dueDate = sdf.parse("01/02/2003 04:05:06");
  task.setDueDate(dueDate);
  taskService.saveTask(task);

  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("updatedtaskname", task.getName());
  assertEquals("updateddescription", task.getDescription());
  assertEquals("updatedassignee", task.getAssignee());
  assertEquals("updatedowner", task.getOwner());
  assertEquals(dueDate, task.getDueDate());
  assertEquals(1, task.getPriority());
  
  if (processEngineConfiguration.getHistoryLevel()>=ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricTaskInstance historicTaskInstance = historyService
      .createHistoricTaskInstanceQuery()
      .taskId(task.getId())
      .singleResult();
    assertEquals("updatedtaskname", historicTaskInstance.getName());
    assertEquals("updateddescription", historicTaskInstance.getDescription());
    assertEquals("updatedassignee", historicTaskInstance.getAssignee());
    assertEquals("updatedowner", historicTaskInstance.getOwner());
    assertEquals(dueDate, historicTaskInstance.getDueDate());
    assertEquals(1, historicTaskInstance.getPriority());
  }
  
  // Finally, delete task
  taskService.deleteTask(task.getId(), true);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:56,代码来源:TaskServiceTest.java


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