Package buri.ddmsence.ddms

Examples of buri.ddmsence.ddms.InvalidDDMSException


    Util.requireDDMSQName(getXOMElement(), Person.getName(getDDMSVersion()));
    Util.requireDDMSValue(SURNAME_NAME, getSurname());
    if (!getDDMSVersion().isAtLeast("5.0"))
      Util.requireBoundedChildCount(getXOMElement(), AFFILIATION_NAME, 0, 1);
    if (getDDMSVersion().isAtLeast("4.0.1") && !getExtensibleAttributes().isEmpty())
      throw new InvalidDDMSException("ddms:" + getName() + " must not have extensible attributes after DDMS 3.1.");
    super.validate();
  }
View Full Code Here


  /**
   * @see AbstractBaseComponent#validate()
   */
  protected void validate() throws InvalidDDMSException {
    if (DDMSVersion.isSupportedDDMSNamespace(getNamespace()))
      throw new InvalidDDMSException("Extensible elements must not be defined in the DDMS namespace.");
    super.validate();
  }
View Full Code Here

   * @throws InvalidDDMSException if the value is null, empty or invalid.
   */
  public static void validateRelationshipDirection(String direction) throws InvalidDDMSException {
    Util.requireDDMSValue("relationship direction", direction);
    if (!RELATIONSHIP_DIRECTIONS.contains(direction))
      throw new InvalidDDMSException("The direction attribute must be one of " + RELATIONSHIP_DIRECTIONS);
  }
View Full Code Here

      validateRelationshipDirection(getDirection());
    Util.requireDDMSValue("qualifier attribute", getQualifier());
    Util.requireDDMSValidURI(getQualifier());
    Util.requireDDMSValue("value attribute", getValue());
    if (getLinks().isEmpty())
      throw new InvalidDDMSException("At least 1 link must exist.");
    for (Link link : getLinks()) {
      if (!link.getSecurityAttributes().isEmpty())
        throw new InvalidDDMSException("Security attributes must not be applied to links in a related resource.");
    }
    super.validate();
  }
View Full Code Here

      Node child = getXOMElement().getChild(i);
      hasChildText = (hasChildText || (child instanceof Text && !Util.isEmpty(child.getValue().trim())));
    }
    boolean hasNestedElements = (!getLinks().isEmpty() || !getDetails().isEmpty());
    if (hasChildText && hasNestedElements) {
      throw new InvalidDDMSException(
        "A ddms:revisionRecall element must not have both child text and nested elements.");
    }   
    for (Link link : getLinks()) {
      Util.requireDDMSValue("link security attributes", link.getSecurityAttributes());
      link.getSecurityAttributes().requireClassification();
    }
   
    Util.requireDDMSValue("revision ID", getRevisionID());
    if (!REVISION_TYPE_TYPES.contains(getRevisionType()))
      throw new InvalidDDMSException("The revisionType attribute must be one of " + REVISION_TYPE_TYPES);
    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.");
    }
    getSecurityAttributes().requireClassification();
    super.validate();
  }
View Full Code Here

   * @throws InvalidDDMSException if the attribute already exists
   */
  public void addTo(Element element) throws InvalidDDMSException {
    for (Attribute attribute : getAttributes()) {
      if (element.getAttribute(attribute.getLocalName(), attribute.getNamespaceURI()) != null)
        throw new InvalidDDMSException("The extensible attribute with the name, "
          + attribute.getQualifiedName() + " conflicts with a pre-existing attribute on the element.");
      element.addAttribute(attribute);
    }
  }
View Full Code Here

      if (!EXTENDED_DATE_TYPES.contains(getEndString()))
        Util.requireDDMSDateFormat(getEndString(), getNamespace());
    }
    // Check for approximableDates is implicit, since they cannot be instantiated before 4.1.
    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

          _noticeList = (NoticeList) component;
        else if (component instanceof Access) {
          _access = (Access) component;
        }
        else
          throw new InvalidDDMSException(component.getName()
            + " is not a valid child component in a metacardInfo element.");
      }
      populatedOrderedList();
      for (IDDMSComponent component : getNestedComponents()) {
        element.appendChild(component.getXOMElementCopy());
View Full Code Here

   */
  protected void validate() throws InvalidDDMSException {
    requireAtLeastVersion("4.0.1");
    Util.requireDDMSQName(getXOMElement(), MetacardInfo.getName(getDDMSVersion()));
    if (getIdentifiers().isEmpty())
      throw new InvalidDDMSException(
        "At least one ddms:identifier must exist within a ddms:metacardInfo element.");
    Util.requireBoundedChildCount(getXOMElement(), Dates.getName(getDDMSVersion()), 1, 1);
    if (!getDDMSVersion().isAtLeast("5.0")) {
      if (getPublishers().isEmpty())
        throw new InvalidDDMSException(
          "At least one ddms:publisher must exist within a ddms:metacardInfo element.");
    }
    else {
      if (getContributors().isEmpty() && getCreators().isEmpty() && getPointOfContacts().isEmpty()
        && getPublishers().isEmpty())
        throw new InvalidDDMSException("At least one producer must exist within a ddms:metacardInfo element.");
      // NoticeList check is implicit, since the class cannot be instantiated after DDMS 4.1.
      if (getAccess() != null)
        throw new InvalidDDMSException("The ntk:Access element must not be used after DDMS 4.1.");
    }
    super.validate();
  }
View Full Code Here

     */
    public TemporalCoverage commit() throws InvalidDDMSException {
      if (isEmpty())
        return (null);
      if (!getApproximableStart().isEmpty() && !Util.isEmpty(getStartString()))
        throw new InvalidDDMSException("Only 1 of start or approximableStart must be used.");
      if (!getApproximableEnd().isEmpty() && !Util.isEmpty(getEndString()))
        throw new InvalidDDMSException("Only 1 of end or approximableEnd must be used.");
      if (!getApproximableStart().isEmpty() && !getApproximableEnd().isEmpty())
        return (new TemporalCoverage(getTimePeriodName(), getApproximableStart().commit(),
          getApproximableEnd().commit(), getSecurityAttributes().commit()));
      if (!getApproximableStart().isEmpty() && getApproximableEnd().isEmpty())
        return (new TemporalCoverage(getTimePeriodName(), getApproximableStart().commit(),
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.