use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.
the class DeleteHistoricDecisionInstancesBatchCmd method writeUserOperationLog.
protected void writeUserOperationLog(CommandContext commandContext, int numInstances) {
List<PropertyChange> propertyChanges = new ArrayList<PropertyChange>();
propertyChanges.add(new PropertyChange("nrOfInstances", null, numInstances));
propertyChanges.add(new PropertyChange("async", null, true));
propertyChanges.add(new PropertyChange("type", null, "history"));
propertyChanges.add(new PropertyChange("deleteReason", null, deleteReason));
commandContext.getOperationLogManager().logDecisionInstanceOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE, propertyChanges);
}
use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testAllTrackedProperties.
public void testAllTrackedProperties() {
Date yesterday = new Date(new Date().getTime() - 86400000);
Date tomorrow = new Date(new Date().getTime() + 86400000);
TaskEntity entity = new TaskEntity();
// call all tracked setter methods
entity.setAssignee("er");
entity.setDelegationState(DelegationState.PENDING);
entity.setDeleted(true);
entity.setDescription("a description");
entity.setDueDate(tomorrow);
entity.setFollowUpDate(yesterday);
entity.setName("to do");
entity.setOwner("icke");
entity.setParentTaskId("parent");
entity.setPriority(73);
// and validate the change list
Map<String, PropertyChange> changes = entity.getPropertyChanges();
assertEquals("er", changes.get(ASSIGNEE).getNewValue());
assertSame(DelegationState.PENDING, changes.get(DELEGATION).getNewValue());
assertTrue((Boolean) changes.get(DELETE).getNewValue());
assertEquals("a description", changes.get(DESCRIPTION).getNewValue());
assertEquals(tomorrow, changes.get(DUE_DATE).getNewValue());
assertEquals(yesterday, changes.get(FOLLOW_UP_DATE).getNewValue());
assertEquals("to do", changes.get(NAME).getNewValue());
assertEquals("icke", changes.get(OWNER).getNewValue());
assertEquals("parent", changes.get(PARENT_TASK).getNewValue());
assertEquals(73, changes.get(PRIORITY).getNewValue());
}
use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testBeanPropertyChanges.
public void testBeanPropertyChanges() {
TaskEntity entity = new TaskEntity();
// assign and validate changes
entity.setAssignee("icke");
Map<String, PropertyChange> changes = entity.getPropertyChanges();
assertEquals(1, changes.size());
assertNull(changes.get(ASSIGNEE).getOrgValue());
assertEquals("icke", changes.get(ASSIGNEE).getNewValue());
// assign it again
entity.setAssignee("er");
changes = entity.getPropertyChanges();
assertEquals(1, changes.size());
// original value is still null because the task was not saved
assertNull(changes.get(ASSIGNEE).getOrgValue());
assertEquals("er", changes.get(ASSIGNEE).getNewValue());
// set a due date
entity.setDueDate(new Date());
changes = entity.getPropertyChanges();
assertEquals(2, changes.size());
}
use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.
the class DeleteGroupIdentityLinkCmd method execute.
@Override
public Void execute(CommandContext commandContext) {
super.execute(commandContext);
PropertyChange propertyChange = new PropertyChange(type, null, groupId);
commandContext.getOperationLogManager().logLinkOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_GROUP_LINK, task, propertyChange);
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.
the class CustomUserOperationLogTest method testDoNotOverwriteUserId.
@Test
public void testDoNotOverwriteUserId() throws Exception {
commandExecutor.execute(new Command<Void>() {
@Override
public Void execute(final CommandContext commandContext) {
final UserOperationLogContext userOperationLogContext = new UserOperationLogContext();
userOperationLogContext.setUserId("kermit");
final UserOperationLogContextEntry entry = new UserOperationLogContextEntry("foo", "bar");
entry.setPropertyChanges(Arrays.asList(new PropertyChange(null, null, null)));
entry.setTaskId(TASK_ID);
userOperationLogContext.addEntry(entry);
commandContext.getOperationLogManager().logUserOperations(userOperationLogContext);
return null;
}
});
// and check its there
assertThat(historyService.createUserOperationLogQuery().taskId(TASK_ID).singleResult().getUserId(), is("kermit"));
}
Aggregations