Package buri.ddmsence.ddms

Examples of buri.ddmsence.ddms.InvalidDDMSException


   * @see AbstractBaseComponent#validate()
   */
  protected void validate() throws InvalidDDMSException {
    requireAtLeastVersion("5.0");
    if (!Util.isEmpty(getAction()) &&!ACTIONS.contains(getAction()))
      throw new InvalidDDMSException("The action attribute must be one of " + ACTIONS);   
    super.validate();
  }
View Full Code Here


   */
  protected void validate() throws InvalidDDMSException {
    requireAtLeastVersion("4.0.1");
    Util.requireDDMSValue("entity", getEntity());
    if (!(getEntity() instanceof Organization) && !(getEntity() instanceof Person)) {
      throw new InvalidDDMSException("The entity must be a person or an organization.");
    }
    Util.requireBoundedChildCount(getXOMElement(), Organization.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(getXOMElement(), Person.getName(getDDMSVersion()), 0, 1);
    getSecurityAttributes().requireClassification();
    super.validate();
View Full Code Here

  /**
   * @see AbstractBaseComponent#validate()
   */
  protected void validate() throws InvalidDDMSException {
    if (Util.containsOnlyEmptyValues(getNames()))
      throw new InvalidDDMSException("At least 1 name element must have a non-empty value.");
    super.validate();
  }
View Full Code Here

   * @param version the inclusive threshold version
   * @throws InvalidDDMSException if the version is not high enough
   */
  protected void requireAtLeastVersion(String version) throws InvalidDDMSException {
    if (!getDDMSVersion().isAtLeast(version))
      throw new InvalidDDMSException("The " + getName() + " element must not be used until DDMS " + version
        + " or later.");
  }
View Full Code Here

   * @throws InvalidDDMSException if the version is too high enough
   */
  protected void requireAtMostVersion(String version) throws InvalidDDMSException {
    DDMSVersion ceiling = DDMSVersion.getVersionFor(version);
    if (!ceiling.isAtLeast(getDDMSVersion().getVersion()))
      throw new InvalidDDMSException("The " + getName() + " element must not be used after DDMS " + version
        + ".");
  }
View Full Code Here

          return (new Creator(entity, null, attr));
        if (Publisher.getName(version).equals(producerType))
          return (new Publisher(entity, null, attr));
        if (PointOfContact.getName(version).equals(producerType))
          return (new PointOfContact(entity, Util.getXsListAsList(pocTypes), attr));
        throw new InvalidDDMSException("Unknown producerType: " + producerType);
      }
    });
    CONSTRUCTOR_BUILDERS.put(Person.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        int numNames = readInt("the number of names this person has [1]");
View Full Code Here

   * @param e the exception
   */
  private void printError(Exception e) {
    // e.printStackTrace();
    if (e instanceof InvalidDDMSException) {
      InvalidDDMSException ide = (InvalidDDMSException) e;
      String prefix = (Util.isEmpty(ide.getLocator()) ? "" : ide.getLocator() + ": ");
      println("[ERROR] " + prefix + e.getMessage());
    }
    else
      println("[ERROR]: " + e.getMessage());
  }
View Full Code Here

   */
  protected void validate() throws InvalidDDMSException {
    Util.requireDDMSQName(getXOMElement(), Keyword.getName(getDDMSVersion()));
    Util.requireDDMSValue("value attribute", getValue());
    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.");
    }
    if (!getDDMSVersion().isAtLeast("3.0") && !getExtensibleAttributes().isEmpty())
      throw new InvalidDDMSException("xs:anyAttribute must not be applied to ddms:keyword until DDMS 3.0 or later.");
    super.validate();
  }
View Full Code Here

    Util.requireBoundedChildCount(getXOMElement(), Organization.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(getXOMElement(), Person.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(getXOMElement(), Service.getName(getDDMSVersion()), 0, 1);
    Util.requireBoundedChildCount(getXOMElement(), Unknown.getName(getDDMSVersion()), 0, 1);
    if (!getDDMSVersion().isAtLeast("4.0.1") && !getPocTypes().isEmpty()) {
      throw new InvalidDDMSException("This component must not have a pocType until DDMS 4.0.1 or later.");
    }
    for (String pocType : getPocTypes())
      ISMVocabulary.validateEnumeration(ISMVocabulary.CVE_POC_TYPE, pocType);
    super.validate();
  }
View Full Code Here

    Util.requireDDMSValue("label attribute", getLabel());
    if (!Util.isEmpty(getQualifier())) {
      Util.requireDDMSValidURI(getQualifier());
    }
    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.");
    }
    if (!getDDMSVersion().isAtLeast("3.0") && !getExtensibleAttributes().isEmpty())
      throw new InvalidDDMSException(
        "xs:anyAttribute must not be applied to ddms:category 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.