@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;
    }
Exemple #2
0
 private VmTemplate createVmTemplate() {
   if (vmTemplate == null) {
     vmTemplate = new VmTemplate();
     vmTemplate.setStoragePoolId(STORAGE_POOL_ID);
     DiskImage image = createDiskImageTemplate();
     vmTemplate.getDiskTemplateMap().put(image.getImageId(), image);
     HashMap<Guid, DiskImage> diskImageMap = new HashMap<>();
     DiskImage diskImage = createDiskImage(REQUIRED_DISK_SIZE_GB);
     diskImageMap.put(diskImage.getId(), diskImage);
     vmTemplate.setDiskImageMap(diskImageMap);
   }
   return vmTemplate;
 }