Package org.camunda.bpm.engine.history

Examples of org.camunda.bpm.engine.history.UserOperationLogEntry


    // then
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_COMPLETE);

    assertEquals(1, query.count());

    UserOperationLogEntry entry = query.singleResult();
    assertNotNull(entry);

    assertEquals(caseDefinitionId, entry.getCaseDefinitionId());
    assertEquals(caseInstanceId, entry.getCaseInstanceId());
    assertEquals(humanTaskId, entry.getCaseExecutionId());

    assertFalse(Boolean.valueOf(entry.getOrgValue()));
    assertTrue(Boolean.valueOf(entry.getNewValue()));
    assertEquals(DELETE, entry.getProperty());

  }
View Full Code Here


    // given
    startTestProcess();

    // an op log instance is created
    taskService.resolveTask(task.getId());
    UserOperationLogEntry opLogEntry = historyService.createUserOperationLogQuery().singleResult();

    // when the op log instance is deleted
    historyService.deleteUserOperationLogEntry(opLogEntry.getId());

    // then it should be removed from the database
    assertEquals(0, historyService.createUserOperationLogQuery().count());
  }
View Full Code Here

    // expect: one entry for the deletion
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_DELETE);
    assertEquals(1, query.count());

    // assert: details
    UserOperationLogEntry delete = query.singleResult();
    assertEquals(DELETE, delete.getProperty());
    assertFalse(Boolean.parseBoolean(delete.getOrgValue()));
    assertTrue(Boolean.parseBoolean(delete.getNewValue()));

    cleanupHistory();
  }
View Full Code Here

    // then: save the task without any property change
    taskService.saveTask(task);

    // expect: no entry
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_CREATE);
    UserOperationLogEntry create = query.singleResult();
    assertNotNull(create);
    assertEquals(ENTITY_TYPE_TASK, create.getEntityType());
    assertNull(create.getOrgValue());
    assertNull(create.getNewValue());
    assertNull(create.getProperty());

    task.setAssignee("icke");
    task.setName("to do");

    // then: save the task again
View Full Code Here

    // then: change a property twice
    task.setName("a task");
    task.setName("to do");
    taskService.saveTask(task);
    UserOperationLogEntry update = queryOperationDetails(OPERATION_TYPE_UPDATE).singleResult();
    assertNull(update.getOrgValue());
    assertEquals("to do", update.getNewValue());

    // clean up DB
    taskService.deleteTask(task.getId());
    cleanupHistory();
  }
View Full Code Here

    task = taskService.newTask();
    Date now = ClockUtil.getCurrentTime();
    task.setDueDate(now);
    taskService.saveTask(task);

    UserOperationLogEntry logEntry = historyService.createUserOperationLogQuery().singleResult();
    assertEquals(String.valueOf(now.getTime()), logEntry.getNewValue());

    // clean up DB
    taskService.deleteTask(task.getId());
    cleanupHistory();
  }
View Full Code Here

    // then: change the name
    String name = "a task";
    task.setName(name);
    taskService.saveTask(task);
    UserOperationLogEntry update = queryOperationDetails(OPERATION_TYPE_UPDATE).singleResult();
    assertNull(update.getOrgValue());
    assertEquals(name, update.getNewValue());

    // then: change the name some times and set it back to the original value
    task.setName("to do 1");
    task.setName("to do 2");
    task.setName(name);
    taskService.saveTask(task);

    // expect: there is no additional change tracked
    update = queryOperationDetails(OPERATION_TYPE_UPDATE).singleResult();
    assertNull(update.getOrgValue());
    assertEquals(name, update.getNewValue());

    // clean up DB
    taskService.deleteTask(task.getId());
    cleanupHistory();
  }
View Full Code Here

    task.setCaseInstanceId("aCaseInstanceId");
    taskService.saveTask(task);

    assertEquals(1, query.count());

    UserOperationLogEntry entry = query.singleResult();
    assertNotNull(entry);

    assertNull(entry.getOrgValue());
    assertEquals("aCaseInstanceId", entry.getNewValue());
    assertEquals(CASE_INSTANCE_ID, entry.getProperty());

    // change case instance id and save task
    task.setCaseInstanceId("anotherCaseInstanceId");
    taskService.saveTask(task);

    assertEquals(2, query.count());

    List<UserOperationLogEntry> entries = query.list();
    assertEquals(2, entries.size());

    for (UserOperationLogEntry currentEntry : entries) {
      if (!currentEntry.getId().equals(entry.getId())) {
        assertEquals("aCaseInstanceId", currentEntry.getOrgValue());
        assertEquals("anotherCaseInstanceId", currentEntry.getNewValue());
        assertEquals(CASE_INSTANCE_ID, currentEntry.getProperty());
      }
    }
View Full Code Here

    entries.add(createUserOperationLogEntry());
    return entries;
  }

  private static UserOperationLogEntry createUserOperationLogEntry() {
    UserOperationLogEntry entry = mock(UserOperationLogEntry.class);
    when(entry.getId()).thenReturn(EXAMPLE_USER_OPERATION_LOG_ID);
    when(entry.getProcessDefinitionId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID);
    when(entry.getProcessDefinitionKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY);
    when(entry.getProcessInstanceId()).thenReturn(EXAMPLE_PROCESS_INSTANCE_ID);
    when(entry.getExecutionId()).thenReturn(EXAMPLE_EXECUTION_ID);
    when(entry.getCaseDefinitionId()).thenReturn(EXAMPLE_CASE_DEFINITION_ID);
    when(entry.getCaseInstanceId()).thenReturn(EXAMPLE_CASE_INSTANCE_ID);
    when(entry.getCaseExecutionId()).thenReturn(EXAMPLE_CASE_EXECUTION_ID);
    when(entry.getTaskId()).thenReturn(EXAMPLE_TASK_ID);
    when(entry.getUserId()).thenReturn(EXAMPLE_USER_ID);
    when(entry.getTimestamp()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_USER_OPERATION_TIMESTAMP));
    when(entry.getOperationId()).thenReturn(EXAMPLE_USER_OPERATION_ID);
    when(entry.getOperationType()).thenReturn(EXAMPLE_USER_OPERATION_TYPE);
    when(entry.getEntityType()).thenReturn(EXAMPLE_USER_OPERATION_ENTITY);
    when(entry.getProperty()).thenReturn(EXAMPLE_USER_OPERATION_PROPERTY);
    when(entry.getOrgValue()).thenReturn(EXAMPLE_USER_OPERATION_ORG_VALUE);
    when(entry.getNewValue()).thenReturn(EXAMPLE_USER_OPERATION_NEW_VALUE);
    return entry;
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.history.UserOperationLogEntry

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.