本文整理了Java中org.ovirt.engine.core.common.businessentities.Quota.getGlobalQuotaCluster
方法的一些代码示例,展示了Quota.getGlobalQuotaCluster
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota.getGlobalQuotaCluster
方法的具体详情如下:
包路径:org.ovirt.engine.core.common.businessentities.Quota
类名称:Quota
方法名:getGlobalQuotaCluster
暂无
代码示例来源:origin: oVirt/ovirt-engine
@Override
protected void updateEntityForRemove(Quota entity, Guid id) {
// since we're mocking remove using update, we'll throw 404 if the object isn't found
boolean throw404 = false;
// global cluster (has same id as quota)
if (entity.getId().equals(id)) {
if (entity.getGlobalQuotaCluster() == null) {
throw404 = true;
} else {
entity.setGlobalQuotaCluster(null);
}
// specific cluster (has same id as cluster)
} else {
if (entity.getQuotaClusters() != null) {
Iterator<QuotaCluster> iterator = entity.getQuotaClusters().iterator();
while (iterator.hasNext()) {
if (iterator.next().getClusterId().equals(id)) {
iterator.remove();
return;
}
}
throw404 = true;
}
}
if (throw404) {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
}
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Build parameter map, for quota limitation table, to indicate global limitation on {@code StoragePool}.
*
* @param quota
* - The global quota.
* @return - Global quota Parameter Map.
*/
private MapSqlParameterSource getFullQuotaParameterMap(Quota quota) {
return getCustomMapSqlParameterSource()
.addValue("id", quota.getId())
.addValue("quota_id", quota.getId())
.addValue("cluster_id", null)
.addValue("storage_id", null)
.addValue("storage_size_gb",
quota.getGlobalQuotaStorage() != null ? quota.getGlobalQuotaStorage()
.getStorageSizeGB() : null)
.addValue("virtual_cpu",
quota.getGlobalQuotaCluster() != null ? quota.getGlobalQuotaCluster().getVirtualCpu()
: null)
.addValue("mem_size_mb",
quota.getGlobalQuotaCluster() != null ? quota.getGlobalQuotaCluster().getMemSizeMB()
: null);
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public QuotaClusterLimits list() {
Quota quota = getQuota();
QuotaClusterLimits limits = new QuotaClusterLimits();
if (quota.getGlobalQuotaCluster() != null) {
addLimit(quotaId.toString(), limits, quota);
} else if (quota.getQuotaClusters() != null) {
for (QuotaCluster quotaCluster : quota.getQuotaClusters()) {
addLimit(quotaCluster.getClusterId().toString(), limits, quota);
}
}
return limits;
}
代码示例来源:origin: oVirt/ovirt-engine
final Quota quota = returnValue.getReturnValue();
qModel.setEntity(quota);
if (quota.getGlobalQuotaCluster() != null) {
QuotaCluster cluster =
((ArrayList<QuotaCluster>) qModel.getQuotaClusters().getItems()).get(0);
cluster.setMemSizeMB(quota.getGlobalQuotaCluster().getMemSizeMB());
cluster.setVirtualCpu(quota.getGlobalQuotaCluster().getVirtualCpu());
cluster.setMemSizeMBUsage(quota.getGlobalQuotaCluster().getMemSizeMBUsage());
cluster.setVirtualCpuUsage(quota.getGlobalQuotaCluster().getVirtualCpuUsage());
qModel.getGlobalClusterQuota().setEntity(true);
if (clusterList == null || clusterList.size() == 0) {
qModel.getAllDataCenterClusters().setItems(new ArrayList<QuotaCluster>());
if (quota.getGlobalQuotaCluster() == null) {
qModel.getSpecificClusterQuota().setEntity(true);
if (quota.getGlobalQuotaCluster() == null) {
qModel.getSpecificClusterQuota().setEntity(true);
代码示例来源:origin: oVirt/ovirt-engine
for (QuotaCluster iter : model.getQuotaClusters().getItems()) {
quota.setGlobalQuotaCluster(new QuotaCluster());
quota.getGlobalQuotaCluster().setMemSizeMB(iter.getMemSizeMB());
quota.getGlobalQuotaCluster().setVirtualCpu(iter.getVirtualCpu());
quota.getQuotaClusters().clear();
代码示例来源:origin: oVirt/ovirt-engine
@Mapping(from = org.ovirt.engine.core.common.businessentities.Quota.class, to = QuotaClusterLimit.class)
public static QuotaClusterLimit map(org.ovirt.engine.core.common.businessentities.Quota entity,
QuotaClusterLimit template) {
QuotaClusterLimit model = template != null ? template : new QuotaClusterLimit();
Guid guid = GuidUtils.asGuid(model.getId());
// global
if (guid.equals(entity.getId())) {
map(model, entity.getGlobalQuotaCluster(), null, entity.getStoragePoolId().toString(), entity.getId()
.toString());
} else { // specific
if (entity.getQuotaClusters() != null) {
for (QuotaCluster quotaCluster : entity.getQuotaClusters()) {
if (quotaCluster.getClusterId() != null && quotaCluster.getClusterId().equals(guid)) {
map(model, quotaCluster, quotaCluster.getClusterId().toString(), entity.getStoragePoolId()
.toString(), entity.getId().toString());
}
}
}
}
return model;
}
内容来源于网络,如有侵权,请联系作者删除!