@Override protected void setClusterArch(ArchitectureType arch) { template.setClusterArch(arch); } }
protected void setClusterArch(ArchitectureType arch) { _vmTemplate.setClusterArch(arch); } }
@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.setClusterId(getGuid(rs, "cluster_id")); entity.setStatus(VmTemplateStatus.forValue(rs.getInt("status"))); entity.setClusterName(rs.getString("cluster_name")); entity.setClusterCompatibilityVersion(new VersionRowMapper("cluster_compatibility_version").mapRow(rs, rowNum)); 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 protected VmTemplate generateNewEntity() { VmTemplate newVmTemplate = new VmTemplate(); newVmTemplate.setId(Guid.newGuid()); newVmTemplate.setName("NewVmTemplate"); newVmTemplate.setClusterId(FixturesTool.CLUSTER); newVmTemplate.setClusterArch(ArchitectureType.x86_64); newVmTemplate.setCpuProfileId(FixturesTool.CPU_PROFILE_2); newVmTemplate.setSmallIconId(FixturesTool.SMALL_ICON_ID); newVmTemplate.setLargeIconId(FixturesTool.LARGE_ICON_ID); return newVmTemplate; }
@Mapping(from = Template.class, to = VmTemplate.class) public static VmTemplate map(Template model, VmTemplate incoming) { VmTemplate entity = incoming != null ? incoming : new VmTemplate(); mapVmBaseModelToEntity(entity, model); if (model.isSetInitialization()) { entity.setVmInit(InitializationMapper.map(model.getInitialization(), entity.getVmInit())); } if (model.isSetCpu() && model.getCpu().isSetArchitecture()) { entity.setClusterArch(CPUMapper.map(model.getCpu().getArchitecture(), null)); } if (model.isSetDomain() && model.getDomain().isSetName()) { if (entity.getVmInit() == null) { entity.setVmInit(new VmInit()); } entity.getVmInit().setDomain(model.getDomain().getName()); } if (model.getVersion() != null) { if (model.getVersion().getBaseTemplate() != null && StringUtils.isNotEmpty(model.getVersion().getBaseTemplate().getId())) { entity.setBaseTemplateId(Guid.createGuidFromString(model.getVersion().getBaseTemplate().getId())); } if (model.getVersion().isSetVersionName()) { entity.setTemplateVersionName(model.getVersion().getVersionName()); } // numbering is generated in the backend, hence even if user specified version number, we ignore it. } return entity; }
obj.setDiskList(instance.getDiskList()); obj.setRunAndPause(instance.isRunAndPause()); obj.setClusterArch(instance.getClusterArch()); obj.setTemplateVersionNumber(instance.getTemplateVersionNumber()); obj.setBaseTemplateId(instance.getBaseTemplateId());