use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntry in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method createUserOperationLogEvents.
// User Operation Logs ///////////////////////////
public List<HistoryEvent> createUserOperationLogEvents(UserOperationLogContext context) {
List<HistoryEvent> historyEvents = new ArrayList<HistoryEvent>();
String operationId = Context.getCommandContext().getOperationId();
context.setOperationId(operationId);
for (UserOperationLogContextEntry entry : context.getEntries()) {
for (PropertyChange propertyChange : entry.getPropertyChanges()) {
UserOperationLogEntryEventEntity evt = new UserOperationLogEntryEventEntity();
initUserOperationLogEvent(evt, context, entry, propertyChange);
historyEvents.add(evt);
}
}
return historyEvents;
}
use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntry in project camunda-bpm-platform by camunda.
the class SetJobDefinitionPriorityCmd method createJobDefinitionOperationLogEntry.
protected void createJobDefinitionOperationLogEntry(UserOperationLogContext opLogContext, Long previousPriority, JobDefinitionEntity jobDefinition) {
PropertyChange propertyChange = new PropertyChange(JOB_DEFINITION_OVERRIDING_PRIORITY, previousPriority, jobDefinition.getOverridingJobPriority());
UserOperationLogContextEntry entry = UserOperationLogContextEntryBuilder.entry(UserOperationLogEntry.OPERATION_TYPE_SET_PRIORITY, EntityTypes.JOB_DEFINITION).inContextOf(jobDefinition).propertyChanges(propertyChange).create();
opLogContext.addEntry(entry);
}
use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntry in project camunda-bpm-platform by camunda.
the class SetJobDefinitionPriorityCmd method createCascadeJobsOperationLogEntry.
protected void createCascadeJobsOperationLogEntry(UserOperationLogContext opLogContext, JobDefinitionEntity jobDefinition) {
// old value is unknown
PropertyChange propertyChange = new PropertyChange(SetJobPriorityCmd.JOB_PRIORITY_PROPERTY, null, jobDefinition.getOverridingJobPriority());
UserOperationLogContextEntry entry = UserOperationLogContextEntryBuilder.entry(UserOperationLogEntry.OPERATION_TYPE_SET_PRIORITY, EntityTypes.JOB).inContextOf(jobDefinition).propertyChanges(propertyChange).create();
opLogContext.addEntry(entry);
}
use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntry 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