private static void setGraphicsToEntity(ResultSet rs, VmDynamic entity) throws SQLException { GraphicsInfo graphicsInfo = new GraphicsInfo(); graphicsInfo.setIp(rs.getString("spice_ip")); graphicsInfo.setPort((Integer) rs.getObject("spice_port")); graphicsInfo.setTlsPort((Integer) rs.getObject("spice_tls_port")); if (graphicsInfo.getPort() != null || graphicsInfo.getTlsPort() != null) { entity.getGraphicsInfos().put(GraphicsType.SPICE, graphicsInfo); } graphicsInfo = new GraphicsInfo(); graphicsInfo.setIp(rs.getString("vnc_ip")); graphicsInfo.setPort((Integer) rs.getObject("vnc_port")); if (graphicsInfo.getPort() != null) { entity.getGraphicsInfos().put(GraphicsType.VNC, graphicsInfo); } }
@Mapping(from = Map.Entry.class, to = GraphicsConsole.class) public static GraphicsConsole map(Map.Entry<org.ovirt.engine.core.common.businessentities.GraphicsType, GraphicsInfo> graphicsInfo, GraphicsConsole template) { GraphicsConsole model = template != null ? template : new GraphicsConsole(); GraphicsType graphicsType = map(graphicsInfo.getKey(), null); if (graphicsType != null) { model.setId(HexUtils.string2hex(graphicsType.value())); model.setProtocol(graphicsType); } if (graphicsInfo.getValue() != null) { model.setPort(graphicsInfo.getValue().getPort()); model.setTlsPort(graphicsInfo.getValue().getTlsPort()); model.setAddress(graphicsInfo.getValue().getIp()); } return model; }
Integer displayPort = graphicsInfo == null ? null : graphicsInfo.getPort(); model.getDisplay().setPort(displayPort == null || displayPort.equals(-1) ? null : displayPort); Integer displaySecurePort = graphicsInfo == null ? null : graphicsInfo.getTlsPort(); model.getDisplay().setSecurePort(displaySecurePort==null || displaySecurePort.equals(-1) ? null : displaySecurePort);
.addValue("emulated_machine", vm.getEmulatedMachine()) .addValue("spice_port", spice != null ? spice.getPort() : null) .addValue("spice_tls_port", spice != null ? spice.getTlsPort() : null) .addValue("spice_ip", spice != null ? spice.getIp() : null) .addValue("vnc_port", vnc != null ? vnc.getPort() : null)