Search in sources :

Example 6 with UserOperationLogContext

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

the class UserOperationLogManager method logTaskOperations.

public void logTaskOperations(String operation, TaskEntity task, List<PropertyChange> propertyChanges) {
    if (isUserOperationLogEnabled()) {
        UserOperationLogContext context = new UserOperationLogContext();
        UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.TASK).inContextOf(task, propertyChanges);
        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 7 with UserOperationLogContext

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

the class UserOperationLogManager method logJobDefinitionOperation.

public void logJobDefinitionOperation(String operation, String jobDefinitionId, String processDefinitionId, String processDefinitionKey, PropertyChange propertyChange) {
    if (isUserOperationLogEnabled()) {
        UserOperationLogContext context = new UserOperationLogContext();
        UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.JOB_DEFINITION).jobDefinitionId(jobDefinitionId).processDefinitionId(processDefinitionId).processDefinitionKey(processDefinitionKey).propertyChanges(propertyChange);
        if (jobDefinitionId != null) {
            JobDefinitionEntity jobDefinition = getJobDefinitionManager().findById(jobDefinitionId);
            // Backward compatibility
            if (jobDefinition != null) {
                entryBuilder.inContextOf(jobDefinition);
            }
        } else if (processDefinitionId != null) {
            ProcessDefinitionEntity definition = getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
            // Backward compatibility
            if (definition != null) {
                entryBuilder.inContextOf(definition);
            }
        }
        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 8 with UserOperationLogContext

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

the class SetJobDefinitionPriorityCmd method execute.

public Void execute(CommandContext commandContext) {
    ensureNotNull(NotValidException.class, "jobDefinitionId", jobDefinitionId);
    JobDefinitionEntity jobDefinition = commandContext.getJobDefinitionManager().findById(jobDefinitionId);
    ensureNotNull(NotFoundException.class, "Job definition with id '" + jobDefinitionId + "' does not exist", "jobDefinition", jobDefinition);
    checkUpdateProcess(commandContext, jobDefinition);
    Long currentPriority = jobDefinition.getOverridingJobPriority();
    jobDefinition.setJobPriority(priority);
    UserOperationLogContext opLogContext = new UserOperationLogContext();
    createJobDefinitionOperationLogEntry(opLogContext, currentPriority, jobDefinition);
    if (cascade && priority != null) {
        commandContext.getJobManager().updateJobPriorityByDefinitionId(jobDefinitionId, priority);
        createCascadeJobsOperationLogEntry(opLogContext, jobDefinition);
    }
    commandContext.getOperationLogManager().logUserOperations(opLogContext);
    return null;
}
Also used : JobDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionEntity) UserOperationLogContext(org.camunda.bpm.engine.impl.oplog.UserOperationLogContext)

Example 9 with UserOperationLogContext

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

the class UserOperationLogManager method logProcessInstanceOperation.

public void logProcessInstanceOperation(String operation, String processInstanceId, String processDefinitionId, String processDefinitionKey, List<PropertyChange> propertyChanges) {
    if (isUserOperationLogEnabled()) {
        UserOperationLogContext context = new UserOperationLogContext();
        UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.PROCESS_INSTANCE).propertyChanges(propertyChanges).processInstanceId(processInstanceId).processDefinitionId(processDefinitionId).processDefinitionKey(processDefinitionKey);
        if (processInstanceId != null) {
            ExecutionEntity instance = getProcessInstanceManager().findExecutionById(processInstanceId);
            if (instance != null) {
                entryBuilder.inContextOf(instance);
            }
        } else if (processDefinitionId != null) {
            ProcessDefinitionEntity definition = getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
            if (definition != null) {
                entryBuilder.inContextOf(definition);
            }
        }
        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 10 with UserOperationLogContext

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

the class UserOperationLogManager method logProcessDefinitionOperation.

public void logProcessDefinitionOperation(String operation, String processDefinitionId, String processDefinitionKey, PropertyChange propertyChange) {
    if (isUserOperationLogEnabled()) {
        UserOperationLogContext context = new UserOperationLogContext();
        UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.PROCESS_DEFINITION).propertyChanges(propertyChange).processDefinitionId(processDefinitionId).processDefinitionKey(processDefinitionKey);
        if (processDefinitionId != null) {
            ProcessDefinitionEntity definition = getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
            entryBuilder.inContextOf(definition);
        }
        context.addEntry(entryBuilder.create());
        fireUserOperationLog(context);
    }
}
Also used : UserOperationLogContext(org.camunda.bpm.engine.impl.oplog.UserOperationLogContext) UserOperationLogContextEntryBuilder(org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntryBuilder)

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