Search in sources :

Example 1 with Creation

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;
}
Also used : Creation(org.ovirt.engine.api.model.Creation) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) Fault(org.ovirt.engine.api.model.Fault) CreationStatus(org.ovirt.engine.api.model.CreationStatus)

Aggregations

Creation (org.ovirt.engine.api.model.Creation)1 CreationStatus (org.ovirt.engine.api.model.CreationStatus)1 Fault (org.ovirt.engine.api.model.Fault)1 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1