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);
}
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;
}
Aggregations