public void add(final String description, final URI catalogURI, final Class<?> objectType, final String objectName) { add(new ValidationError(description, catalogURI, objectType, objectName)); }
@Override public ValidationErrors validate(final OverdueConfig root, final ValidationErrors errors) { if (name.length() > MAX_NAME_LENGTH) { errors.add(new ValidationError(String.format("Name of state '%s' exceeds the maximum length of %d", name, MAX_NAME_LENGTH), root.getURI(), DefaultOverdueState.class, name)); } return errors; }
@Override public ValidationErrors validate(StandaloneCatalog root, ValidationErrors errors) { if(max == null && min == null) { errors.add(new ValidationError("max and min cannot both be ommitted",root.getCatalogURI(), Limit.class, "")); } else if (max != null && min != null && max.doubleValue() < min.doubleValue()) { errors.add(new ValidationError("max must be greater than min",root.getCatalogURI(), Limit.class, "")); } return errors; }
@Override public ValidationErrors validate(final StandaloneCatalog catalog, final ValidationErrors errors) { //Validation: TimeUnit UNLIMITED iff number == -1 if ((unit == TimeUnit.UNLIMITED && number != -1)) { errors.add(new ValidationError("Duration can only have 'UNLIMITED' unit if the number is omitted.", catalog.getCatalogURI(), DefaultPlanPhase.class, "")); } //TODO MDW - Validation TimeUnit UNLIMITED iff number == -1 return errors; }
@Override public ValidationErrors validate(final StandaloneCatalog catalog, final ValidationErrors errors) { if (effectiveDateForExistingSubscriptons != null && catalog.getEffectiveDate().getTime() > effectiveDateForExistingSubscriptons.getTime()) { errors.add(new ValidationError(String.format("Price effective date %s is before catalog effective date '%s'", effectiveDateForExistingSubscriptons, catalog.getEffectiveDate().getTime()), catalog.getCatalogURI(), DefaultInternationalPrice.class, "")); } return errors; }
@Override public ValidationErrors validate(final StandaloneCatalog catalog, final ValidationErrors errors) { super.validate(catalog, errors); if (!getName().equals(PriceListSet.DEFAULT_PRICELIST_NAME)) { errors.add(new ValidationError("The name of the default pricelist must be 'DEFAULT'", catalog.getCatalogURI(), DefaultPriceList.class, getName())); } return errors; }
@Override public ValidationErrors validate(final StandaloneCatalog catalog, final ValidationErrors errors) { defaultPricelist.validate(catalog, errors); //Check that the default pricelist name is not in use in the children for (final DefaultPriceList pl : childPriceLists) { if (pl.getName().equals(PriceListSet.DEFAULT_PRICELIST_NAME)) { errors.add(new ValidationError("Pricelists cannot use the reserved name '" + PriceListSet.DEFAULT_PRICELIST_NAME + "'", catalog.getCatalogURI(), DefaultPriceListSet.class, pl.getName())); } pl.validate(catalog, errors); // and validate the individual pricelists } return errors; }
errors.add(new ValidationError(String.format("Phase %s of plan %s has a recurring price but no billing period", type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); errors.add(new ValidationError(String.format("Phase %s of plan %s has a recurring price but no billing period", type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); errors.add(new ValidationError(String.format("Phase %s of plan %s has no recurring price but does have a billing period. The billing period should be set to '%s'", type.toString(), plan.getName(), BillingPeriod.NO_BILLING_PERIOD), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); errors.add(new ValidationError(String.format("Phase %s of plan %s has no billing period. It must have a fixed price set.", type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); errors.add(new ValidationError(String.format("Phase %s of plan %s has neither a recurring price or a fixed price.", type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString()));
@Override public ValidationErrors validate(final StandaloneCatalog catalog, final ValidationErrors errors) { for (final DefaultPlan cur : getPlans()) { final int numPlans = findNumberOfPlans(cur.getProduct(), cur.getBillingPeriod()); if (numPlans > 1) { errors.add(new ValidationError( String.format("There are %d plans in pricelist %s and have the same product/billingPeriod (%s, %s)", numPlans, getName(), cur.getProduct().getName(), cur.getBillingPeriod()), catalog.getCatalogURI(), DefaultPriceListSet.class, getName())); } } return errors; }