Search in sources :

Example 1 with OperatingSystemInfos

use of org.ovirt.engine.api.model.OperatingSystemInfos in project ovirt-engine by oVirt.

the class V3OperatingSystemInfosInAdapter method adapt.

@Override
public OperatingSystemInfos adapt(V3OperatingSystemInfos from) {
    OperatingSystemInfos to = new OperatingSystemInfos();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getOperatingSystemInfos().addAll(adaptIn(from.getOperatingSystemInfos()));
    return to;
}
Also used : V3OperatingSystemInfos(org.ovirt.engine.api.v3.types.V3OperatingSystemInfos) OperatingSystemInfos(org.ovirt.engine.api.model.OperatingSystemInfos)

Example 2 with OperatingSystemInfos

use of org.ovirt.engine.api.model.OperatingSystemInfos in project ovirt-engine by oVirt.

the class BackendOperatingSystemsResource method list.

@Override
public OperatingSystemInfos list() {
    OsRepository repository = SimpleDependencyInjector.getInstance().get(OsRepository.class);
    final Map<Integer, VmIconIdSizePair> iconDefaults = getIconDefaults();
    List<Integer> ids = repository.getOsIds();
    Map<Integer, String> uniqueNames = repository.getUniqueOsNames();
    Map<Integer, String> names = repository.getOsNames();
    OperatingSystemInfos collection = new OperatingSystemInfos();
    for (Integer id : ids) {
        OperatingSystemInfo model = new OperatingSystemInfo();
        model.setId(id.toString());
        if (iconDefaults.containsKey(id)) {
            final VmIconIdSizePair iconDefault = iconDefaults.get(id);
            model.setSmallIcon(IconHelper.createIcon(iconDefault.getSmall()));
            model.setLargeIcon(IconHelper.createIcon(iconDefault.getLarge()));
        }
        String uniqueName = uniqueNames.get(id);
        if (uniqueName != null) {
            model.setName(uniqueName);
        }
        String name = names.get(id);
        if (name != null) {
            model.setDescription(name);
        }
        collection.getOperatingSystemInfos().add(addLinks(model));
    }
    return collection;
}
Also used : VmIconIdSizePair(org.ovirt.engine.core.common.queries.VmIconIdSizePair) OperatingSystemInfo(org.ovirt.engine.api.model.OperatingSystemInfo) OsRepository(org.ovirt.engine.core.common.osinfo.OsRepository) OperatingSystemInfos(org.ovirt.engine.api.model.OperatingSystemInfos)

Aggregations

OperatingSystemInfos (org.ovirt.engine.api.model.OperatingSystemInfos)2 OperatingSystemInfo (org.ovirt.engine.api.model.OperatingSystemInfo)1 V3OperatingSystemInfos (org.ovirt.engine.api.v3.types.V3OperatingSystemInfos)1 OsRepository (org.ovirt.engine.core.common.osinfo.OsRepository)1 VmIconIdSizePair (org.ovirt.engine.core.common.queries.VmIconIdSizePair)1