com.softwareag.mdm.schema
Interface SchemaNode


public interface SchemaNode

Represents an element declaration in the resolved schema.


Method Summary
 Object createNewOccurrence()
          Creates a new Java object that depends on this node definition.
 Object executeRead(Object aContainerOccurrence)
          Reads an occurrence of the parent node so as to return the value corresponding to this node.
 String formatToXsString(Object anOccurrence)
          Returns the string that corresponds to the occurrence object specified.
 Object getDefaultValue()
          Returns the default value that is defined in schema (attribute xs:default), or null if no value is specified.
 String getDescription(Locale aLocale)
          Returns the localized description defined in schema.
 List getEnumerationList(ValueContext aContext)
          Looks for an enumeration of values that may be taken by this node.
 Nomenclature getEnumerationNomenclature(ValueContext aContext)
          Looks for an underlying Nomenclature.
 String getLabel(Locale aLocale)
          Returns the localized label defined in schema.
 UserMessage getMandatoryUserMessage()
          Returns the mandatory error message (defined by schema element mdm:mandatoryErrorMessage).
 int getMaxOccurs()
          Returns the value of xs:maxOccurs.
 int getMinOccurs()
          Returns the value of xs:minOccurs.
 SchemaNode getNode(Path aPath)
          Returns the node at the path specified, or null if no node exists at the path specified.
 SchemaNode getNode(Path aPath, boolean isTolerantRead, boolean absolutePathBeginsAtOccurrenceRoot)
          Returns the node at the path specified.
 SchemaNode[] getNodeChildren()
          Returns the schema nodes defined directly under this node.
 Class getOccurrencesJavaClass()
          Returns the default Class of the Java occurrences of this schema node, null if this node is above a terminal node.
 Path getPathInAdaptation()
          Returns the local absolute path.
 Path getPathInSchema()
          Returns the full absolute path of this node in the schema.
 SchemaLocation getSchemaLocation()
          Returns the location of the schema that defines this node.
 SchemaNode getTableOccurrenceRootNode()
          For a table node (see method isTableNode()), returns the root node of the occurrences' structure.
 SchemaTypeName getXsTypeName()
          Returns the type name of this node, or null if this node is associated to an anonymous type definition.
 boolean isComplex()
          Returns true if this node is a complex element declaration.
 boolean isSelectNode()
          Returns true if this node is a select node.
 boolean isTableNode()
          Returns true if this node is a table node.
 boolean isTableOccurrenceNode()
          Returns true if this node is in a table occurrence.
 boolean isTerminalValue()
          Returns true if this node is adaptation terminal.
 boolean isTerminalValueDescendant()
          Returns true if this node is the descendant of a terminal value node.
 boolean isValueEqual(Object aFirstValue, Object aSecondValue)
          Returns true if values specified are equal, according to the underlying XML Schema type.
 boolean isValueLessOrEqualTo(Object aFirstValue, Object aSecondValue)
          Returns true if first value is less than or equal to the second value, according to the underlying XML Schema type.
 boolean isValueStrictlyLessThan(Object aFirstValue, Object aSecondValue)
          Returns true if first value is stricty less than the second value, according to the underlying XML Schema type.
 Object parseXsString(String aString)
          Returns the value that corresponds to the string specified.
 

Method Detail

getMinOccurs

public int getMinOccurs()
Returns the value of xs:minOccurs.


getMaxOccurs

public int getMaxOccurs()
Returns the value of xs:maxOccurs.


getPathInAdaptation

public Path getPathInAdaptation()
Returns the local absolute path.

In a table occurrence, the local absolute path is the path that starts from the table root node (without including it), otherwise it is the one starting from the instance root node (including it). In the later case it is the same as getPathInSchema().

See Also:
getPathInSchema()

getPathInSchema

public Path getPathInSchema()
Returns the full absolute path of this node in the schema.

See Also:
getPathInAdaptation()

isComplex

public boolean isComplex()
Returns true if this node is a complex element declaration.


isValueEqual

public boolean isValueEqual(Object aFirstValue,
                            Object aSecondValue)
Returns true if values specified are equal, according to the underlying XML Schema type.

For example, if the underlying type is xs:date, both occurrences specified must be Date instances. In addition, equality checking will not take into account the hours, minutes, etc. of the Java Date. However a xs:dateTime type would take into account hours and minutes.

Throws:
ClassCastException - if a specified value is not an instance of underlying type.

isValueLessOrEqualTo

public boolean isValueLessOrEqualTo(Object aFirstValue,
                                    Object aSecondValue)
Returns true if first value is less than or equal to the second value, according to the underlying XML Schema type.

Throws:
UnsupportedOperationException - if underlying type does not support comparison.
ClassCastException - if a specified value is not an instance of underlying type.

isValueStrictlyLessThan

public boolean isValueStrictlyLessThan(Object aFirstValue,
                                       Object aSecondValue)
Returns true if first value is stricty less than the second value, according to the underlying XML Schema type.

Throws:
UnsupportedOperationException - if underlying type does not support comparison.
ClassCastException - if a specified value is not an instance of underlying type.

isTerminalValue

public boolean isTerminalValue()
Returns true if this node is adaptation terminal.

An adaptation terminal node is a node that holds a Java value in adaptation instances and this value can be inherited.

A node is terminal when:

See Also:
isTerminalValueDescendant()

isTerminalValueDescendant

public boolean isTerminalValueDescendant()
Returns true if this node is the descendant of a terminal value node.

See Also:
isTerminalValue()

isTableNode

public boolean isTableNode()
Returns true if this node is a table node.

A table root is specified in schema by means of mdm:table declaration (see Table definition).

See Also:
getTableOccurrenceRootNode()

isSelectNode

public boolean isSelectNode()
Returns true if this node is a select node.

A select node is specified in schema by means of mdm:select extension.


getTableOccurrenceRootNode

public SchemaNode getTableOccurrenceRootNode()
For a table node (see method isTableNode()), returns the root node of the occurrences' structure.

This method is needed for accessing to the internal structure of a table.

Explanation: Since a table node is considered as a terminal node, it does not provide a direct access to the table node children. Instead those children can only be accessed through the root node of the occurrences' structure (the object returned by this method).

Returns:
null if this node is not a table node, the root node of the occurrences' structure otherwise.
See Also:
isTableNode()

isTableOccurrenceNode

public boolean isTableOccurrenceNode()
Returns true if this node is in a table occurrence.


getEnumerationList

public List getEnumerationList(ValueContext aContext)
Looks for an enumeration of values that may be taken by this node. It is searched through facets in the underlying schema. Returns the list of possible values as defined by enumeration facet.

If a nomenclature facet is defined, it returns the selection of its values.

Returns:
null if no enumeration facet is defined on the schema.

getEnumerationNomenclature

public Nomenclature getEnumerationNomenclature(ValueContext aContext)
Looks for an underlying Nomenclature. It is searched through facets. If no nomenclature is found, it returns null.

Returns:
null if no nomenclature facet is defined on the schema.

getDefaultValue

public Object getDefaultValue()
Returns the default value that is defined in schema (attribute xs:default), or null if no value is specified.


getLabel

public String getLabel(Locale aLocale)
Returns the localized label defined in schema.


getDescription

public String getDescription(Locale aLocale)
Returns the localized description defined in schema.


getMandatoryUserMessage

public UserMessage getMandatoryUserMessage()
Returns the mandatory error message (defined by schema element mdm:mandatoryErrorMessage).


getNode

public SchemaNode getNode(Path aPath)
Returns the node at the path specified, or null if no node exists at the path specified.

If path is relative, it is interpreted regarding this node location. This method is equivalent as getNode(aPath, true, false).

See Also:
getPathInSchema()

getNode

public SchemaNode getNode(Path aPath,
                          boolean isTolerantRead,
                          boolean absolutePathBeginsAtOccurrenceRoot)
                   throws PathAccessException
Returns the node at the path specified.

Parameters:
aPath - if relative, it is interpreted regarding this node location.
isTolerantRead - if true, returns null when no node exists at the location specified; otherwise it throws PathAccessException.
absolutePathBeginsAtOccurrenceRoot - if true and aPath is absolute and this node is in a table, then the path root is the table root node.
Throws:
PathAccessException - if no node exists at the path specified and isTolerantRead is false.

getNodeChildren

public SchemaNode[] getNodeChildren()
Returns the schema nodes defined directly under this node. A terminal node returns an empty array (see isTerminalValue()). As a table node is also considered as a terminal node, it will also return an empty array (for getting the structure of the table, it is necessary to use method getTableOccurrenceRootNode())


getSchemaLocation

public SchemaLocation getSchemaLocation()
Returns the location of the schema that defines this node.


getXsTypeName

public SchemaTypeName getXsTypeName()
Returns the type name of this node, or null if this node is associated to an anonymous type definition.


formatToXsString

public String formatToXsString(Object anOccurrence)
Returns the string that corresponds to the occurrence object specified. This method uses the underlying XML Schema type for performing the Object-to-String conversion.

For example, if the underlying type is xs:date, the occurrence specified must be a Date instance and this method will return the XML Schema representation of this date.

See Also:
parseXsString(String)

parseXsString

public Object parseXsString(String aString)
Returns the value that corresponds to the string specified. This method uses the underlying XML Schema type for performing the String-to-Object conversion.

For example, if the underlying type is xs:date, the string must conform to the XML Schema representation of dates (eg "1999-05-31") and this method returns a Date instance.

See Also:
formatToXsString(Object)

getOccurrencesJavaClass

public Class getOccurrencesJavaClass()
Returns the default Class of the Java occurrences of this schema node, null if this node is above a terminal node.

See Also:
isTerminalValue()

createNewOccurrence

public Object createNewOccurrence()
Creates a new Java object that depends on this node definition.

The returned value is in conformity with the following rules:


executeRead

public Object executeRead(Object aContainerOccurrence)
Reads an occurrence of the parent node so as to return the value corresponding to this node.

Use example

The parent element has maxOccurs > 1 and it refers to a complex content. Hence, the parent value will be a Java List of Java objects. For each object in the list, this method is able to get the value that is associated to this child node.

Precondition

The parent element must be a terminal value (see isTerminalValue()) or the descendant of a terminal value.

Parameters:
aContainerOccurrence - must be an instance (in XML Schema meaning) of the parent node.


(report a bug)
webMethods MDM 4.2.8 [0558]
Copyright Software AG 2000-2007. All rights reserved.