org.ovirt.engine.core.common.businessentities.Quota.getQuotaName()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(119)

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

Quota.getQuotaName介绍

暂无

代码示例

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

@Override
public String getName() {
  return getQuotaName();
}

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

public Quota getQuotaByName(String name, List<Quota> quotas) {
  for (Quota quota : quotas) {
    if (quota.getQuotaName().equals(name)) {
      return quota;
    }
  }
  return null;
}

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

public List<String> getQuotaNames(List<Quota> quotas) {
  List<String> names = new ArrayList<>();
  if (quotas != null) {
    for (Quota quota : quotas) {
      names.add(quota.getQuotaName());
    }
  }
  return names;
}

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

public void selectQuotaByName(String name, ListModel<Quota> listModel) {
  for (Quota quota : listModel.getItems()) {
    if (quota.getQuotaName().equals(name)) {
      listModel.setSelectedItem(quota);
      break;
    }
  }
}

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

public void setSelectedQuotaString(String value) {
    if (getQuotaList() != null) {
      for (Quota quota : getQuotaList()) {
        if (quota.getQuotaName().equals(value)) {
          setSelectedQuota(quota);
          break;
        }
      }
    }
  }
}

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

@Override
public void search() {
  if (getEntity() != null) {
    setSearchString("Events: quota=" + getEntity().getQuotaName()); //$NON-NLS-1$
    super.search();
  }
}

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

/**
 * Test get Quota by Name, with name of specific Quota.
 */
@Test
public void testGetQuotaByAdElementId() {
  List<Quota> quotaByAdElementIdList =
      dao.getQuotaByAdElementId(FixturesTool.USER_EXISTING_ID, FixturesTool.STORAGE_POOL_NFS, false);
  // Check if quota general has been fetched.
  assertEquals("Quota General", quotaByAdElementIdList.get(0).getQuotaName());
}

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

public void remove() {
  if (getWindow() != null) {
    return;
  }
  ConfirmationModel model = new ConfirmationModel();
  setWindow(model);
  model.setTitle(ConstantsManager.getInstance().getConstants().removeQuotasTitle());
  model.setHelpTag(HelpTag.remove_quota);
  model.setHashName("remove_quota"); //$NON-NLS-1$
  ArrayList<String> list = new ArrayList<>();
  for (Quota a : getSelectedItems()) {
    list.add(a.getQuotaName());
  }
  model.setItems(list);
  UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); //$NON-NLS-1$
  model.getCommands().add(tempVar);
  UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); //$NON-NLS-1$
  model.getCommands().add(tempVar2);
}

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

/**
 * Test get Quota by Name, with name of specific Quota.
 */
@Test
public void testGetQuotaByExistingName() {
  Quota quotaGeneralToSpecific = dao.getQuotaByQuotaName("Quota General", FixturesTool.STORAGE_POOL_NFS);
  assertEquals(dao.getById(FixturesTool.QUOTA_GENERAL)
      .getQuotaName(), quotaGeneralToSpecific.getQuotaName());
  assertEquals(dao.getById(FixturesTool.QUOTA_GENERAL).getId(), quotaGeneralToSpecific.getId());
}

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

@Test
public void testGetEntityNameByIdAndTypeForQuota() {
  Quota quota = quotaDao.getById(QUOTA_ID);
  assertNotNull(quota);
  String name = quota.getQuotaName();
  assertEquals(name, dao.getEntityNameByIdAndType(QUOTA_ID, VdcObjectType.Quota));
}

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

private MapSqlParameterSource createQuotaMetaDataParameterMapper(Quota quota) {
  return createQuotaIdParameterMapper(quota.getId()).addValue("storage_pool_id", quota.getStoragePoolId())
      .addValue("quota_name", quota.getQuotaName())
      .addValue("description", quota.getDescription())
      .addValue("threshold_cluster_percentage", quota.getThresholdClusterPercentage())
      .addValue("threshold_storage_percentage", quota.getThresholdStoragePercentage())
      .addValue("grace_cluster_percentage", quota.getGraceClusterPercentage())
      .addValue("grace_storage_percentage", quota.getGraceStoragePercentage())
      .addValue("is_default", quota.isDefault());
}

代码示例来源: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

/**
 * Make Quota specific to be the same as Quota general and specific.
 */
@Test
public void testUpdateQuota() {
  Quota quotaGeneralToSpecific = dao.getById(FixturesTool.QUOTA_GENERAL);
  // Save quotaName and cluster list for future check.
  String quotaName = "New Temporary name";
  List<QuotaCluster> quotaClusterList =
      getQuotaCluster(getSpecificQuotaCluster(quotaGeneralToSpecific.getId()));
  Long newStorageLimit = 2345L;
  // Check before the update, that the fields are not equal.
  assertNotEquals(quotaName, quotaGeneralToSpecific.getQuotaName());
  assertNotEquals(quotaClusterList.size(), quotaGeneralToSpecific.getQuotaClusters().size());
  assertNotEquals(newStorageLimit, quotaGeneralToSpecific.getGlobalQuotaStorage().getStorageSizeGB());
  // Update
  quotaGeneralToSpecific.setQuotaName(quotaName);
  quotaGeneralToSpecific.getGlobalQuotaStorage().setStorageSizeGB(newStorageLimit);
  quotaGeneralToSpecific.setQuotaClusters(quotaClusterList);
  dao.update(quotaGeneralToSpecific);
  quotaGeneralToSpecific = dao.getById(FixturesTool.QUOTA_GENERAL);
  // Check after the update, that the fields are equal now.
  assertEquals(quotaName, quotaGeneralToSpecific.getQuotaName());
  assertEquals(quotaClusterList.size(), quotaGeneralToSpecific.getQuotaClusters().size());
  assertEquals(newStorageLimit, quotaGeneralToSpecific.getGlobalQuotaStorage().getStorageSizeGB());
}

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

private void editQuota(boolean isClone) {
  Quota outer_quota = getSelectedItem();
  final QuotaModel qModel = new QuotaModel();
  qModel.getName().setEntity(outer_quota.getQuotaName());
  } else {
    command = UICommand.createDefaultOkUiCommand("onCloneQuota", this); //$NON-NLS-1$
    qModel.getName().setEntity(COPY_OF + outer_quota.getQuotaName());
    qModel.getDescription().setEntity(""); //$NON-NLS-1$
    qModel.getCopyPermissions().setIsAvailable(true);

相关文章