use of org.killbill.xmlloader.ValidationError in project killbill by killbill.
the class DefaultUsage method validate.
@Override
public ValidationErrors validate(final StandaloneCatalog catalog, final ValidationErrors errors) {
if (billingMode == BillingMode.IN_ADVANCE && usageType == UsageType.CAPACITY && limits.length == 0) {
errors.add(new ValidationError(String.format("Usage [IN_ADVANCE CAPACITY] section of phase %s needs to define some limits", phase.toString()), DefaultUsage.class, ""));
}
if (billingMode == BillingMode.IN_ADVANCE && usageType == UsageType.CONSUMABLE && blocks.length == 0) {
errors.add(new ValidationError(String.format("Usage [IN_ADVANCE CONSUMABLE] section of phase %s needs to define some blocks", phase.toString()), DefaultUsage.class, ""));
}
if (billingMode == BillingMode.IN_ARREAR && tiers.length == 0) {
errors.add(new ValidationError(String.format("Usage [IN_ARREAR] section of phase %s needs to define some tiers", phase.toString()), DefaultUsage.class, ""));
}
validateCollection(catalog, errors, limits);
validateCollection(catalog, errors, tiers);
return errors;
}
Aggregations