com.softwareag.mdm.adaptation
Class ReadContext

java.lang.Object
  extended bycom.softwareag.mdm.adaptation.ReadContext
Direct Known Subclasses:
Adaptation

public abstract class ReadContext
extends Object

Provides a read-access facade to objects organized in a tree structure, this structure conforming to an underlying Adaptation Model (XML Schema document).

Access to a node:
Any node in the structure is accessed through a path: it is the path from the tree's root node up to the searched node.

Value of a node:
If defined, a node's value is indeed:

See Also:
XML Schema part 1


Field Summary
static String KEY
          Deprecated.  
 
Constructor Summary
ReadContext()
           
 
Method Summary
 String formatValue(Path path)
          Returns a user-friendly string that represents the value of the node specified.
 String formatValue(Path path, String formatPattern)
          Returns a user-friendly string that represents the value of the node specified.
 List formatValues(Path path)
          Deprecated.  
 boolean get_boolean(Path aPath)
          Returns the boolean value of the node specified.
 int get_int(Path aPath)
          Returns the int value of the node specified.
 Object get(Path aPath)
          Returns the value of the node specified.
 Date getDate(Path aPath)
          Returns the Date value of the node specified.
 String getDescription(Path aPath)
          Returns the description of the node specified.
 String getLabel(Path aPath)
          Returns the label of the node specified.
 List getList(Path aPath)
          Returns the List value of the node specified.
 Locale getLocale()
          Deprecated.  
 String getNomenclatureItemLabel(Path path, String aFormattedValue)
          Deprecated.  
 String getResourcePathInModule(Path aPath)
          Returns the path to the resource that is hold by the node specified.
 String getResourcePathWithModule(Path aPath)
          Returns the path (including module's path) to the resource that is hold by the node specified.
 String getString(Path aPath)
          Returns the String value of the node specified.
 AdaptationTable getTable(Path aPath)
          Returns the table instance hold by the node specified.
 boolean isEndUserDebug()
          Returns true if debug mode is activated for current module.
abstract  void toHtmlString(Writer aWriter)
          For debugging purpose, adds an HTML representation to the writer specified.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY

public static final String KEY
Deprecated.  

This field is replaced by methods of ServletUtils.

See Also:
Constant Field Values
Constructor Detail

ReadContext

public ReadContext()
Method Detail

formatValue

public String formatValue(Path path)
                   throws PathAccessException
Returns a user-friendly string that represents the value of the node specified.

The format used is either the specific format defined on type node or by default the one defined in formatting policy.

Throws:
PathAccessException
See Also:
get(com.softwareag.mdm.schema.Path)

formatValue

public String formatValue(Path path,
                          String formatPattern)
Returns a user-friendly string that represents the value of the node specified.

The string is generated according to the format pattern specified in argument.


formatValues

public List formatValues(Path path)
Deprecated.  

Returns a list of user-friendly strings that represent the value of the node specified.

The node's value must be a List instance. This is the case when corresponding XML Schema element declaration defines attribute maxOccurs > 1.

The format used is either the specific format defined on type node or by default the one defined in formatting policy.

See Also:
getList(com.softwareag.mdm.schema.Path)

get

public Object get(Path aPath)
           throws PathAccessException
Returns the value of the node specified. Returns null if node has an undefined value.

If this method is called on an Adaptation, a lookup mechanism is used for retrieving the value (see Adaptation comment).

Warning: data updates

Any update on data must conform to Rule for updates.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
See Also:
Adaptation.getValueWithoutResolution(Path)

get_boolean

public boolean get_boolean(Path aPath)
                    throws PathAccessException
Returns the boolean value of the node specified. Returns false if no value is found.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not a boolean, meaning that underlying type node is not a boolean XML Schema type.
See Also:
get(com.softwareag.mdm.schema.Path)

get_int

public int get_int(Path aPath)
            throws PathAccessException
Returns the int value of the node specified. Returns 0 if no value is found.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not a int, meaning that underlying type node is not a integer XML Schema type.
See Also:
get(com.softwareag.mdm.schema.Path)

getDate

public Date getDate(Path aPath)
             throws PathAccessException
Returns the Date value of the node specified. Returns null if no value is found.

Warning: data updates

Any update on a date must conform to Rule for updates.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not a Date, meaning that underlying type node is not a date XML Schema type.
See Also:
get(com.softwareag.mdm.schema.Path)

getDescription

public String getDescription(Path aPath)
                      throws PathAccessException
Returns the description of the node specified. It is defined by description element content documentation element of corresponding node in underlying XML Schema.

Note : not yet internationalized.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.

getLabel

public String getLabel(Path aPath)
                throws PathAccessException
Returns the label of the node specified. It is defined by label element content documentation element of corresponding node in underlying XML Schema.

Note : not yet internationalized.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.

getList

public List getList(Path aPath)
             throws PathAccessException
Returns the List value of the node specified. Returns a new empty ArrayList if no value is found.

A node holds a List when, in XML Schema, corresponding node has been declared with maxOccurs > 1.

Warning: data updates

Any update on list must conform to Rule for updates.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not a List, meaning that underlying type node has not maxOccurs > 1 in XML Schema.
See Also:
get(com.softwareag.mdm.schema.Path)

getLocale

public Locale getLocale()
Deprecated.  


getNomenclatureItemLabel

public String getNomenclatureItemLabel(Path path,
                                       String aFormattedValue)
Deprecated.  

If node's type has a XML Schema facet enumeration and if aFormattedValue corresponds to an authorized value, this method returns the associated label.

See Also:
formatValue(com.softwareag.mdm.schema.Path)

getResourcePathInModule

public String getResourcePathInModule(Path aPath)
                               throws PathAccessException
Returns the path to the resource that is hold by the node specified. Returns null if node has an undefined value.

The returned path may be used as a parameter of ServletContext.getResource(java.lang.String) methods: it starts with a "/", just after web application's specific path (without including it).

For example:

         /www/images/logos/sample1.gif
         

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not an external resource, meaning that underlying type node is not a resource XML Schema type.

getResourcePathWithModule

public String getResourcePathWithModule(Path aPath)
                                 throws PathAccessException
Returns the path (including module's path) to the resource that is hold by the node specified. Returns null if node has an undefined value.

The path starts with a "/" and does include web application's specific path.

For example:

         /myWebAppPublicPath/www/fr_FR/images/logos/sample1.gif
         

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not an external resource, meaning that underlying type node is not a resource XML Schema type.
See Also:
ServletContext.getResource(java.lang.String)

getString

public String getString(Path aPath)
                 throws PathAccessException
Returns the String value of the node specified. Returns null if no value is found.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not a String, meaning that underlying type node is not a string XML Schema type.
See Also:
get(com.softwareag.mdm.schema.Path)

getTable

public AdaptationTable getTable(Path aPath)
                         throws PathAccessException
Returns the table instance hold by the node specified.

Throws:
PathAccessException - if aPath does not refer to an existing node in the underlying type tree structure.
ClassCastException - if node's value is not an instance of AdaptationTable, meaning that underlying type node is not declared as a table.
See Also:
AdaptationTable

isEndUserDebug

public boolean isEndUserDebug()
Returns true if debug mode is activated for current module. This mode is configured by property frontEnd.debugMode in file module.properties (default is on mdm.properties).


toHtmlString

public abstract void toHtmlString(Writer aWriter)
For debugging purpose, adds an HTML representation to the writer specified. The table displays hierarchically the values in this context.



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