Package buri.ddmsence.ddms

Examples of buri.ddmsence.ddms.InvalidDDMSException


  protected void validate() throws InvalidDDMSException {
    requireAtMostVersion("4.1");
    Util.requireDDMSQName(getXOMElement(), Security.getName(getDDMSVersion()));
    if (getDDMSVersion().isAtLeast("3.0")) {
      if (getExcludeFromRollup() == null ||!FIXED_ROLLUP.equals(String.valueOf(getExcludeFromRollup())))
        throw new InvalidDDMSException("The excludeFromRollup attribute must have a fixed value of \""
          + FIXED_ROLLUP + "\".");
    }
    else if (getExcludeFromRollup() != null)
      throw new InvalidDDMSException("The excludeFromRollup attribute must not be used until DDMS 3.0 or later.");
    getSecurityAttributes().requireClassification();
    super.validate();
  }
View Full Code Here


   */
  protected void validate(DDMSVersion version) throws InvalidDDMSException {
    if (!Util.isEmpty(getSrsName()))
      Util.requireDDMSValidURI(getSrsName());
    if (getSrsDimension() != null && getSrsDimension().intValue() < 0)
      throw new InvalidDDMSException("The srsDimension must be a positive integer.");
    if (Util.isEmpty(getSrsName()) && !getAxisLabels().isEmpty())
      throw new InvalidDDMSException("The axisLabels attribute must only be used in tandem with an srsName.");
    if (getAxisLabels().isEmpty() && !getUomLabels().isEmpty())
      throw new InvalidDDMSException("The uomLabels attribute must only be used in tandem with axisLabels.");
    Util.requireValidNCNames(getAxisLabels());
    Util.requireValidNCNames(getUomLabels());
    super.validate(version);
  }
View Full Code Here

   * @see AbstractBaseComponent#validate()
   */
  protected void validate() throws InvalidDDMSException {
    Util.requireDDMSQName(getXOMElement(), Dates.getName(getDDMSVersion()));
    if (!getDDMSVersion().isAtLeast("3.1") && !Util.isEmpty(getApprovedOnString())) {
      throw new InvalidDDMSException("This component must not have an approvedOn date until DDMS 3.1 or later.");
    }
    if (!getDDMSVersion().isAtLeast("4.0.1") && !Util.isEmpty(getReceivedOnString())) {
      throw new InvalidDDMSException("This component must not have a receivedOn date until DDMS 4.0.1 or later.");
    }
    // Check for acquiredOn is implicit, since the class cannot be instantiated before 4.1.
    if (!Util.isEmpty(getCreatedString()))
      Util.requireDDMSDateFormat(getCreatedString(), getNamespace());
    if (!Util.isEmpty(getPostedString()))
View Full Code Here

   */
  protected void validate() throws InvalidDDMSException {
    Util.requireDDMSQName(getXOMElement(), GeographicIdentifier.getName(getDDMSVersion()));
    if (getNames().isEmpty() && getRegions().isEmpty() && getCountryCode() == null && getSubDivisionCode() == null
      && getFacilityIdentifier() == null) {
      throw new InvalidDDMSException(
        "At least 1 of name, region, countryCode, subDivisionCode, or facilityIdentifier must exist.");
    }
    if (hasFacilityIdentifier()) {
      if (!getNames().isEmpty() || !getRegions().isEmpty() || getCountryCode() != null
        || getSubDivisionCode() != null)
        throw new InvalidDDMSException("facilityIdentifier must not be used in tandem with other components.");
    }
    if (getDDMSVersion().isAtLeast("5.0") && getCountryCode() != null) {
      validateGencCountryCode(getCountryCode());
    }
    super.validate();
View Full Code Here

      .replaceFirst("^urn:us:gov:dod:nga:def:geo-political:", "geo-political/")
      .replaceFirst("^ge:", "geo-political:")
      .replaceAll("/", ":");
    String code = countryCode.getValue();
    if (!codespace.matches("^geo-political:GENC:[23n]:ed\\d$"))
      throw new InvalidDDMSException(
        "ddms:countryCode must use a geo-political URN or URL, as specified in the DDMS Schematron file.");
    else if (codespace.contains("GENC:3:") && !code.matches("^[A-Z]{3}$"))
      throw new InvalidDDMSException(
        "A GENC country code in a 3-alpha codespace (e.g. geo-political:GENC:3:ed1) must consist of exactly 3 uppercase alpha characters.");
    else if (codespace.contains("GENC:2:") && !code.matches("^[A-Z]{2}$"))
      throw new InvalidDDMSException(
        "A GENC country code in a 2-alpha codespace (e.g. geo-political:GENC:2:ed1) must consist of exactly 2 uppercase alpha characters.");
    else if (codespace.contains("GENC:n:") && !code.matches("^[0-9]{3}$"))
      throw new InvalidDDMSException(
        "A GENC country code in a numeric codespace (e.g. geo-political:GENC:n:ed1) must consist of exactly 3 numerals.");
  }
View Full Code Here

   * @see AbstractBaseComponent#validate()
   */
  protected void validate() throws InvalidDDMSException {
    Util.requireQName(getXOMElement(), getNamespace(), Individual.getName(getDDMSVersion()));
    if (getIndividualValues().isEmpty())
      throw new InvalidDDMSException("At least one individual value must exist.");
    super.validate();
  }
View Full Code Here

   */
  public static void validateEnumeration(String enumerationKey, String value) throws InvalidDDMSException {
    setDDMSVersion(getDDMSVersion());
    if (!enumContains(enumerationKey, value)) {
      String message = getInvalidMessage(enumerationKey, value);
      throw new InvalidDDMSException(message);
    }
  }
View Full Code Here

   * @param network the network token to test
   * @throws InvalidDDMSException if the network is not a valid token
   */
  public static void requireValidNetwork(String network) throws InvalidDDMSException {
    if (!COMMON_NETWORK_TYPES.contains(network))
      throw new InvalidDDMSException("The network attribute must be one of " + COMMON_NETWORK_TYPES);
  }
View Full Code Here

   * @param value the value to check
   * @throws InvalidDDMSException if the value is null or empty
   */
  public static void requireDDMSValue(String description, Object value) throws InvalidDDMSException {
    if (value == null || (value instanceof String && isEmpty((String) value)))
      throw new InvalidDDMSException(description + " must exist.");
  }
View Full Code Here

    }
    if (!isXsdType) {
      String message = "The date datatype must be one of " + DATE_DATATYPES;
      if (version.isAtLeast("4.1"))
        message += " or ddms:DateHourMinType";
      throw new InvalidDDMSException(message);
    }
  }
View Full Code Here

TOP

Related Classes of buri.ddmsence.ddms.InvalidDDMSException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.