congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
com.ning.billing.util.config.catalog
Code IndexAdd Tabnine to your IDE (free)

How to use com.ning.billing.util.config.catalog

Best Java code snippets using com.ning.billing.util.config.catalog (Showing top 20 results out of 315)

origin: com.ning.billing/killbill-catalog

private Collection<? extends ValidationError> validate(final StandaloneCatalog catalog,
                            final ValidationErrors errors, final ValidatingConfig<StandaloneCatalog>[] configs) {
  for (final ValidatingConfig<StandaloneCatalog> config : configs) {
    config.validate(catalog, errors);
  }
  return errors;
}
origin: com.ning.billing/killbill-util

public void add(final String description, final URI catalogURI,
        final Class<?> objectType, final String objectName) {
  add(new ValidationError(description, catalogURI, objectType, objectName));
}
origin: com.ning.billing/killbill-util

public void log(final Logger log) {
  for (final ValidationError error : this) {
    error.log(log);
  }
}
origin: com.ning.billing/killbill-util

public static <T extends ValidatingConfig<T>> void validate(final URI uri, final T c) throws ValidationException {
  c.initialize(c, uri);
  final ValidationErrors errs = c.validate(c, new ValidationErrors());
  log.info("Errors: " + errs.size() + " for " + uri);
  if (errs.size() > 0) {
    throw new ValidationException(errs);
  }
}
origin: com.ning.billing/killbill-util

public static <T extends ValidatingConfig<T>> T getObjectFromStream(final URI uri, final InputStream stream, final Class<T> clazz) throws SAXException, InvalidConfigException, JAXBException, IOException, TransformerException, ValidationException {
  if (stream == null) {
    return null;
  }
  final Object o = unmarshaller(clazz).unmarshal(stream);
  if (clazz.isInstance(o)) {
    @SuppressWarnings("unchecked") final
    T castObject = (T) o;
    try {
      validate(uri, castObject);
    } catch (ValidationException e) {
      e.getErrors().log(log);
      System.err.println(e.getErrors().toString());
      throw e;
    }
    return castObject;
  } else {
    return null;
  }
}
origin: com.ning.billing/killbill-util

public static <T extends ValidatingConfig<T>> T getObjectFromUri(final URI uri, final Class<T> objectType) throws Exception {
  if (uri == null) {
    return null;
  }
  log.info("Initializing an object of class " + objectType.getName() + " from xml file at: " + uri);
  return getObjectFromStream(uri, UriAccessor.accessUri(uri), objectType);
}
origin: com.ning.billing/killbill-catalog

@Override
public void initialize(final StandaloneCatalog root, final URI uri) {
  if (prices == null) {
    prices = getZeroPrice(root);
  }
  super.initialize(root, uri);
}
origin: com.ning.billing/killbill-util

public static String accessUriAsString(String uri)  throws IOException, URISyntaxException {
  return accessUriAsString(new URI(uri));
}
origin: com.ning.billing/killbill-util

public static InputStream accessUri(String uri)  throws IOException, URISyntaxException {
  return accessUri(new URI(uri));
}
origin: com.ning.billing/killbill-util

public String toString() {
  final StringBuilder builder = new StringBuilder();
  for (final ValidationError error : this) {
    builder.append(error.toString());
  }
  return builder.toString();
}
origin: com.ning.billing/killbill-util

@Override
public void printStackTrace(final PrintStream arg0) {
  arg0.print(errors.toString());
  super.printStackTrace(arg0);
}
origin: com.ning.billing/killbill-catalog

@Override
public ValidationErrors validate(final StandaloneCatalog catalog, final ValidationErrors errors) {
  for (final StandaloneCatalog c : versions) {
    errors.addAll(c.validate(c, errors));
  }
  //TODO MDW validation - ensure all catalog versions have a single name
  //TODO MDW validation - ensure effective dates are different (actually do we want this?)
  //TODO MDW validation - check that all products are there
  //TODO MDW validation - check that all plans are there
  //TODO MDW validation - check that all currencies are there
  //TODO MDW validation - check that all pricelists are there
  return errors;
}
origin: com.ning.billing/killbill-catalog

@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;
}
origin: com.ning.billing/killbill-util

public static <T extends ValidatingConfig<T>> T getObjectFromString(final String uri, final Class<T> objectType) throws Exception {
  if (uri == null) {
    return null;
  }
  log.info("Initializing an object of class " + objectType.getName() + " from xml file at: " + uri);
  return getObjectFromStream(new URI(uri), UriAccessor.accessUri(uri), objectType);
}
origin: com.ning.billing/killbill-catalog

@Override
public void initialize(final StandaloneCatalog catalog, final URI sourceURI) {
  super.initialize(catalog, sourceURI);
  if (finalPhase != null) {
    finalPhase.setPlan(this);
    finalPhase.initialize(catalog, sourceURI);
  }
  if (initialPhases != null) {
    for (final DefaultPlanPhase p : initialPhases) {
      p.setPlan(this);
      p.initialize(catalog, sourceURI);
    }
  }
}
origin: com.ning.billing/killbill-util

  public static String accessUriAsString(URI uri) throws IOException,  URISyntaxException {
    InputStream stream = accessUri(uri);
    return new Scanner(stream).useDelimiter("\\A").next();
  }
}
origin: com.ning.billing/killbill-overdue

@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;
}
origin: com.ning.billing/killbill-catalog

@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;
}
origin: com.ning.billing/killbill-catalog

@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;
}
origin: com.ning.billing/killbill-catalog

@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;
}
com.ning.billing.util.config.catalog

Most used classes

  • XMLLoader
  • XMLSchemaGenerator
  • ValidationErrors
  • ValidationError
  • UriAccessor
  • XMLWriter,
  • ValidationException
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now