Search in sources :

Example 1 with PersistedCommandContext

use of org.ovirt.engine.core.common.utils.PersistedCommandContext in project ovirt-engine by oVirt.

the class CommandContextsCacheImpl method buildCommandContext.

private CommandContext buildCommandContext(CommandEntity cmdEntity) {
    ExecutionContext executionContext = new ExecutionContext();
    PersistedCommandContext persistedCommandContext = cmdEntity.getCommandContext();
    if (!Guid.isNullOrEmpty(persistedCommandContext.getJobId())) {
        executionContext.setJob(jobRepository.getJobWithSteps(persistedCommandContext.getJobId()));
    } else if (!Guid.isNullOrEmpty(persistedCommandContext.getStepId())) {
        executionContext.setStep(jobRepository.getStep(persistedCommandContext.getStepId(), false));
    }
    executionContext.setExecutionMethod(persistedCommandContext.getExecutionMethod());
    executionContext.setCompleted(persistedCommandContext.isCompleted());
    executionContext.setJobRequired(persistedCommandContext.isJobRequired());
    executionContext.setMonitored(persistedCommandContext.isMonitored());
    executionContext.setShouldEndJob(persistedCommandContext.shouldEndJob());
    executionContext.setTasksMonitored(persistedCommandContext.isTasksMonitored());
    return new CommandContext(new EngineContext()).withExecutionContext(executionContext);
}
Also used : ExecutionContext(org.ovirt.engine.core.bll.job.ExecutionContext) CommandContext(org.ovirt.engine.core.bll.context.CommandContext) PersistedCommandContext(org.ovirt.engine.core.common.utils.PersistedCommandContext) EngineContext(org.ovirt.engine.core.bll.context.EngineContext) PersistedCommandContext(org.ovirt.engine.core.common.utils.PersistedCommandContext)

Example 2 with PersistedCommandContext

use of org.ovirt.engine.core.common.utils.PersistedCommandContext in project ovirt-engine by oVirt.

the class CommandBase method buildPersistedCommandContext.

private PersistedCommandContext buildPersistedCommandContext() {
    PersistedCommandContext persistedCommandContext = new PersistedCommandContext();
    persistedCommandContext.setJobId(getExecutionContext() == null || getExecutionContext().getJob() == null ? null : getExecutionContext().getJob().getId());
    persistedCommandContext.setStepId(getExecutionContext() == null || getExecutionContext().getStep() == null ? null : getExecutionContext().getStep().getId());
    persistedCommandContext.setExecutionMethod(getExecutionContext() == null ? ExecutionMethod.AsStep : getExecutionContext().getExecutionMethod());
    if (getExecutionContext() != null) {
        persistedCommandContext.setCompleted(getExecutionContext().isCompleted());
        persistedCommandContext.setJobRequired(getExecutionContext().isJobRequired());
        persistedCommandContext.setMonitored(getExecutionContext().isMonitored());
        persistedCommandContext.setShouldEndJob(getExecutionContext().shouldEndJob());
        persistedCommandContext.setTasksMonitored(getExecutionContext().isTasksMonitored());
    }
    return persistedCommandContext;
}
Also used : PersistedCommandContext(org.ovirt.engine.core.common.utils.PersistedCommandContext)

Aggregations

PersistedCommandContext (org.ovirt.engine.core.common.utils.PersistedCommandContext)2 CommandContext (org.ovirt.engine.core.bll.context.CommandContext)1 EngineContext (org.ovirt.engine.core.bll.context.EngineContext)1 ExecutionContext (org.ovirt.engine.core.bll.job.ExecutionContext)1