private Quota getQuotaMetaDataFromResultSet(ResultSet rs) throws SQLException { Quota entity = new Quota(); entity.setId(getGuidDefaultEmpty(rs, "quota_id")); entity.setStoragePoolId(getGuidDefaultEmpty(rs, "storage_pool_id")); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setQuotaName((String) rs.getObject("quota_name")); entity.setDescription((String) rs.getObject("description")); entity.setThresholdClusterPercentage((Integer) rs.getObject("threshold_cluster_percentage")); entity.setThresholdStoragePercentage((Integer) rs.getObject("threshold_storage_percentage")); entity.setGraceClusterPercentage((Integer) rs.getObject("grace_cluster_percentage")); entity.setGraceStoragePercentage((Integer) rs.getObject("grace_storage_percentage")); entity.setQuotaEnforcementType(QuotaEnforcementTypeEnum.forValue(rs.getInt("quota_enforcement_type"))); entity.setDefault(rs.getBoolean("is_default")); return entity; }
private static Quota createGeneralQuota() { Quota quota = new Quota(); Guid quotaId = Guid.newGuid(); quota.setId(quotaId); quota.setStoragePoolId(FixturesTool.STORAGE_POOL_NFS); quota.setQuotaName("Watson"); quota.setDescription("General quota"); quota.setThresholdClusterPercentage(80); quota.setThresholdStoragePercentage(80); quota.setGraceClusterPercentage(20); quota.setGraceStoragePercentage(20); return quota; } }
quota.setGraceStoragePercentage(model.getGraceStorageAsInteger()); quota.setThresholdClusterPercentage(model.getThresholdClusterAsInteger()); quota.setThresholdStoragePercentage(model.getThresholdStorageAsInteger());
@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; }