com.ibm.di.connector.maximo.parsing
Class SchemaElement

java.lang.Object
  extended by com.ibm.di.connector.maximo.parsing.SchemaElement

public final class SchemaElement
extends java.lang.Object

This class represents the structural elements that compose a schema object and contains all the metadata.

Since:
7.1
See Also:
Schema, SchemaConfiguration

Method Summary
 void addChild(SchemaElement child)
          Adds a child schema element.
static SchemaElement buildElement(SchemaElement parent, java.lang.String name, boolean attribute, boolean uniqueKey)
          Builds a schema element object.
static SchemaElement buildRootElement(java.lang.String name)
          Builds a root schema element object.
 boolean containsChild(java.lang.String name)
          Returns true if this schema element contains a child element for the specified name.
 java.lang.StringBuilder dumpElements(java.lang.StringBuilder b)
          Dumps all the structure in a StringBuilder object.
 java.lang.StringBuilder dumpElements(java.lang.StringBuilder b, java.lang.String tabs, boolean inclAttributes)
          Dumps all the structure in a StringBuilder object (not including attributes)
 SchemaElement getChild(java.lang.String name)
          Returns the child schema element for the specified name.
 java.util.List<SchemaElement> getChildren()
          Returns a list of all schema element children.
 java.lang.String getClassName()
          Returns this schema element's class name.
 java.lang.String getEntryPathRelativeTo(SchemaElement e)
          Returns a String object representing the path to this schema element in the context of hierarchical entry.
 SchemaElement getFirstChild()
          Returns the first child schema element.
 java.lang.String getName()
          Returns this schema element's name.
 SchemaElement getParent()
          Returns the parent element.
 java.lang.String getPath()
          Returns a String object representing the path to this schema element starting from the root element.
 java.lang.String getPathRelativeTo(SchemaElement e)
          Returns a String object representing the path to this schema element in the hierarchical structure.
 java.lang.Integer getSize()
          Returns this schema element's maximum size.
 java.util.List<SchemaElement> getUniqueKeyList()
          Returns a list of elements defined as unique key.
 boolean isAttribute()
          Indicates if this schema element represents an XML attribute.
 boolean isMboDefinition()
          Indicates if this element represents a MBO definition (i.e if at least one child is not an attribute).
 boolean isUniqueKey()
          Indicates if this element represents an unique key.
 void setClassName(java.lang.String className)
          Defines this schema element's class name.
 void setSize(java.lang.Integer size)
          Defines this schema element's maximum size.
 java.lang.String toString()
          
 java.lang.String toString(java.lang.Object value)
          Returns a String object representing the specified value , according to this schema element's class name.
 java.lang.Object valueOf(java.lang.String value)
          Converts the specified String value, according to this schema element's class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

buildElement

public static SchemaElement buildElement(SchemaElement parent,
                                         java.lang.String name,
                                         boolean attribute,
                                         boolean uniqueKey)
Builds a schema element object.

Parameters:
parent - parent schema element
name - schema element's name
attribute - true if this schema element represents an XSD attribute, otherwise false
uniqueKey - true if this element represents an unique key, otherwise false
Returns:
a new schema element

buildRootElement

public static SchemaElement buildRootElement(java.lang.String name)
Builds a root schema element object.

Parameters:
name - schema element's name
Returns:
a new root schema element

addChild

public void addChild(SchemaElement child)
Adds a child schema element.

Parameters:
child - child schema element

containsChild

public boolean containsChild(java.lang.String name)
Returns true if this schema element contains a child element for the specified name.

Parameters:
name - name whose presence in this schema element is to be tested
Returns:
true if this schema element contains a child element for the specified name, otherwise false

dumpElements

public java.lang.StringBuilder dumpElements(java.lang.StringBuilder b)
Dumps all the structure in a StringBuilder object.

Parameters:
b - StringBuilder where the structure will be dumped
Returns:
StringBuilder with the dumped structure

dumpElements

public java.lang.StringBuilder dumpElements(java.lang.StringBuilder b,
                                            java.lang.String tabs,
                                            boolean inclAttributes)
Dumps all the structure in a StringBuilder object (not including attributes)

Parameters:
b - StringBuilder where the structure will be dumped
Returns:
StringBuilder with the dumped structure

getChild

public SchemaElement getChild(java.lang.String name)
Returns the child schema element for the specified name. Name is with the following format: DocRoot@com.ibm.maximo@UpdateMXASSET@MXASSETSet@ASSET#relationship , where relationship is an attribute name and the rest is the path.

Parameters:
name - name whose associated child is to be returned
Returns:
the child element for the specified name, or null if this schema element contains no child for the name
See Also:
containsChild(String)

getChildren

public java.util.List<SchemaElement> getChildren()
Returns a list of all schema element children.

Returns:
list of all schema element children

getClassName

public java.lang.String getClassName()
Returns this schema element's class name.

Returns:
this schema element's class name

getFirstChild

public SchemaElement getFirstChild()
Returns the first child schema element.

Returns:
the first child element, or null if this schema element contains no child

getName

public java.lang.String getName()
Returns this schema element's name.

Returns:
this schema element's name.

getParent

public SchemaElement getParent()
Returns the parent element.

Returns:
parent element

getPath

public java.lang.String getPath()
Returns a String object representing the path to this schema element starting from the root element.

Returns:
a String object representing the path to this schema element
See Also:
getPathRelativeTo(SchemaElement), getEntryPathRelativeTo(SchemaElement)

getPathRelativeTo

public java.lang.String getPathRelativeTo(SchemaElement e)
Returns a String object representing the path to this schema element in the hierarchical structure.

Below is a sample structure of schema elements.

 root (root)
 |
 +--child_A (root@child_A)
 |  |
 |  +--child_A1 (root@child_A@child_A1)
 |
 +--child_B (root@child_B)
 

Between parentheses is the resulting path to the respective schema element starting from the root.

Parameters:
e - element from which the path representation will be built
Returns:
a String object representing the path to this schema element

getEntryPathRelativeTo

public java.lang.String getEntryPathRelativeTo(SchemaElement e)
Returns a String object representing the path to this schema element in the context of hierarchical entry.

Below is a sample structure of schema elements.

 root (root)
 |
 +--child1 (root.child1)
 |  |
 |  +--child11 (root.child1.child11)
 |
 +--child2 (root.child2)
 

Between parentheses is the resulting path to the respective element starting from the root.

Parameters:
e - element from which the path representation will be built
Returns:
a String object representing the path to this schema element

getSize

public java.lang.Integer getSize()
Returns this schema element's maximum size.

Returns:
this schema element's maximum size

getUniqueKeyList

public java.util.List<SchemaElement> getUniqueKeyList()
Returns a list of elements defined as unique key.

Returns:
list of elements defined as unique key

isAttribute

public boolean isAttribute()
Indicates if this schema element represents an XML attribute.

Returns:
true if this schema element represents an XSD attribute, otherwise false

isMboDefinition

public boolean isMboDefinition()
Indicates if this element represents a MBO definition (i.e if at least one child is not an attribute).

Returns:
true if this element represents a MBO definition, otherwise false

isUniqueKey

public boolean isUniqueKey()
Indicates if this element represents an unique key.

Returns:
true if this element represents an unique key, otherwise false

setClassName

public void setClassName(java.lang.String className)
Defines this schema element's class name. The class name is used in type conversion and validation.

Any class name is acceptable, but only these can be used in type conversion and validation:

If the class name is different than those, it will be treated as java.lang.String.

Parameters:
className - this schema element's class name
See Also:
valueOf(String), #toString(Object, boolean)

setSize

public void setSize(java.lang.Integer size)
Defines this schema element's maximum size.

Parameters:
size - this schema element's maximum size

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.Object value)
                          throws MxConnTypeConvertionException
Returns a String object representing the specified value , according to this schema element's class name.

Parameters:
value - value to be converted
Returns:
String object representing the specified value, or null if value is null
Throws:
MxConnTypeConvertionException - if the specified value can not be converted

valueOf

public java.lang.Object valueOf(java.lang.String value)
                         throws MxConnTypeConvertionException
Converts the specified String value, according to this schema element's class name.

Parameters:
value - value to be converted
Returns:
value converted
Throws:
MxConnTypeConvertionException - if the specified value can not be converted