SMILA (incubation) API documentation

org.eclipse.smila.datamodel.id.dom
Class IdBuilder

java.lang.Object
  extended by org.eclipse.smila.datamodel.id.dom.IdBuilder

public class IdBuilder
extends java.lang.Object

A utility class to create DOM representations of SMILA record Ids.

Author:
jschumacher

Field Summary
static java.lang.String ATTRIBUTE_NAME
          attribute name of key name attribtue: "name".
static java.lang.String ATTRIBUTE_VERSION
          attribute name of key name attribtue: "verson".
static java.lang.String ATTRIBUTE_XMLNSID
          attribute "xmlns:id" for specification if SMILA Id XML namespace URI.
static java.lang.String NAMESPACE_ID
          SMILA Id XML namespace URI, "http://www.eclipse.org/smila/id".
static java.lang.String PREFIX_ID
          namespace prefix "id:" for Id XML elements.
static java.lang.String SCHEMA_VERSION_ID
          version of Id XMLs created by this builder: "1.0".
static java.lang.String TAG_ELEMENT
          qualified tag name of container element elements: "id:Element".
static java.lang.String TAG_FRAGMENT
          qualified tag name of fragment elements: "id:Fragment".
static java.lang.String TAG_ID
          qualified tag name of Id elements: "id:Id".
static java.lang.String TAG_IDLIST
          qualified tag name of Id list elements: "id:IdList".
static java.lang.String TAG_KEY
          qualified tag name of key elements: "id:Key".
static java.lang.String TAG_SOURCE
          qualified tag name of source elements: "id:Source".
 
Constructor Summary
IdBuilder()
          create new IdBuilder.
IdBuilder(boolean printPretty)
          create new IdBuilder with custom printPretty flag.
 
Method Summary
 org.w3c.dom.Element appendId(org.w3c.dom.Document document, Id id)
          Append id.
 org.w3c.dom.Element appendId(org.w3c.dom.Element element, Id id)
          add an Id element for the given element as the final child.
 org.w3c.dom.Element appendIdList(org.w3c.dom.Element element, Id[] idList)
          add an IdList element containing Id elements for the Ids in the given list to the given element as the final child.
 org.w3c.dom.Element appendIdList(org.w3c.dom.Element element, java.lang.Iterable<Id> idList)
          add an IdList element containing Id elements for the Ids in the given list to the given element as the final child.
 java.lang.String idToString(Id id)
          Creates an xml string representation of the given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE_ID

public static final java.lang.String NAMESPACE_ID
SMILA Id XML namespace URI, "http://www.eclipse.org/smila/id".

See Also:
Constant Field Values

ATTRIBUTE_XMLNSID

public static final java.lang.String ATTRIBUTE_XMLNSID
attribute "xmlns:id" for specification if SMILA Id XML namespace URI.

See Also:
Constant Field Values

PREFIX_ID

public static final java.lang.String PREFIX_ID
namespace prefix "id:" for Id XML elements.

See Also:
Constant Field Values

TAG_ID

public static final java.lang.String TAG_ID
qualified tag name of Id elements: "id:Id".

See Also:
Constant Field Values

TAG_IDLIST

public static final java.lang.String TAG_IDLIST
qualified tag name of Id list elements: "id:IdList".

See Also:
Constant Field Values

TAG_SOURCE

public static final java.lang.String TAG_SOURCE
qualified tag name of source elements: "id:Source".

See Also:
Constant Field Values

TAG_KEY

public static final java.lang.String TAG_KEY
qualified tag name of key elements: "id:Key".

See Also:
Constant Field Values

TAG_ELEMENT

public static final java.lang.String TAG_ELEMENT
qualified tag name of container element elements: "id:Element".

See Also:
Constant Field Values

TAG_FRAGMENT

public static final java.lang.String TAG_FRAGMENT
qualified tag name of fragment elements: "id:Fragment".

See Also:
Constant Field Values

ATTRIBUTE_VERSION

public static final java.lang.String ATTRIBUTE_VERSION
attribute name of key name attribtue: "verson".

See Also:
Constant Field Values

ATTRIBUTE_NAME

public static final java.lang.String ATTRIBUTE_NAME
attribute name of key name attribtue: "name".

See Also:
Constant Field Values

SCHEMA_VERSION_ID

public static final java.lang.String SCHEMA_VERSION_ID
version of Id XMLs created by this builder: "1.0".

See Also:
Constant Field Values
Constructor Detail

IdBuilder

public IdBuilder()
create new IdBuilder.


IdBuilder

public IdBuilder(boolean printPretty)
create new IdBuilder with custom printPretty flag.

Parameters:
printPretty - printPretty flag
Method Detail

appendId

public org.w3c.dom.Element appendId(org.w3c.dom.Element element,
                                    Id id)
add an Id element for the given element as the final child. The Id element contains a xmlns:id specification for the SMILA Id namespace

Parameters:
element - DOM element to add the Id to
id - The record Id to add.
Returns:
the appended element

appendId

public org.w3c.dom.Element appendId(org.w3c.dom.Document document,
                                    Id id)
Append id.

Parameters:
id - the id
document - the document
Returns:
the element

appendIdList

public org.w3c.dom.Element appendIdList(org.w3c.dom.Element element,
                                        java.lang.Iterable<Id> idList)
add an IdList element containing Id elements for the Ids in the given list to the given element as the final child. The IdList element contains a xmlns:id specification for the SMILA Id namespace, the Id elements in the list depend on it being in the Id list element.

Parameters:
element - DOM element to add the Id list to
idList - The record Ids to add.
Returns:
the appended list element

appendIdList

public org.w3c.dom.Element appendIdList(org.w3c.dom.Element element,
                                        Id[] idList)
add an IdList element containing Id elements for the Ids in the given list to the given element as the final child. The IdList element contains a xmlns:id specification for the SMILA Id namespace, the Id elements in the list depend on it being in the Id list element.

Parameters:
element - DOM element to add the Id list to
idList - The record Ids to add.
Returns:
the appended list element

idToString

public java.lang.String idToString(Id id)
                            throws javax.xml.parsers.ParserConfigurationException,
                                   java.io.IOException
Creates an xml string representation of the given id.

Parameters:
id - the Id
Returns:
the xml String
Throws:
javax.xml.parsers.ParserConfigurationException - if any error occurs
java.io.IOException - if any error occurs

SMILA (incubation) API documentation