@Override public VmTemplate mapRow(ResultSet rs, int rowNum) throws SQLException { final VmTemplate entity = new VmTemplate(); map(rs, entity); entity.setId(getGuidDefaultEmpty(rs, "vmt_guid")); entity.setChildCount(rs.getInt("child_count")); entity.setName(rs.getString("name")); entity.setVdsGroupId(getGuid(rs, "vds_group_id")); entity.setAllowConsoleReconnect(rs.getBoolean("allow_console_reconnect")); entity.setStatus(VmTemplateStatus.forValue(rs.getInt("status"))); entity.setVdsGroupName(rs.getString("vds_group_name")); entity.setStoragePoolId(getGuid(rs, "storage_pool_id")); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setQuotaName(rs.getString("quota_name")); entity.setQuotaEnforcementType( QuotaEnforcementTypeEnum.forValue(rs.getInt("quota_enforcement_type"))); entity.setDisabled(rs.getBoolean("is_disabled")); entity.setTrustedService(rs.getBoolean("trusted_service")); entity.setTemplateType(VmEntityType.valueOf(rs.getString("entity_type"))); entity.setClusterArch(ArchitectureType.forValue(rs.getInt("architecture"))); entity.setBaseTemplateId(getGuidDefaultEmpty(rs, "base_template_id")); entity.setTemplateVersionNumber(rs.getInt("template_version_number")); entity.setTemplateVersionName(rs.getString("template_version_name")); return entity; }
@Override public Cluster mapRow(ResultSet rs, int rowNum) throws SQLException { Cluster entity = new Cluster(); entity.setDescription(rs.getString("description")); entity.setName(rs.getString("name")); entity.setId(getGuidDefaultEmpty(rs, "cluster_id")); entity.setComment(rs.getString("free_text_comment")); entity.setCpuName(rs.getString("cpu_name")); entity.setStoragePoolId(getGuid(rs, "storage_pool_id")); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setMaxVdsMemoryOverCommit(rs.getInt("max_vds_memory_over_commit")); entity.setCountThreadsAsCores(rs.getBoolean("count_threads_as_cores")); entity.setTransparentHugepages(rs.getBoolean("transparent_hugepages")); entity.setCompatibilityVersion(new Version(rs.getString("compatibility_version"))); entity.setMigrateOnError(MigrateOnErrorOptions.forValue(rs.getInt("migrate_on_error"))); entity.setVirtService(rs.getBoolean("virt_service")); entity.setGlusterService(rs.getBoolean("gluster_service")); entity.setGlusterCliBasedSchedulingOn(rs.getBoolean("gluster_cli_based_snapshot_scheduled")); entity.setTunnelMigration(rs.getBoolean("tunnel_migration")); entity .getRequiredRngSources() .addAll(VmRngDevice.csvToSourcesSet(rs.getString("required_rng_sources"))); entity.setEmulatedMachine(rs.getString("emulated_machine")); entity.setDetectEmulatedMachine(rs.getBoolean("detect_emulated_machine")); entity.setTrustedService(rs.getBoolean("trusted_service")); entity.setHaReservation(rs.getBoolean("ha_reservation")); entity.setOptionalReasonRequired(rs.getBoolean("optional_reason")); entity.setMaintenanceReasonRequired(rs.getBoolean("maintenance_reason_required")); entity.setClusterPolicyId(Guid.createGuidFromString(rs.getString("cluster_policy_id"))); entity.setClusterPolicyName(rs.getString("cluster_policy_name")); entity.setClusterPolicyProperties( SerializationFactory.getDeserializer() .deserializeOrCreateNew( rs.getString("cluster_policy_custom_properties"), LinkedHashMap.class)); entity.setEnableBallooning(rs.getBoolean("enable_balloon")); entity.setEnableKsm(rs.getBoolean("enable_ksm")); entity.setArchitecture(ArchitectureType.forValue(rs.getInt("architecture"))); entity.setOptimizationType(OptimizationType.from(rs.getInt("optimization_type"))); entity.setSpiceProxy(rs.getString("spice_proxy")); entity.setSerialNumberPolicy( SerialNumberPolicy.forValue((Integer) rs.getObject("serial_number_policy"))); entity.setCustomSerialNumber(rs.getString("custom_serial_number")); entity .getFencingPolicy() .setSkipFencingIfSDActive(rs.getBoolean("skip_fencing_if_sd_active")); entity .getFencingPolicy() .setSkipFencingIfConnectivityBroken(rs.getBoolean("skip_fencing_if_connectivity_broken")); entity .getFencingPolicy() .setHostsWithBrokenConnectivityThreshold( rs.getInt("hosts_with_broken_connectivity_threshold")); entity.getFencingPolicy().setFencingEnabled(rs.getBoolean("fencing_enabled")); entity.setAutoConverge((Boolean) rs.getObject("is_auto_converge")); entity.setMigrateCompressed((Boolean) rs.getObject("is_migrate_compressed")); entity.setGlusterTunedProfile(rs.getString("gluster_tuned_profile")); entity.setKsmMergeAcrossNumaNodes(rs.getBoolean("ksm_merge_across_nodes")); entity.setMigrationBandwidthLimitType( MigrationBandwidthLimitType.valueOf(rs.getString("migration_bandwidth_limit_type"))); entity.setCustomMigrationNetworkBandwidth(getInteger(rs, "custom_migration_bandwidth_limit")); return entity; }