public final class RelatedResource extends AbstractQualifierValue
Before DDMS 4.0.1, ddms:RelatedResources was the top-level component (0-many in a resource) and contained 1 to many ddms:relatedResource components. Starting in DDMS 4.0.1, the ddms:RelatedResources component was removed, and the ddms:relatedResource now contains all of the parent information (relationship and direction).
The element-based constructor for this class can automatically handle these cases, and will automatically mediate the Text/HTML/XML output:
If you have a case where a pre-DDMS 4.0.1 ddms:RelatedResources element contained 5 ddms:relatedResource elements, the Resource class will automatically mediate it to create 5 RelatedResource instances. If an old-fashioned parent element containing multiple children is loaded in the element-based constructor, only the first child will be processed, and a warning will be provided.
| Strictness |
|---|
|
DDMSence is stricter than the specification in the following ways:
|
| Nested Elements |
|---|
ddms:link: a link for the resource (1-many required), implemented as a Link |
| Attributes |
|---|
|
ddms:relationship: A URI representing a relationship of some relationship type between the resource being
described and other resources. (required) ddms:direction: Used to indicate the direction of the relationship between the resource being described and the target related resource. Valid values are "inbound," "outbound," and "bidirectional". (optional) ddms:qualifier: A URI specifying the formal identification system or encoding scheme by which the identifier value is to be interpreted. (required) ddms:value: an unambiguous reference to the resource within a given context. An internal, external, and/or universal identification number for a data asset or resource. (required) SecurityAttributes: The classification and ownerProducer attributes are optional.
|
| Modifier and Type | Class and Description |
|---|---|
static class |
RelatedResource.Builder
Builder for this DDMS component.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
BIDRECTIONAL_DIRECTION
The value for an bidirectional direction.
|
static String |
INBOUND_DIRECTION
The value for an inbound direction.
|
static String |
OLD_INNER_NAME
The pre-DDMS 4.0.1 name of the nested resource elements
|
static String |
OUTBOUND_DIRECTION
The value for an outbound direction.
|
QUALIFIER_NAME, VALUE_NAME| Constructor and Description |
|---|
RelatedResource(nu.xom.Element element)
Constructor for creating a component from a XOM Element
|
RelatedResource(List<Link> links,
String relationship,
String direction,
String qualifier,
String value,
SecurityAttributes securityAttributes)
Constructor for creating a component from raw data
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Test for logical equality.
|
String |
getDirection()
Accessor for the direction attribute (may be empty)
|
List<Link> |
getLinks()
Accessor for the links (1 to many).
|
static String |
getName(DDMSVersion version)
Accessor for the element name of this component, based on the version of DDMS used
|
protected List<IDDMSComponent> |
getNestedComponents()
Accessor for a collection of nested components.
|
String |
getOutput(boolean isHTML,
String prefix,
String suffix)
Renders this component as HTML or Text, with an optional prefix to nest it.
|
String |
getQualifier()
Accessor for the value of the qualifier attribute
|
String |
getRelationship()
Accessor for the relationship attribute
|
SecurityAttributes |
getSecurityAttributes()
Accessor for the Security Attributes.
|
String |
getValue()
Accessor for the value of the value attribute
|
int |
hashCode()
Returns a hashcode for the component.
|
protected void |
validate()
Validates the component.
|
static void |
validateRelationshipDirection(String direction)
Asserts that a direction is valid.
|
protected void |
validateWarnings()
Validates any conditions that might result in a warning.
|
addDdms40Warning, addWarning, addWarnings, buildIndex, buildOutput, buildOutput, buildPrefix, getAttributeValue, getAttributeValue, getChild, getChildTextAsDouble, getDDMSVersion, getLocatorSuffix, getName, getNamespace, getPrefix, getQualifiedName, getStringAsDouble, getValidationWarnings, getXOMElement, getXOMElementCopy, requireVersion, setXOMElement, toHTML, toString, toText, toXMLpublic static final String INBOUND_DIRECTION
public static final String OUTBOUND_DIRECTION
public static final String BIDRECTIONAL_DIRECTION
public static final String OLD_INNER_NAME
public RelatedResource(nu.xom.Element element)
throws InvalidDDMSException
element - the XOM element representing thisInvalidDDMSException - if any required information is missing or malformedpublic RelatedResource(List<Link> links, String relationship, String direction, String qualifier, String value, SecurityAttributes securityAttributes) throws InvalidDDMSException
links - the xlinksrelationship - the relationship attribute (required)direction - the relationship direction (optional)qualifier - the value of the qualifier attributevalue - the value of the value attributesecurityAttributes - any security attributes (optional)InvalidDDMSException - if any required information is missing or malformedpublic static void validateRelationshipDirection(String direction)
throws InvalidDDMSException
direction - the string to checkInvalidDDMSException - if the value is null, empty or invalid.protected void validate()
throws InvalidDDMSException
| Rules |
|---|
|
|
validate in class AbstractBaseComponentInvalidDDMSException - if any required information is missing or malformedAbstractBaseComponent.validate()protected void validateWarnings()
| Rules |
|---|
|
|
validateWarnings in class AbstractBaseComponentpublic String getOutput(boolean isHTML,
String prefix,
String suffix)
AbstractBaseComponentgetOutput in class AbstractBaseComponentisHTML - true for HTML, false for Text.prefix - an optional prefix to put on each name.suffix - an optional suffix to append to each name, such as an index.AbstractBaseComponent.getOutput(boolean, String, String)protected List<IDDMSComponent> getNestedComponents()
AbstractBaseComponentgetNestedComponents in class AbstractBaseComponentAbstractBaseComponent.getNestedComponents()public boolean equals(Object obj)
AbstractBaseComponentThe base case tests against the name value and namespaceURI, as well as any child components classified as "nested components" and any security attributes. Extending classes may require additional rules for equality. This case automatically includes any nested components or security attributes.
equals in class AbstractQualifierValueObject.equals(Object)public int hashCode()
AbstractBaseComponentThis automatically includes any nested components or security attributes.
hashCode in class AbstractQualifierValueObject.hashCode()public static String getName(DDMSVersion version)
version - the DDMSVersionpublic List<Link> getLinks()
public String getRelationship()
public String getDirection()
public String getQualifier()
getQualifier in class AbstractQualifierValuepublic String getValue()
getValue in class AbstractQualifierValuepublic SecurityAttributes getSecurityAttributes()
getSecurityAttributes in interface IDDMSComponentgetSecurityAttributes in class AbstractBaseComponentCopyright 2010 - 2013 by Brian Uri!
Generated on 12/15/2013 10:22 AM
http://ddmsence.urizone.net/