/** * Set data about graphics from (REST) Template to parameters. * * @param display - display that contains graphics data * @param params - parameters to be updated with graphics data */ public static void setGraphicsToParams(Display display, HasGraphicsDevices params) { if (display != null && display.isSetType()) { DisplayType newDisplayType = display.getType(); if (newDisplayType != null) { for (GraphicsType graphicsType : GraphicsType.values()) { params.getGraphicsDevices().put(graphicsType, null); // reset graphics devices } GraphicsType newGraphicsType = DisplayMapper.map(newDisplayType, null); params.getGraphicsDevices().put(newGraphicsType, new GraphicsDevice(newGraphicsType.getCorrespondingDeviceType())); } } }
@Mapping(from = org.ovirt.engine.core.common.businessentities.InstanceType.class, to = InstanceType.class) public static InstanceType map(org.ovirt.engine.core.common.businessentities.InstanceType entity, InstanceType incoming) { InstanceType model = incoming != null ? incoming : new InstanceType(); mapCommonEntityToModel(model, (VmTemplate) entity); model.setDisplay(DisplayMapper.map(entity, null)); if (entity.getDefaultBootSequence() != null) { OperatingSystem os = model.getOs(); if (os == null) { os = new OperatingSystem(); } if (entity.getDefaultBootSequence() != null) { Boot boot = VmMapper.map(entity.getDefaultBootSequence(), null); os.setBoot(boot); } model.setOs(os); } return model; }
model.getCpu().setArchitecture(CPUMapper.map(entity.getClusterArch(), null)); model.setDisplay(DisplayMapper.map(entity, null)); model.getDisplay().setDisconnectAction(map(entity.getConsoleDisconnectAction(), null).toString());
org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = deriveGraphicsType(entity.getGraphicsInfos()); if (graphicsType != null) { model.getDisplay().setType(DisplayMapper.map(graphicsType, null));