Class SchemaElement
- java.lang.Object
-
- com.ibm.di.connector.maximo.parsing.SchemaElement
-
public final class SchemaElement extends java.lang.ObjectThis class represents the structural elements that compose aschemaobject and contains all the metadata.- Since:
- 7.1
- See Also:
Schema,SchemaConfiguration
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(SchemaElement child)Adds a child schema element.static SchemaElementbuildElement(SchemaElement parent, java.lang.String name, boolean attribute, boolean uniqueKey)Builds a schema element object.static SchemaElementbuildRootElement(java.lang.String name)Builds a root schema element object.booleancontainsChild(java.lang.String name)Returns true if this schema element contains a child element for the specified name.java.lang.StringBuilderdumpElements(java.lang.StringBuilder b)Dumps all the structure in aStringBuilderobject.java.lang.StringBuilderdumpElements(java.lang.StringBuilder b, java.lang.String tabs, boolean inclAttributes)Dumps all the structure in aStringBuilderobject (not including attributes)SchemaElementgetChild(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.StringgetClassName()Returns this schema element's class name.java.lang.StringgetEntryPathRelativeTo(SchemaElement e)Returns aStringobject representing the path to this schema element in the context of hierarchical entry.SchemaElementgetFirstChild()Returns the first child schema element.java.lang.StringgetName()Returns this schema element's name.SchemaElementgetParent()Returns the parent element.java.lang.StringgetPath()Returns aStringobject representing the path to this schema element starting from the root element.java.lang.StringgetPathRelativeTo(SchemaElement e)Returns aStringobject representing the path to this schema element in the hierarchical structure.java.lang.IntegergetSize()Returns this schema element's maximum size.java.util.List<SchemaElement>getUniqueKeyList()Returns a list of elements defined as unique key.booleanisAttribute()Indicates if this schema element represents an XML attribute.booleanisMboDefinition()Indicates if this element represents a MBO definition (i.e if at least one child is not an attribute).booleanisRequired()booleanisUniqueKey()Indicates if this element represents an unique key.voidsetClassName(java.lang.String className)Defines this schema element's class name.voidsetRequired(boolean required)voidsetSize(java.lang.Integer size)Defines this schema element's maximum size.java.lang.StringtoString()java.lang.StringtoString(java.lang.Object value)Returns aStringobject representing the specified value , according to this schema element's class name.java.lang.ObjectvalueOf(java.lang.String value)Converts the specifiedStringvalue, according to this schema element's class name.
-
-
-
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 elementname- schema element's nameattribute-trueif this schema element represents an XSD attribute, otherwisefalseuniqueKey-trueif this element represents an unique key, otherwisefalse- 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 aStringBuilderobject.- Parameters:
b-StringBuilderwhere the structure will be dumped- Returns:
StringBuilderwith the dumped structure
-
dumpElements
public java.lang.StringBuilder dumpElements(java.lang.StringBuilder b, java.lang.String tabs, boolean inclAttributes)Dumps all the structure in aStringBuilderobject (not including attributes)- Parameters:
b-StringBuilderwhere the structure will be dumped- Returns:
StringBuilderwith 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, whererelationshipis 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 aStringobject representing the path to this schema element starting from the root element.- Returns:
- a
Stringobject representing the path to this schema element - See Also:
getPathRelativeTo(SchemaElement),getEntryPathRelativeTo(SchemaElement)
-
getPathRelativeTo
public java.lang.String getPathRelativeTo(SchemaElement e)
Returns aStringobject 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
Stringobject representing the path to this schema element
-
getEntryPathRelativeTo
public java.lang.String getEntryPathRelativeTo(SchemaElement e)
Returns aStringobject 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
Stringobject 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:
trueif this schema element represents an XSD attribute, otherwisefalse
-
isMboDefinition
public boolean isMboDefinition()
Indicates if this element represents a MBO definition (i.e if at least one child is not an attribute).- Returns:
trueif this element represents a MBO definition, otherwisefalse
-
isUniqueKey
public boolean isUniqueKey()
Indicates if this element represents an unique key.- Returns:
trueif this element represents an unique key, otherwisefalse
-
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:
- boolean or java.lang.Boolean
- intor integer or java.lang.Integer
- long or java.lang.Long
- double or java.lang.Double
- java.lang.String
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:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.Object value) throws MxConnTypeConvertionExceptionReturns aStringobject representing the specified value , according to this schema element's class name.- Parameters:
value- value to be converted- Returns:
Stringobject representing the specified value, ornullif value isnull- Throws:
MxConnTypeConvertionException- if the specified value can not be converted
-
valueOf
public java.lang.Object valueOf(java.lang.String value) throws MxConnTypeConvertionExceptionConverts the specifiedStringvalue, 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
-
isRequired
public boolean isRequired()
-
setRequired
public void setRequired(boolean required)
-
-