本文整理汇总了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();
}
}
示例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"));
}
}
示例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);
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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());
}
}
}
}
}
示例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());
}
}
示例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());
}
}