當前位置: 首頁>>代碼示例>>Java>>正文


Java HistoryLevel類代碼示例

本文整理匯總了Java中org.activiti.engine.impl.history.HistoryLevel的典型用法代碼示例。如果您正苦於以下問題:Java HistoryLevel類的具體用法?Java HistoryLevel怎麽用?Java HistoryLevel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HistoryLevel類屬於org.activiti.engine.impl.history包,在下文中一共展示了HistoryLevel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dbSchemaCreate

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
public void dbSchemaCreate() {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
  
  if (isEngineTablePresent()) {
    String dbVersion = getDbVersion();
    if (!ProcessEngine.VERSION.equals(dbVersion)) {
      throw new ActivitiWrongDbException(ProcessEngine.VERSION, dbVersion);
    }
  } else {
    dbSchemaCreateEngine();
  }

  if (processEngineConfiguration.getHistoryLevel() != HistoryLevel.NONE) {
    dbSchemaCreateHistory();
  }

  if (processEngineConfiguration.isDbIdentityUsed()) {
    dbSchemaCreateIdentity();
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:21,代碼來源:DbSqlSession.java

示例2: testScriptExecutionListener

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@Deployment(resources = { "org/activiti/examples/bpmn/executionlistener/ScriptExecutionListenerTest.bpmn20.xml" })
public void testScriptExecutionListener() {
	ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("scriptExecutionListenerProcess");     

	if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
 		List<HistoricVariableInstance> historicVariables = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).list();
 		Map<String, Object> varMap = new HashMap<String, Object>();
 		for (HistoricVariableInstance historicVariableInstance : historicVariables) {
 		  varMap.put(historicVariableInstance.getVariableName(), historicVariableInstance.getValue());
     }
 		
 		assertTrue(varMap.containsKey("foo"));
 		assertEquals("FOO", varMap.get("foo"));
 		assertTrue(varMap.containsKey("var1"));
     assertEquals("test", varMap.get("var1"));
     assertFalse(varMap.containsKey("bar"));
     assertTrue(varMap.containsKey("myVar"));
     assertEquals("BAR", varMap.get("myVar"));
	}
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:21,代碼來源:ScriptExecutionListenerTest.java

示例3: testScriptTaskListener

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@Deployment(resources = { "org/activiti/examples/bpmn/tasklistener/ScriptTaskListenerTest.bpmn20.xml" })
public void testScriptTaskListener() {
	ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("scriptTaskListenerProcess");
	Task task = taskService.createTaskQuery().singleResult();
	assertEquals("Name does not match", "All your base are belong to us", task.getName());
	
	taskService.complete(task.getId());

	if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
 		HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult();
 		assertEquals("kermit", historicTask.getOwner());
 		
 		task = taskService.createTaskQuery().singleResult();
 		assertEquals("Task name not set with 'bar' variable", "BAR", task.getName());
	}
 		
	Object bar = runtimeService.getVariable(processInstance.getId(), "bar");
	assertNull("Expected 'bar' variable to be local to script", bar);
	
	Object foo = runtimeService.getVariable(processInstance.getId(), "foo");
	assertEquals("Could not find the 'foo' variable in variable scope", "FOO", foo);
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:23,代碼來源:ScriptTaskListenerTest.java

示例4: testAddCommentToProcessInstance

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@Deployment
public void testAddCommentToProcessInstance() {
  if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcessInstanceComment");
    
    taskService.addComment(null, processInstance.getId(), "Hello World");
    
    List<Comment> comments = taskService.getProcessInstanceComments(processInstance.getId());
    assertEquals(1, comments.size());
    
    // Suspend process instance
    runtimeService.suspendProcessInstanceById(processInstance.getId());
    try {
      taskService.addComment(null, processInstance.getId(), "Hello World 2");
    } catch (ActivitiException e) {
      assertTextPresent("Cannot add a comment to a suspended execution", e.getMessage());
    }
    
    // Delete comments again
    taskService.deleteComments(null, processInstance.getId());
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:23,代碼來源:ProcessInstanceCommentTest.java

示例5: testDeleteProcessInstanceNullReason

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@Deployment(resources={
  "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"})
public void testDeleteProcessInstanceNullReason() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
  assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count());
  
  // Deleting without a reason should be possible
  runtimeService.deleteProcessInstance(processInstance.getId(), null);
  assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count());
  
if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstance historicInstance = historyService.createHistoricProcessInstanceQuery()
          .processInstanceId(processInstance.getId())
          .singleResult();
      
      assertNotNull(historicInstance);
      assertNull(historicInstance.getDeleteReason());
    }    
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:20,代碼來源:RuntimeServiceTest.java

示例6: checkHistoricVariableUpdateEntity

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
private void checkHistoricVariableUpdateEntity(String variableName, String processInstanceId) {
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {
    boolean deletedVariableUpdateFound = false;

    List<HistoricDetail> resultSet = historyService.createHistoricDetailQuery().processInstanceId(processInstanceId).list();
    for (HistoricDetail currentHistoricDetail : resultSet) {
      assertTrue(currentHistoricDetail instanceof HistoricDetailVariableInstanceUpdateEntity);
      HistoricDetailVariableInstanceUpdateEntity historicVariableUpdate = (HistoricDetailVariableInstanceUpdateEntity) currentHistoricDetail;
    
      if (historicVariableUpdate.getName().equals(variableName)) {
        if (historicVariableUpdate.getValue() == null) {
          if (deletedVariableUpdateFound) {
            fail("Mismatch: A HistoricVariableUpdateEntity with a null value already found");
          } else {
            deletedVariableUpdateFound = true;
          }
        }
      }
    }
    
    assertTrue(deletedVariableUpdateFound);
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:24,代碼來源:RuntimeServiceTest.java

示例7: testTaskComments

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
public void testTaskComments() {
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    Task task = taskService.newTask();
    task.setOwner("johndoe");
    taskService.saveTask(task);
    String taskId = task.getId();

    identityService.setAuthenticatedUserId("johndoe");
    // Fetch the task again and update
    taskService.addComment(taskId, null, "look at this \n       isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd");
    Comment comment = taskService.getTaskComments(taskId).get(0);
    assertEquals("johndoe", comment.getUserId());
    assertEquals(taskId, comment.getTaskId());
    assertNull(comment.getProcessInstanceId());
    assertEquals("look at this isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg ...", ((Event)comment).getMessage());
    assertEquals("look at this \n       isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd", comment.getFullMessage());
    assertNotNull(comment.getTime());

    // Finally, delete task
    taskService.deleteTask(taskId, true);
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:23,代碼來源:TaskServiceTest.java

示例8: testTaskAttachmentWithProcessInstanceId

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testTaskAttachmentWithProcessInstanceId() {
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
    
    String processInstanceId = processInstance.getId();
    taskService.createAttachment("web page", null, processInstanceId, "weatherforcast", "temperatures and more", "http://weather.com");
    Attachment attachment = taskService.getProcessInstanceAttachments(processInstanceId).get(0);
    assertEquals("weatherforcast", attachment.getName());
    assertEquals("temperatures and more", attachment.getDescription());
    assertEquals("web page", attachment.getType());
    assertEquals(processInstanceId, attachment.getProcessInstanceId());
    assertNull(attachment.getTaskId());
    assertEquals("http://weather.com", attachment.getUrl());
    assertNull(taskService.getAttachmentContent(attachment.getId()));
    
    // Finally, clean up
    taskService.deleteAttachment(attachment.getId());
    
    // TODO: Bad API design. Need to fix attachment/comment properly
    ((TaskServiceImpl) taskService).deleteComments(null, processInstanceId);
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:25,代碼來源:TaskServiceTest.java

示例9: testCompleteTaskWithParametersEmptyParameters

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void testCompleteTaskWithParametersEmptyParameters() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  
  String taskId = task.getId();
  taskService.complete(taskId, Collections.EMPTY_MAP);

  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    historyService.deleteHistoricTaskInstance(taskId);
  }
  
  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertNull(task);
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:17,代碼來源:TaskServiceTest.java

示例10: testDeleteTaskWithDeleteReason

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
public void testDeleteTaskWithDeleteReason() {
  // ACT-900: deleteReason can be manually specified - can only be validated when historyLevel > ACTIVITY
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    
    Task task = taskService.newTask();
    task.setName("test task");
    taskService.saveTask(task);
    
    assertNotNull(task.getId());
    
    taskService.deleteTask(task.getId(), "deleted for testing purposes");
    
    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery()
      .taskId(task.getId()).singleResult();
    
    assertNotNull(historicTaskInstance);
    assertEquals("deleted for testing purposes", historicTaskInstance.getDeleteReason());
    
    // Delete historic task that is left behind, will not be cleaned up because this is not part of a process
    taskService.deleteTask(task.getId(), true);
    
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:24,代碼來源:TaskServiceTest.java

示例11: testResolveTaskWithParametersNullParameters

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
public void testResolveTaskWithParametersNullParameters() {
  Task task = taskService.newTask();
  task.setDelegationState(DelegationState.PENDING);
  taskService.saveTask(task);

  String taskId = task.getId();
  taskService.resolveTask(taskId, null);

  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals(DelegationState.RESOLVED, task.getDelegationState());

  taskService.deleteTask(taskId, true);
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:19,代碼來源:TaskServiceTest.java

示例12: testResolveTaskWithParametersEmptyParameters

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void testResolveTaskWithParametersEmptyParameters() {
  Task task = taskService.newTask();
  task.setDelegationState(DelegationState.PENDING);
  taskService.saveTask(task);

  String taskId = task.getId();
  taskService.resolveTask(taskId, Collections.EMPTY_MAP);

  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals(DelegationState.RESOLVED, task.getDelegationState());

  taskService.deleteTask(taskId, true);
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:20,代碼來源:TaskServiceTest.java

示例13: testQueryByInvolvedUser

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
public void testQueryByInvolvedUser() {
  try {
    Task adhocTask = taskService.newTask();
    adhocTask.setAssignee("kermit");
    adhocTask.setOwner("fozzie");
    taskService.saveTask(adhocTask);
    taskService.addUserIdentityLink(adhocTask.getId(), "gonzo", "customType");
    
    assertEquals(3, taskService.getIdentityLinksForTask(adhocTask.getId()).size());
    
    assertEquals(1, taskService.createTaskQuery().taskId(adhocTask.getId()).taskInvolvedUser("gonzo").count());
    assertEquals(1, taskService.createTaskQuery().taskId(adhocTask.getId()).taskInvolvedUser("kermit").count());
    assertEquals(1, taskService.createTaskQuery().taskId(adhocTask.getId()).taskInvolvedUser("fozzie").count());
    
  } finally {
    List<Task> allTasks = taskService.createTaskQuery().list();
    for(Task task : allTasks) {
      if(task.getExecutionId() == null) {
        taskService.deleteTask(task.getId());
        if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
          historyService.deleteHistoricTaskInstance(task.getId());
        }
      }
    }
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:27,代碼來源:TaskQueryTest.java

示例14: testWithoutDueDateQuery

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@Deployment(resources={"org/activiti/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testWithoutDueDateQuery() throws Exception {
  if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
    HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).withoutTaskDueDate().singleResult();
    assertNotNull(historicTask);
    assertNull(historicTask.getDueDate());
    
    // Set due-date on task
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    Date dueDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
    task.setDueDate(dueDate);
    taskService.saveTask(task);

    assertEquals(0, historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).withoutTaskDueDate().count());
    
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    
    // Clear due-date on task
    task.setDueDate(null);
    taskService.saveTask(task);
    
    assertEquals(1, historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).withoutTaskDueDate().count());
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:26,代碼來源:HistoricTaskAndVariablesQueryTest.java

示例15: testTaskPropertiesNotNull

import org.activiti.engine.impl.history.HistoryLevel; //導入依賴的package包/類
@Deployment
public void testTaskPropertiesNotNull() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
  
  Task task = taskService.createTaskQuery().singleResult();
  assertNotNull(task.getId());
  assertEquals("my task", task.getName());
  assertEquals("Very important", task.getDescription());
  assertTrue(task.getPriority() > 0);
  assertEquals("kermit", task.getAssignee());
  assertEquals(processInstance.getId(), task.getProcessInstanceId());
  assertEquals(processInstance.getId(), task.getExecutionId());
  assertNotNull(task.getProcessDefinitionId());
  assertNotNull(task.getTaskDefinitionKey());
  assertNotNull(task.getCreateTime());
  
  // the next test verifies that if an execution creates a task, that no events are created during creation of the task.
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    assertEquals(0, taskService.getTaskEvents(task.getId()).size());
  }
}
 
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:22,代碼來源:UserTaskTest.java


注:本文中的org.activiti.engine.impl.history.HistoryLevel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。