Package buri.ddmsence.ddms.extensible

Examples of buri.ddmsence.ddms.extensible.ExtensibleAttributes

The DDMS documentation does not provide sample HTML/Text output for extensible attributes, so the following approach is used. In general, the output of extensible attributes will be prefixed with the name of the element being marked. For example:

When output as JSON, properties will retain their namespace prefix. Because all values are stored as Strings, no casting is performed to Boolean or Number types.

Details about the XOM Attribute class can be found at: http://www.xom.nu/apidocs/index.html?nu/xom/Attribute.html

{@table.header History}

In DDMS 2.0, this attribute group can only decorate {@link buri.ddmsence.ddms.resource.Organization}, {@link buri.ddmsence.ddms.resource.Person}, {@link buri.ddmsence.ddms.resource.Service}, or the {@link Resource}.

In DDMS 3.0 and 3.1, this attribute group can decorate {@link buri.ddmsence.ddms.resource.Organization}, {@link buri.ddmsence.ddms.resource.Person}, {@link buri.ddmsence.ddms.resource.Service}, {@link buri.ddmsence.ddms.resource.Unknown}, {@link Keyword}, {@link Category}, or the {@link Resource} itself.

In DDMS 4.0.1 and 4.1, this attribute group was removed from {@link buri.ddmsence.ddms.resource.Person}.

In DDMS 5.0, this attribute group was also removed from {@link buri.ddmsence.ddms.resource.Organization} and{@link Resource}. It is anticipated that all remaining extension points will be deprecated in the next release.

{@table.footer}{@table.header Nested Elements}None. {@table.footer}{@table.header Attributes}{@child.info any:<extensibleAttributes>|0..*|11111}{@table.footer}{@table.header Validation Rules}Extensible attributes are not validated by DDMSence. {@table.footer} @author Brian Uri! @since 1.1.0

    for (String sVersion : getSupportedVersions()) {
      DDMSVersion version = DDMSVersion.setCurrentVersion(sVersion);
      createComponents();

      // Extensible attribute added
      ExtensibleAttributes attr = ExtensibleAttributesTest.getFixture();
      if (!version.isAtLeast("5.0")) {
        Resource.Builder builder = getBaseBuilder();
        builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attr));
        getInstance(builder, SUCCESS);
      }
View Full Code Here


    // icAttribute as parameter, uniqueAttribute as extensibleAttribute
    exAttr.clear();
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, null, null, null, getTestIsmDesVersion(),
      getTestNtkDesVersion(), null, null, new ExtensibleAttributes(exAttr));
    assertEquals(getTestIsmDesVersion(), component.getIsmDESVersion());
    assertTrue(component.getSecurityAttributes().isEmpty());
    assertEquals(1, component.getExtensibleAttributes().getAttributes().size());

    // icAttribute and uniqueAttribute as extensibleAttributes
    exAttr.clear();
    exAttr.add(new Attribute(icAttribute));
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, new ExtensibleAttributes(exAttr));
    assertNull(component.getIsmDESVersion());
    assertTrue(component.getSecurityAttributes().isEmpty());
    assertEquals(2, component.getExtensibleAttributes().getAttributes().size());

    // secAttribute as securityAttribute, uniqueAttribute as extensibleAttribute
    exAttr.clear();
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, null, null, null, null, null,
      SecurityAttributesTest.getFixture(), null, new ExtensibleAttributes(exAttr));
    assertNull(component.getIsmDESVersion());
    assertFalse(component.getSecurityAttributes().isEmpty());
    assertEquals(1, component.getExtensibleAttributes().getAttributes().size());

    // secAttribute and uniqueAttribute as extensibleAttribute
    exAttr.clear();
    exAttr.add(new Attribute(secAttribute));
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, new ExtensibleAttributes(exAttr));
    assertNull(component.getIsmDESVersion());
    assertTrue(component.getSecurityAttributes().isEmpty());
    assertEquals(2, component.getExtensibleAttributes().getAttributes().size());

    // icAttribute as parameter, secAttribute as securityAttribute, uniqueAttribute as extensibleAttribute
    exAttr.clear();
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, null, null, null, getTestIsmDesVersion(),
      getTestNtkDesVersion(), SecurityAttributesTest.getFixture(), null, new ExtensibleAttributes(exAttr));
    assertEquals(getTestIsmDesVersion(), component.getIsmDESVersion());
    assertFalse(component.getSecurityAttributes().isEmpty());
    assertEquals(1, component.getExtensibleAttributes().getAttributes().size());

    // icAttribute as parameter, secAttribute and uniqueAttribute as extensibleAttributes
    exAttr.clear();
    exAttr.add(new Attribute(secAttribute));
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, null, null, null, getTestIsmDesVersion(),
      getTestNtkDesVersion(), null, null, new ExtensibleAttributes(exAttr));
    assertEquals(getTestIsmDesVersion(), component.getIsmDESVersion());
    assertTrue(component.getSecurityAttributes().isEmpty());
    assertEquals(2, component.getExtensibleAttributes().getAttributes().size());

    // secAttribute as securityAttribute, icAttribute and uniqueAttribute as extensibleAttributes
    exAttr.clear();
    exAttr.add(new Attribute(icAttribute));
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, null, null, null, null, null,
      SecurityAttributesTest.getFixture(), null, new ExtensibleAttributes(exAttr));
    assertNull(component.getIsmDESVersion());
    assertFalse(component.getSecurityAttributes().isEmpty());
    assertEquals(2, component.getExtensibleAttributes().getAttributes().size());

    // all three as extensibleAttributes
    exAttr.clear();
    exAttr.add(new Attribute(icAttribute));
    exAttr.add(new Attribute(secAttribute));
    exAttr.add(new Attribute(uniqueAttribute));
    component = new Resource(TEST_TOP_LEVEL_COMPONENTS, new ExtensibleAttributes(exAttr));
    assertNull(component.getIsmDESVersion());
    assertTrue(component.getSecurityAttributes().isEmpty());
    assertEquals(3, component.getExtensibleAttributes().getAttributes().size());
  }
View Full Code Here

        continue;

      // IsmDESVersion in parameter AND extensible.
      List<Attribute> exAttr = new ArrayList<Attribute>();
      exAttr.add(new Attribute("ism:DESVersion", version.getIsmNamespace(), "2"));
      ExtensibleAttributes attributes = new ExtensibleAttributes(exAttr);
      Resource.Builder builder = getBaseBuilder();
      builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
      getInstance(builder, "The extensible attribute with the name, ism:DESVersion");

      if (version.isAtLeast("4.0.1")) {
        // NtkDESVersion in parameter AND extensible.
        exAttr = new ArrayList<Attribute>();
        exAttr.add(new Attribute("ntk:DESVersion", version.getNtkNamespace(), "2"));
        attributes = new ExtensibleAttributes(exAttr);
        builder = getBaseBuilder();
        builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
        getInstance(builder, "The extensible attribute with the name, ntk:DESVersion");
      }

      // classification in securityAttributes AND extensible.
      exAttr = new ArrayList<Attribute>();
      exAttr.add(new Attribute("ism:classification", version.getIsmNamespace(), "S"));
      attributes = new ExtensibleAttributes(exAttr);
      builder = getBaseBuilder();
      builder.getSecurityAttributes().setClassification("U");
      builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
      getInstance(builder, "The extensible attribute with the name, ism:classification");
    }
View Full Code Here

  }

  @Test
  public void testVersionSpecific() throws InvalidDDMSException
    // extensible attributes in 4.0.1
    ExtensibleAttributes attr = ExtensibleAttributesTest.getFixture();
    DDMSVersion.setCurrentVersion("4.0.1");
    Person.Builder builder = getBaseBuilder();
    builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attr));
    getInstance(builder, "ddms:person must not have");
  }
View Full Code Here

    Organization.Builder builder = getBaseBuilder();
    builder.setAcronym("test");
    getInstance(builder, "An organization must not have an acronym");
   
    // extensible attributes in 5.0
    ExtensibleAttributes attr = ExtensibleAttributesTest.getFixture();
    DDMSVersion.setCurrentVersion("5.0");
    builder = getBaseBuilder();
    builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attr));
    getInstance(builder, "ddms:organization must not have");
  }
View Full Code Here

    DDMSVersion.setCurrentVersion("3.1");
    getInstance(builder, "Security attributes must not be applied");
   
    // No attributes in 2.0
    DDMSVersion.setCurrentVersion("2.0");
    ExtensibleAttributes attributes = ExtensibleAttributesTest.getFixture();
    builder = getBaseBuilder();
    builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
    getInstance(builder, "xs:anyAttribute must not be applied");

    DDMSVersion version = DDMSVersion.setCurrentVersion("3.0");

    // Using ddms:qualifier as the extension (data)
    List<Attribute> extAttributes = new ArrayList<Attribute>();
    extAttributes.add(new Attribute("ddms:qualifier", version.getNamespace(), "dog"));
    attributes = new ExtensibleAttributes(extAttributes);
    builder = getBaseBuilder();
    builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
    getInstance(builder, "The extensible attribute with the name, ddms:qualifier");
   
    // Using ddms:code as the extension (data)
    extAttributes = new ArrayList<Attribute>();
    extAttributes.add(new Attribute("ddms:code", version.getNamespace(), "dog"));
    attributes = new ExtensibleAttributes(extAttributes);
    builder = getBaseBuilder();
    builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
    getInstance(builder, "The extensible attribute with the name, ddms:code");

    // Using ddms:label as the extension (data)
    extAttributes = new ArrayList<Attribute>();
    extAttributes.add(new Attribute("ddms:label", version.getNamespace(), "dog"));
    attributes = new ExtensibleAttributes(extAttributes);
    builder = getBaseBuilder();
    builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
    getInstance(builder, "The extensible attribute with the name, ddms:label");
   
    // Using icism:classification as the extension (data)
    extAttributes = new ArrayList<Attribute>();
    extAttributes.add(new Attribute("ism:classification", version.getIsmNamespace(), "U"));
    attributes = new ExtensibleAttributes(extAttributes);
    builder = getBaseBuilder();
    builder.setExtensibleAttributes(new ExtensibleAttributes.Builder(attributes));
    getInstance(builder, SUCCESS);   
  }
View Full Code Here

  protected AbstractRoleEntity(Element element, boolean validateNow) throws InvalidDDMSException {
    try {
      _names = Util.getDDMSChildValues(element, NAME_NAME);
      _phones = Util.getDDMSChildValues(element, PHONE_NAME);
      _emails = Util.getDDMSChildValues(element, EMAIL_NAME);
      _extensibleAttributes = new ExtensibleAttributes(element);
      setXOMElement(element, validateNow);
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
      throw (e);
View Full Code Here

   * @throws InvalidDDMSException if any required information is missing or malformed
   */
  public Keyword(Element element) throws InvalidDDMSException {
    try {
      _securityAttributes = new SecurityAttributes(element);
      _extensibleAttributes = new ExtensibleAttributes(element);
      setXOMElement(element, true);
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
      throw (e);
View Full Code Here

   * @throws InvalidDDMSException if any required information is missing or malformed
   */
  public Category(Element element) throws InvalidDDMSException {
    try {
      _securityAttributes = new SecurityAttributes(element);
      _extensibleAttributes = new ExtensibleAttributes(element);
      setXOMElement(element, true);
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
      throw (e);
View Full Code Here

          _ntkDESVersion = Integer.valueOf(ntkDESVersion);
        }
      }
      _noticeAttributes = new NoticeAttributes(element);
      _securityAttributes = new SecurityAttributes(element);
      _extensibleAttributes = new ExtensibleAttributes(element);

      DDMSVersion version = getDDMSVersion();

      // Metacard Set
      Element component = getChild(MetacardInfo.getName(version));
View Full Code Here

TOP

Related Classes of buri.ddmsence.ddms.extensible.ExtensibleAttributes

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.