use of org.ovirt.engine.api.model.Creation in project ovirt-engine by oVirt.
the class CreationMapper method map.
@Mapping(from = List.class, to = Creation.class)
public static Creation map(List<AsyncTaskStatus> entity, Creation template) {
Creation model = template != null ? template : new Creation();
CreationStatus asyncStatus = null;
for (AsyncTaskStatus task : entity) {
asyncStatus = AsyncTaskMapper.map(task, asyncStatus);
}
model.setStatus(asyncStatus.value());
if (asyncStatus == CreationStatus.FAILED) {
model.setFault(new Fault());
for (AsyncTaskStatus task : entity) {
if (task.getException() != null) {
model.getFault().setDetail(task.getException().toString());
break;
}
}
}
return model;
}
Aggregations