Search in sources :

Example 1 with GraphicsConsoles

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

the class V3GraphicsConsolesInAdapter method adapt.

@Override
public GraphicsConsoles adapt(V3GraphicsConsoles from) {
    GraphicsConsoles to = new GraphicsConsoles();
    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.getGraphicsConsoles().addAll(adaptIn(from.getGraphicsConsoles()));
    return to;
}
Also used : V3GraphicsConsoles(org.ovirt.engine.api.v3.types.V3GraphicsConsoles) GraphicsConsoles(org.ovirt.engine.api.model.GraphicsConsoles)

Example 2 with GraphicsConsoles

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

the class BackendVmGraphicsConsolesResource method list.

@Override
public GraphicsConsoles list() {
    GraphicsConsoles consoles = new GraphicsConsoles();
    Map<GraphicsType, GraphicsInfo> graphicsTypeToGraphicsInfo;
    VM entity = loadEntity();
    boolean current = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, CURRENT, true, false);
    if (current) {
        // from entity dynamic (e.g. what is now present on the VM
        graphicsTypeToGraphicsInfo = extractGraphicsInofs(entity);
    } else {
        // from devices (e.g. what is configured on the VM)
        List<GraphicsType> graphicsTypes = DisplayHelper.getGraphicsTypesForEntity(this, guid, true);
        graphicsTypeToGraphicsInfo = new EnumMap<>(GraphicsType.class);
        for (GraphicsType type : graphicsTypes) {
            graphicsTypeToGraphicsInfo.put(type, null);
        }
    }
    for (Map.Entry<GraphicsType, GraphicsInfo> graphicsInfo : graphicsTypeToGraphicsInfo.entrySet()) {
        consoles.getGraphicsConsoles().add(addLinks(populate(VmMapper.map(graphicsInfo, null), entity)));
    }
    return consoles;
}
Also used : GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) GraphicsConsoles(org.ovirt.engine.api.model.GraphicsConsoles) VM(org.ovirt.engine.core.common.businessentities.VM) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo) EnumMap(java.util.EnumMap) Map(java.util.Map)

Example 3 with GraphicsConsoles

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

the class BackendTemplateGraphicsConsolesResource method list.

@Override
public GraphicsConsoles list() {
    GraphicsConsoles consoles = new GraphicsConsoles();
    VmTemplate entity = loadEntity();
    BackendGraphicsConsoleHelper.list(this, guid).entrySet().forEach(graphicsInfo -> consoles.getGraphicsConsoles().add(addLinks(populate(VmMapper.map(graphicsInfo, null), entity))));
    return consoles;
}
Also used : GraphicsConsoles(org.ovirt.engine.api.model.GraphicsConsoles) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 4 with GraphicsConsoles

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

the class BackendInstanceTypeGraphicsConsolesResource method list.

@Override
public GraphicsConsoles list() {
    GraphicsConsoles consoles = new GraphicsConsoles();
    InstanceType entity = loadEntity();
    BackendGraphicsConsoleHelper.list(this, guid).entrySet().forEach(graphicsInfo -> consoles.getGraphicsConsoles().add(addLinks(populate(VmMapper.map(graphicsInfo, null), entity))));
    return consoles;
}
Also used : GraphicsConsoles(org.ovirt.engine.api.model.GraphicsConsoles) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType)

Aggregations

GraphicsConsoles (org.ovirt.engine.api.model.GraphicsConsoles)4 EnumMap (java.util.EnumMap)1 Map (java.util.Map)1 V3GraphicsConsoles (org.ovirt.engine.api.v3.types.V3GraphicsConsoles)1 GraphicsInfo (org.ovirt.engine.core.common.businessentities.GraphicsInfo)1 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)1 InstanceType (org.ovirt.engine.core.common.businessentities.InstanceType)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)1