Package buri.ddmsence.ddms

Examples of buri.ddmsence.ddms.InvalidDDMSException


   */
  protected void validate() throws InvalidDDMSException {
    Util.requireDDMSQName(getXOMElement(), Link.getName(getDDMSVersion()));
    Util.requireDDMSValue("type attribute", getXLinkAttributes().getType());
    if (!getXLinkAttributes().getType().equals(FIXED_TYPE))
      throw new InvalidDDMSException("The type attribute must have a fixed value of \"" + FIXED_TYPE + "\".");
    Util.requireDDMSValue("href attribute", getXLinkAttributes().getHref());
    if (!getDDMSVersion().isAtLeast("4.0.1") && !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


      nu.xom.Builder builder = new nu.xom.Builder(reader, false);
      Document doc = builder.build(new StringReader(xml));
      return (doc.getRootElement());
    }
    catch (Exception e) {
      throw new InvalidDDMSException("Could not create a valid element from XML string: " + e.getMessage());
    }
  }
View Full Code Here

    if (!Util.isEmpty(noticeDate)) {
      try {
        _noticeDate = getFactory().newXMLGregorianCalendar(noticeDate);
      }
      catch (IllegalArgumentException e) {
        throw new InvalidDDMSException("The ism:noticeDate attribute must adhere to a valid date format.");
      }
    }
    _externalNotice = externalNotice;
    validate(version);
  }
View Full Code Here

   * @param newParentVersion the version to test
   * @throws InvalidDDMSException if the versions do not match
   */
  protected void validateCompatibleVersion(DDMSVersion newParentVersion) throws InvalidDDMSException {
    if (!newParentVersion.getIsmNamespace().equals(getNamespace()))
      throw new InvalidDDMSException(INCOMPATIBLE_VERSION_MESSAGE);
  }
View Full Code Here

   *        DDMSVersions have the same attribute XML namespace (e.g. XLink, ISM, NTK, GML after DDMS 2.0).
   * @throws InvalidDDMSException if any required information is missing or malformed
   */
  protected void validate(DDMSVersion version) throws InvalidDDMSException {
    if (!version.isAtLeast("4.0.1") && !isEmpty())
      throw new InvalidDDMSException("Notice attributes must not be used until DDMS 4.0.1 or later.");
    if (!Util.isEmpty(getNoticeType()))
      ISMVocabulary.validateEnumeration(ISMVocabulary.CVE_NOTICE_TYPE, getNoticeType());
    if (!Util.isEmpty(getNoticeReason()) && getNoticeReason().length() > MAX_LENGTH)
      throw new InvalidDDMSException("The noticeReason attribute must be shorter than " + MAX_LENGTH
        + " characters.");
    if (!Util.isEmpty(getUnregisteredNoticeType()) && getUnregisteredNoticeType().length() > MAX_LENGTH)
      throw new InvalidDDMSException("The unregisteredNoticeType attribute must be shorter than " + MAX_LENGTH
        + " characters.");
    if (getNoticeDate() != null && !getNoticeDate().getXMLSchemaType().equals(DatatypeConstants.DATE))
      throw new InvalidDDMSException("The noticeDate attribute must be in the xs:date format (YYYY-MM-DD).");
    super.validate(version);
  }
View Full Code Here

  protected void validate() throws InvalidDDMSException {
    requireAtLeastVersion("4.0.1");
    Util.requireDDMSQName(getXOMElement(), TaskID.getName(getDDMSVersion()));
    Util.requireDDMSValue("value", getValue());
    if (!Util.isEmpty(getXLinkAttributes().getType()) && !getXLinkAttributes().getType().equals(FIXED_TYPE))
      throw new InvalidDDMSException("The type attribute must have a fixed value of \"" + FIXED_TYPE + "\".");
    if (!Util.isEmpty(getNetwork()))
      ISMVocabulary.requireValidNetwork(getNetwork());
    if (getDDMSVersion().isAtLeast("5.0")) {
      // Check for network is implicit in schema validation.     
      if (!Util.isEmpty(getOtherNetwork()))
        throw new InvalidDDMSException("The otherNetwork attribute must not be used after DDMS 4.1.");
    }
    super.validate();
  }
View Full Code Here

    if (!Util.isEmpty(getHref()))
      Util.requireDDMSValidURI(getHref());
    if (!Util.isEmpty(getArcrole()))
      Util.requireDDMSValidURI(getArcrole());
    if (!Util.isEmpty(getShow()) && !SHOW_TYPES.contains(getShow()))
      throw new InvalidDDMSException("The show attribute must be one of " + SHOW_TYPES);
    if (!Util.isEmpty(getActuate()) && !ACTUATE_TYPES.contains(getActuate()))
      throw new InvalidDDMSException("The actuate attribute must be one of " + ACTUATE_TYPES);
    if (version.isAtLeast("4.0.1")) {
      if (!Util.isEmpty(getRole()))
        Util.requireDDMSValidURI(getRole());
      if (!Util.isEmpty(getLabel()))
        Util.requireValidNCName(getLabel());
View Full Code Here

      if (isEmpty())
        return (null);
      if (!DDMSVersion.getCurrentVersion().isAtLeast("5.0")) {
        boolean hasStateAndProvince = (!Util.isEmpty(getState()) && !Util.isEmpty(getProvince()));
        if (hasStateAndProvince)
          throw new InvalidDDMSException("Only 1 of state or province must be used.");
        boolean hasState = !Util.isEmpty(getState());
        String stateOrProvince = hasState ? getState() : getProvince();
        return (new PostalAddress(getStreets(), getCity(), stateOrProvince, getPostalCode(),
          getCountryCode().commit(), hasState));
      }
View Full Code Here

        return (getUSPSGeneralDeliveryOffice().commit());
      if (USPSPostalDeliveryBox.getName(version).equals(getAddressType()))
        return (getUSPSPostalDeliveryBox().commit());
      if (USPSPostalDeliveryRoute.getName(version).equals(getAddressType()))
        return (getUSPSPostalDeliveryRoute().commit());
      throw new InvalidDDMSException("Unknown address type: " + getAddressType());
    }
View Full Code Here

    Util.requireDDMSQName(getXOMElement(), Source.getName(getDDMSVersion()));
    if (!Util.isEmpty(getSchemaHref())) {
      Util.requireDDMSValidURI(getSchemaHref());
    }
    if (!getDDMSVersion().isAtLeast("3.0") && !getSecurityAttributes().isEmpty()) {
      throw new InvalidDDMSException(
        "Security attributes must not be applied to this component until DDMS 3.0 or later.");
    }
    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.