public DbUser getDbUser() { DbUser user = new DbUser(); user.setId(Guid.createGuidFromStringDefaultEmpty(getId())); user.setDomain(getDomain()); user.setLoginName(getUserName()); return user; }
@Override public VdsStatic mapRow(ResultSet rs, int rowNum) throws SQLException { VdsStatic entity = new VdsStatic(); entity.setHostName(rs.getString("host_name")); entity.setComment(rs.getString("free_text_comment")); entity.setManagementIp(rs.getString("ip")); entity.setUniqueID(rs.getString("vds_unique_id")); entity.setPort(rs.getInt("port")); entity.setProtocol(VdsProtocol.fromValue(rs.getInt("protocol"))); entity.setVdsGroupId(getGuidDefaultEmpty(rs, "vds_group_id")); entity.setId(getGuidDefaultEmpty(rs, "vds_id")); entity.setSshPort(rs.getInt("ssh_port")); entity.setSshUsername(rs.getString("ssh_username")); entity.setVdsGroupId(Guid.createGuidFromStringDefaultEmpty(rs.getString("vds_group_id"))); entity.setId(Guid.createGuidFromStringDefaultEmpty(rs.getString("vds_id"))); entity.setVdsName(rs.getString("vds_name")); entity.setServerSslEnabled(rs.getBoolean("server_SSL_enabled")); entity.setVdsType(VDSType.forValue(rs.getInt("vds_type"))); entity.setVdsStrength(rs.getInt("vds_strength")); entity.setPmType(rs.getString("pm_type")); entity.setPmUser(rs.getString("pm_user")); entity.setPmPassword(DbFacadeUtils.decryptPassword(rs.getString("pm_password"))); entity.setPmPort((Integer) rs.getObject("pm_port")); entity.setPmOptions(rs.getString("pm_options")); entity.setPmEnabled(rs.getBoolean("pm_enabled")); entity.setPmProxyPreferences(rs.getString("pm_proxy_preferences")); entity.setPmSecondaryIp((rs.getString("pm_secondary_ip"))); entity.setPmSecondaryType(rs.getString("pm_secondary_type")); entity.setPmSecondaryUser(rs.getString("pm_secondary_user")); entity.setPmSecondaryPassword( DbFacadeUtils.decryptPassword(rs.getString("pm_secondary_password"))); entity.setPmSecondaryPort((Integer) rs.getObject("pm_secondary_port")); entity.setPmSecondaryOptions(rs.getString("pm_secondary_options")); entity.setPmSecondaryConcurrent(rs.getBoolean("pm_secondary_concurrent")); entity.setPmKdumpDetection(rs.getBoolean("pm_detect_kdump")); entity.setOtpValidity(rs.getLong("otp_validity")); entity.setSshKeyFingerprint(rs.getString("sshKeyFingerprint")); entity.setConsoleAddress(rs.getString("console_address")); entity.setDisablePowerManagementPolicy(rs.getBoolean("disable_auto_pm")); return entity; }
@Override public Response remove(String id, Action action) { getEntity(id); // verifies that entity exists, returns 404 otherwise. if (action.isSetDetach() && action.isDetach()) { return performAction( VdcActionType.DetachDiskFromVm, new AttachDetachVmDiskParameters(parentId, Guid.createGuidFromStringDefaultEmpty(id))); } else { return remove(id); } }
private Response attachDiskToVm(Disk disk) { boolean isDiskActive = BooleanUtils.toBooleanDefaultIfNull(disk.isActive(), false); boolean isDiskReadOnly = BooleanUtils.toBooleanDefaultIfNull(disk.isReadOnly(), false); AttachDetachVmDiskParameters params = new AttachDetachVmDiskParameters( parentId, Guid.createGuidFromStringDefaultEmpty(disk.getId()), isDiskActive, isDiskReadOnly); if (disk.isSetSnapshot()) { validateParameters(disk, "snapshot.id"); params.setSnapshotId(asGuid(disk.getSnapshot().getId())); } return performAction(VdcActionType.AttachDiskToVm, params); }