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


Java Task.setPriority方法代码示例

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


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

示例1: handleFormSubmit

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
protected void handleFormSubmit() {
  try {
    // Check for errors
    form.commit(); // will throw exception in case validation is false
    
    // Create task
    Task task = taskService.newTask();
    task.setName(nameField.getValue().toString());
    task.setDescription(descriptionArea.getValue().toString());
    task.setDueDate((Date) dueDateField.getValue());
    task.setPriority(priorityComboBox.getPriority());
    task.setOwner(ExplorerApp.get().getLoggedInUser().getId());
    taskService.saveTask(task);
    
    // close popup and navigate to new group
    close();
    ExplorerApp.get().getViewManager().showTasksPage(task.getId());
    
  } catch (InvalidValueException e) {
    // Do nothing: the Form component will render the errormsgs automatically
    setHeight(350, UNITS_PIXELS);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:NewCasePopupWindow.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: handleTaskProperty

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/

@Override
protected Object handleTaskProperty(Task task, TypeDefinition type, QName key, Serializable value)
{
    int priority;
    // ACE-3121: Workflow Admin Console: Cannot change priority for activiti
    // It could be a String that converts to an int, like when coming from WorkflowInterpreter.java
    if (value instanceof String)
    {
        try
        {
            priority = Integer.parseInt((String) value);
        }
        catch (NumberFormatException e)
        {
            throw getInvalidPropertyValueException(key, value);
        }
    }
    else
    {
        checkType(key, value, Integer.class);
        priority = (Integer) value;
    }

    // Priority value validation not performed to allow for future model changes
    task.setPriority(priority);

    return DO_NOT_ADD;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:ActivitiPriorityPropertyHandler.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: 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

示例7: testHistoricTaskInstance

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment
public void testHistoricTaskInstance() throws Exception {
  String processInstanceId = runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest").getId();
  
  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
  
  // Set priority to non-default value
  Task runtimeTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
  runtimeTask.setPriority(1234);
  
  // Set due-date
  Date dueDate = sdf.parse("01/02/2003 04:05:06");
  runtimeTask.setDueDate(dueDate);
  taskService.saveTask(runtimeTask);
  
  String taskId = runtimeTask.getId();
  String taskDefinitionKey = runtimeTask.getTaskDefinitionKey();
  
  HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
  assertEquals(taskId, historicTaskInstance.getId());
  assertEquals(1234, historicTaskInstance.getPriority());
  assertEquals("Clean up", historicTaskInstance.getName());
  assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
  assertEquals(dueDate, historicTaskInstance.getDueDate());
  assertEquals("kermit", historicTaskInstance.getAssignee());
  assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
  assertNull(historicTaskInstance.getEndTime());
  assertNull(historicTaskInstance.getDurationInMillis());
  
  runtimeService.setVariable(processInstanceId, "deadline", "yesterday");
  
  taskService.complete(taskId);
  
  assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());

  historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
  assertEquals(taskId, historicTaskInstance.getId());
  assertEquals(1234, historicTaskInstance.getPriority());
  assertEquals("Clean up", historicTaskInstance.getName());
  assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
  assertEquals(dueDate, historicTaskInstance.getDueDate());
  assertEquals("kermit", historicTaskInstance.getAssignee());
  assertEquals(TaskEntity.DELETE_REASON_COMPLETED, historicTaskInstance.getDeleteReason());
  assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
  assertNotNull(historicTaskInstance.getEndTime());
  assertNotNull(historicTaskInstance.getDurationInMillis());
  
  historyService.deleteHistoricTaskInstance(taskId);

  assertEquals(0, historyService.createHistoricTaskInstanceQuery().count());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:52,代码来源:HistoricTaskInstanceTest.java


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