org.ovirt.engine.api.model.Quota类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.ovirt.engine.api.model.Quota类的一些代码示例,展示了Quota类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota类的具体详情如下:
包路径:org.ovirt.engine.api.model.Quota
类名称:Quota

Quota介绍

[英]Java class for Quota complex type.

The following schema fragment specifies the expected content contained within this class.

<complexType name="Quota"> 
<complexContent> 
<extension base="{}BaseResource"> 
<sequence> 
<element name="cluster_hard_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="cluster_soft_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="data_center" type="{}DataCenter" minOccurs="0"/> 
<element name="disks" type="{}Disks" minOccurs="0"/> 
<element name="storage_hard_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="storage_soft_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="users" type="{}Users" minOccurs="0"/> 
<element name="vms" type="{}Vms" minOccurs="0"/> 
<element name="permissions" type="{}Permissions" minOccurs="0"/> 
<element name="quota_cluster_limits" type="{}QuotaClusterLimits" minOccurs="0"/> 
<element name="quota_storage_limits" type="{}QuotaStorageLimits" minOccurs="0"/> 
</sequence> 
</extension> 
</complexContent> 
</complexType>

[中]配额复杂类型的Java类。
以下架构片段指定了该类中包含的预期内容。

<complexType name="Quota"> 
<complexContent> 
<extension base="{}BaseResource"> 
<sequence> 
<element name="cluster_hard_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="cluster_soft_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="data_center" type="{}DataCenter" minOccurs="0"/> 
<element name="disks" type="{}Disks" minOccurs="0"/> 
<element name="storage_hard_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="storage_soft_limit_pct" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> 
<element name="users" type="{}Users" minOccurs="0"/> 
<element name="vms" type="{}Vms" minOccurs="0"/> 
<element name="permissions" type="{}Permissions" minOccurs="0"/> 
<element name="quota_cluster_limits" type="{}QuotaClusterLimits" minOccurs="0"/> 
<element name="quota_storage_limits" type="{}QuotaStorageLimits" minOccurs="0"/> 
</sequence> 
</extension> 
</complexContent> 
</complexType>

代码示例

代码示例来源:origin: oVirt/ovirt-engine

private Quota getQuota() {
  Quota quota = new Quota();
  quota.setName("Quota_Name");
  quota.setClusterHardLimitPct(CLUSTER_HARD_LIMIT_PCT);
  quota.setClusterSoftLimitPct(CLUSTER_SOFT_LIMIT_PCT);
  quota.setStorageHardLimitPct(STORAGE_HARD_LIMIT_PCT);
  quota.setStorageSoftLimitPct(STORAGE_SOFT_LIMIT_PCT);
  return quota;
}

代码示例来源:origin: oVirt/ovirt-engine

@Mapping(from = Quota.class, to = org.ovirt.engine.core.common.businessentities.Quota.class)
public static org.ovirt.engine.core.common.businessentities.Quota map(Quota model, org.ovirt.engine.core.common.businessentities.Quota template) {
  org.ovirt.engine.core.common.businessentities.Quota entity = (template==null) ? new org.ovirt.engine.core.common.businessentities.Quota() : template;
  if (model.isSetId()) {
    entity.setId(GuidUtils.asGuid(model.getId()));
  }
  if (model.isSetName()) {
    entity.setQuotaName(model.getName());
  }
  if (model.isSetDescription()) {
    entity.setDescription(model.getDescription());
  }
  if (model.isSetDataCenter()) {
    entity.setStoragePoolId(GuidUtils.asGuid(model.getDataCenter().getId()));
  }
  if (model.isSetClusterHardLimitPct()) {
    entity.setGraceClusterPercentage(model.getClusterHardLimitPct());
  }
  if (model.isSetStorageHardLimitPct()) {
    entity.setGraceStoragePercentage(model.getStorageHardLimitPct());
  }
  if (model.isSetClusterSoftLimitPct()) {
    entity.setThresholdClusterPercentage(model.getClusterSoftLimitPct());
  }
  if (model.isSetStorageSoftLimitPct()) {
    entity.setThresholdStoragePercentage(model.getStorageSoftLimitPct());
  }
  return entity;
}

代码示例来源:origin: oVirt/ovirt-engine

private Quota getModel() {
  Quota quota = new Quota();
  quota.setId(GUIDS[0].toString());
  quota.setDescription(DESCRIPTIONS[0]);
  quota.setClusterHardLimitPct(30);
  return quota;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public V3Quota adapt(Quota from) {
  V3Quota to = new V3Quota();
  if (from.isSetLinks()) {
    to.getLinks().addAll(adaptOut(from.getLinks()));
  if (from.isSetActions()) {
    to.setActions(adaptOut(from.getActions()));
  if (from.isSetClusterHardLimitPct()) {
    to.setClusterHardLimitPct(from.getClusterHardLimitPct());
  if (from.isSetClusterSoftLimitPct()) {
    to.setClusterSoftLimitPct(from.getClusterSoftLimitPct());
  if (from.isSetComment()) {
    to.setComment(from.getComment());
  if (from.isSetDataCenter()) {
    to.setDataCenter(adaptOut(from.getDataCenter()));
  if (from.isSetDescription()) {
    to.setDescription(from.getDescription());
  if (from.isSetDisks()) {
    to.setDisks(new V3Disks());
    to.getDisks().getDisks().addAll(adaptOut(from.getDisks().getDisks()));
  if (from.isSetId()) {
    to.setId(from.getId());

代码示例来源:origin: oVirt/ovirt-engine

@Override
public Quota adapt(V3Quota from) {
  Quota to = new Quota();
  if (from.isSetLinks()) {
    to.getLinks().addAll(adaptIn(from.getLinks()));
    to.setActions(adaptIn(from.getActions()));
    to.setClusterHardLimitPct(from.getClusterHardLimitPct());
    to.setClusterSoftLimitPct(from.getClusterSoftLimitPct());
    to.setComment(from.getComment());
    to.setDataCenter(adaptIn(from.getDataCenter()));
    to.setDescription(from.getDescription());
    to.setDisks(new Disks());
    to.getDisks().getDisks().addAll(adaptIn(from.getDisks().getDisks()));
    to.setId(from.getId());
    to.setHref(from.getHref());
    to.setName(from.getName());
    to.setStorageHardLimitPct(from.getStorageHardLimitPct());
    to.setStorageSoftLimitPct(from.getStorageSoftLimitPct());

代码示例来源:origin: oVirt/ovirt-engine

@Mapping(from = org.ovirt.engine.core.common.businessentities.Quota.class, to = Quota.class)
public static Quota map(org.ovirt.engine.core.common.businessentities.Quota template, Quota model) {
  Quota ret = (model==null) ? new Quota() : model;
  if (template.getId()!=null) {
    ret.setId(template.getId().toString());
  }
  if (template.getQuotaName()!=null) {
    ret.setName(template.getQuotaName());
  }
  if (template.getDescription()!=null) {
    ret.setDescription(template.getDescription());
  }
  if (template.getStoragePoolId()!=null) {
    if (ret.getDataCenter()==null) {
      ret.setDataCenter(new DataCenter());
    }
    ret.getDataCenter().setId(template.getStoragePoolId().toString());
  }
  ret.setClusterHardLimitPct(template.getGraceClusterPercentage());
  ret.setStorageHardLimitPct(template.getGraceStoragePercentage());
  ret.setClusterSoftLimitPct(template.getThresholdClusterPercentage());
  ret.setStorageSoftLimitPct(template.getThresholdStoragePercentage());
  return ret;
}

代码示例来源:origin: oVirt/ovirt-engine

private static void map(QuotaStorageLimit model,
    QuotaStorage quotaStorage,
    String storageDomainId,
    String dataCenterId,
    String quotaId) {
  model.setQuota(new Quota());
  model.getQuota().setId(quotaId);
  model.getQuota().setDataCenter(new DataCenter());
  model.getQuota().getDataCenter().setId(dataCenterId);
  if (storageDomainId != null) {
    model.setStorageDomain(new StorageDomain());
    model.getStorageDomain().setId(storageDomainId);
  }
  if (quotaStorage.getStorageSizeGB() != null) {
    model.setLimit(quotaStorage.getStorageSizeGB());
  }
  if (quotaStorage.getStorageSizeGBUsage() != null) {
    model.setUsage(quotaStorage.getStorageSizeGBUsage());
  }
}

代码示例来源:origin: oVirt/ovirt-engine

Quota quota = new Quota();
quota.setId(entity.getQuotaId().toString());
model.setQuota(quota);

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Create an instance of {@link Quota }
 * 
 */
public Quota createQuota() {
  return new Quota();
}

代码示例来源:origin: oVirt/ovirt-engine

public static void validateAdd(Quota quota) {
  if (quota == null) {
    throw new ValidationException("Parameter 'quota' is mandatory but was not provided.");
  }
  if (quota.getName()==null) {
    throw new ValidationException("Parameter 'quota.name' is mandatory but was not provided.");
  }
  
}

代码示例来源:origin: oVirt/ovirt-engine

private static void map(QuotaClusterLimit template,
    QuotaCluster quotaCluster,
    String clusterId,
    String dataCenterId,
    String quotaId) {
  template.setQuota(new Quota());
  template.getQuota().setId(quotaId);
  template.getQuota().setDataCenter(new DataCenter());
  template.getQuota().getDataCenter().setId(dataCenterId);
  if (clusterId != null) {
    template.setCluster(new Cluster());
    template.getCluster().setId(clusterId);
  }
  if (quotaCluster.getMemSizeMB() != null) {
    // show GB instead of MB (ignore -1)
    double value = quotaCluster.getMemSizeMB() == -1 ? quotaCluster.getMemSizeMB().doubleValue()
        : quotaCluster.getMemSizeMB().doubleValue() / 1024.0;
    template.setMemoryLimit(value);
  }
  if (quotaCluster.getMemSizeMBUsage() != null) {
    template.setMemoryUsage(quotaCluster.getMemSizeMBUsage() / 1024.0);
  }
  if (quotaCluster.getVirtualCpu() != null) {
    template.setVcpuLimit(quotaCluster.getVirtualCpu());
  }
  if (quotaCluster.getVirtualCpuUsage() != null) {
    template.setVcpuUsage(quotaCluster.getVirtualCpuUsage());
  }
}

代码示例来源:origin: oVirt/ovirt-engine

Quota quota = new Quota();
quota.setId(entity.getQuotaId().toString());
  quota.setDataCenter(new DataCenter());
  quota.getDataCenter().setId(entity.getStoragePoolId().toString());

相关文章