use of org.ovirt.engine.core.common.businessentities.SubjectEntity in project ovirt-engine by oVirt.
the class JobSubjectEntityDaoImpl method getJobSubjectEntityByJobId.
@Override
public Map<Guid, VdcObjectType> getJobSubjectEntityByJobId(Guid jobId) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("job_id", jobId);
List<SubjectEntity> list = getCallsHandler().executeReadList("GetJobSubjectEntityByJobId", jobSubjectEntityRowMapper, parameterSource);
Map<Guid, VdcObjectType> entityMap = new HashMap<>();
for (SubjectEntity jobSubjectEntity : list) {
entityMap.put(jobSubjectEntity.getEntityId(), jobSubjectEntity.getEntityType());
}
return entityMap;
}
use of org.ovirt.engine.core.common.businessentities.SubjectEntity in project ovirt-engine by oVirt.
the class StepMapper method mapStepSubjectEntities.
private static void mapStepSubjectEntities(org.ovirt.engine.core.common.job.Step entity, Step model) {
if (entity.getSubjectEntities() != null) {
for (SubjectEntity subjectEntity : entity.getSubjectEntities()) {
if (subjectEntity.getEntityType() == VdcObjectType.EXECUTION_HOST) {
model.setExecutionHost(new Host());
model.getExecutionHost().setId(subjectEntity.getEntityId().toString());
break;
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.SubjectEntity in project ovirt-engine by oVirt.
the class StepDaoTest method startedStepsByStepSubjectEntityOtherStatuses.
@Test
public void startedStepsByStepSubjectEntityOtherStatuses() {
StepSubjectEntity subjectEntity = prepareStartedStepsByStepSubjectEntityTest();
Step step = dao.get(FixturesTool.STEP_ID);
Arrays.stream(JobExecutionStatus.values()).filter(status -> status != JobExecutionStatus.STARTED).forEach(status -> {
step.setStatus(status);
dao.update(step);
assertNoStartedStepsForSubjectEntity(subjectEntity);
});
}
use of org.ovirt.engine.core.common.businessentities.SubjectEntity in project ovirt-engine by oVirt.
the class MaintenanceNumberOfVdssCommand method validateNoRunningJobs.
private boolean validateNoRunningJobs(VDS vds) {
List<Step> steps = stepDao.getStartedStepsByStepSubjectEntity(new SubjectEntity(VdcObjectType.EXECUTION_HOST, vds.getId()));
if (!steps.isEmpty()) {
List<String> replacements = new ArrayList<>(2);
replacements.add(ReplacementUtils.createSetVariableString("host", vds.getName()));
replacements.addAll(ReplacementUtils.replaceWith("jobs", steps.stream().map(s -> s.getDescription()).collect(Collectors.toList())));
return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_HOST_WITH_RUNNING_OPERATIONS, replacements);
}
return true;
}
Aggregations