Search in sources :

Example 11 with UserOperationLogContext

use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContext in project camunda-bpm-platform by camunda.

the class UserOperationLogManager method logBatchOperation.

public void logBatchOperation(String operation, String batchId, PropertyChange propertyChange) {
    if (isUserOperationLogEnabled()) {
        UserOperationLogContext context = new UserOperationLogContext();
        UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.BATCH).batchId(batchId).propertyChanges(propertyChange);
        context.addEntry(entryBuilder.create());
        fireUserOperationLog(context);
    }
}
Also used : UserOperationLogContext(org.camunda.bpm.engine.impl.oplog.UserOperationLogContext) UserOperationLogContextEntryBuilder(org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntryBuilder)

Example 12 with UserOperationLogContext

use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContext in project camunda-bpm-platform by camunda.

the class UserOperationLogManager method logVariableOperation.

public void logVariableOperation(String operation, String executionId, String taskId, PropertyChange propertyChange) {
    if (isUserOperationLogEnabled()) {
        UserOperationLogContext context = new UserOperationLogContext();
        UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.VARIABLE).propertyChanges(propertyChange);
        if (executionId != null) {
            ExecutionEntity execution = getProcessInstanceManager().findExecutionById(executionId);
            entryBuilder.inContextOf(execution);
        } else if (taskId != null) {
            TaskEntity task = getTaskManager().findTaskById(taskId);
            entryBuilder.inContextOf(task, Arrays.asList(propertyChange));
        }
        context.addEntry(entryBuilder.create());
        fireUserOperationLog(context);
    }
}
Also used : UserOperationLogContext(org.camunda.bpm.engine.impl.oplog.UserOperationLogContext) UserOperationLogContextEntryBuilder(org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntryBuilder)

Example 13 with UserOperationLogContext

use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContext in project camunda-bpm-platform by camunda.

the class UserOperationLogManager method logAttachmentOperation.

public void logAttachmentOperation(String operation, ExecutionEntity processInstance, PropertyChange propertyChange) {
    if (isUserOperationLogEnabled()) {
        UserOperationLogContext context = new UserOperationLogContext();
        UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.ATTACHMENT).inContextOf(processInstance, Arrays.asList(propertyChange));
        context.addEntry(entryBuilder.create());
        fireUserOperationLog(context);
    }
}
Also used : UserOperationLogContext(org.camunda.bpm.engine.impl.oplog.UserOperationLogContext) UserOperationLogContextEntryBuilder(org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntryBuilder)

Example 14 with UserOperationLogContext

use of org.camunda.bpm.engine.impl.oplog.UserOperationLogContext 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"));
}
Also used : PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) UserOperationLogContext(org.camunda.bpm.engine.impl.oplog.UserOperationLogContext) UserOperationLogContextEntry(org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntry) Test(org.junit.Test)

Aggregations

UserOperationLogContext (org.camunda.bpm.engine.impl.oplog.UserOperationLogContext)14 UserOperationLogContextEntryBuilder (org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntryBuilder)12 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 UserOperationLogContextEntry (org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntry)1 JobDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionEntity)1 PropertyChange (org.camunda.bpm.engine.impl.persistence.entity.PropertyChange)1 Test (org.junit.Test)1