Package buri.ddmsence.ddms

Examples of buri.ddmsence.ddms.InvalidDDMSException


   * @throws InvalidDDMSException if the value is null, empty or invalid.
   */
  public static void validateVerticalDatumType(String datumType) throws InvalidDDMSException {
    Util.requireDDMSValue("vertical datum type", datumType);
    if (!VERTICAL_DATUM_TYPES.contains(datumType))
      throw new InvalidDDMSException("The vertical datum type must be one of " + VERTICAL_DATUM_TYPES);
  }
View Full Code Here


   * @throws InvalidDDMSException if the value is null, empty or invalid.
   */
  public static void validateLengthMeasureType(String lengthType) throws InvalidDDMSException {
    Util.requireDDMSValue("length measure type", lengthType);
    if (!LENGTH_MEASURE_TYPES.contains(lengthType))
      throw new InvalidDDMSException("The length measure type must be one of " + LENGTH_MEASURE_TYPES);
  }
View Full Code Here

    validateLengthMeasureType(getUnitOfMeasure());
    validateVerticalDatumType(getDatum());
    validateInheritedAttributes(getChild(getMinVerticalExtentName()));
    validateInheritedAttributes(getChild(getMaxVerticalExtentName()));
    if (getMaxVerticalExtent().compareTo(getMinVerticalExtent()) < 0)
      throw new InvalidDDMSException("Minimum vertical extent must be less than maximum vertical extent.");
    super.validate();
  }
View Full Code Here

   */
  private void validateInheritedAttributes(Element extentElement) throws InvalidDDMSException {
    String unitOfMeasure = extentElement.getAttributeValue(UOM_NAME, extentElement.getNamespaceURI());
    String datum = extentElement.getAttributeValue(DATUM_NAME, extentElement.getNamespaceURI());
    if (!Util.isEmpty(unitOfMeasure) && !unitOfMeasure.equals(getUnitOfMeasure()))
      throw new InvalidDDMSException("The unitOfMeasure on the " + extentElement.getLocalName()
        + " element must match the unitOfMeasure on the enclosing verticalExtent element.");
    if (!Util.isEmpty(datum) && !datum.equals(getDatum()))
      throw new InvalidDDMSException("The datum on the " + extentElement.getLocalName()
        + " element must match the datum on the enclosing verticalExtent element.");
  }
View Full Code Here

    public VerticalExtent commit() throws InvalidDDMSException {
      if (isEmpty())
        return (null);
      // Check for existence of values before casting to primitives.
      if (getMinVerticalExtent() == null || getMaxVerticalExtent() == null)
        throw new InvalidDDMSException("A ddms:verticalExtent must have a minimum and maximum extent value.");
      return (new VerticalExtent(getMinVerticalExtent().doubleValue(), getMaxVerticalExtent().doubleValue(),
        getUnitOfMeasure(), getDatum()));
    }
View Full Code Here

    Util.requireDDMSQName(getXOMElement(), Type.getName(getDDMSVersion()));
    if (!Util.isEmpty(getValue()))
      Util.requireDDMSValue("qualifier attribute", getQualifier());
    if (!getDDMSVersion().isAtLeast("4.0.1")) {
      if (!Util.isEmpty(getDescription()))
        throw new InvalidDDMSException(
          "This component must not contain description child text until DDMS 4.0.1 or later.");
      if (!getSecurityAttributes().isEmpty())
        throw new InvalidDDMSException(
          "Security attributes must not be applied to this component until DDMS 4.0.1 or later.");
    }
    super.validate();
  }
View Full Code Here

  protected void validate() throws InvalidDDMSException {
    Util.requireDDMSQName(getXOMElement(), PostalAddress.getName(getDDMSVersion()));
    if (!getDDMSVersion().isAtLeast("5.0")) {
      Util.requireBoundedChildCount(getXOMElement(), STREET_NAME, 0, 6);
      if (!Util.isEmpty(getState()) && !Util.isEmpty(getProvince())) {
        throw new InvalidDDMSException("Only 1 of state or province must be used.");
      }
      // Check for TSPI components is implicit, since they cannot be instantiated before DDMS 5.0.
    }
    else {
      if (!getStreets().isEmpty() || !Util.isEmpty(getCity()) || !Util.isEmpty(getState())
        || !Util.isEmpty(getProvince()) || !Util.isEmpty(getPostalCode()) || getCountryCode() != null) {
        throw new InvalidDDMSException("postalAddress must be defined with a TSPI address.");
      }
      Util.requireDDMSValue("TSPI address", getTspiAddress());
    }
    super.validate();
  }
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.