com.onwbp.adaptation
Class ReadContext

java.lang.Object
  extended bycom.onwbp.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)
          Deprecated. Client code should call either SchemaNode.formatToXsString(Object) or SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).
 String formatValue(Path path, String ignored)
          Deprecated. Client code should call either SchemaNode.formatToXsString(Object) or SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).
 List formatValues(Path path)
          Deprecated. Client code should call, on each element of the List value, either SchemaNode.formatToXsString(Object) or SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).
 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)
          Deprecated. Replaced by SchemaNode.getDescription(Locale).
 String getLabel(Path aPath)
          Deprecated. Replaced by SchemaNode.getLabel(Locale).
 List getList(Path aPath)
          Returns the List value of the node specified.
 Locale getLocale()
          Deprecated. Historically was linked to a locale. This is no more the case.
 String getNomenclatureItemLabel(Path path, String aFormattedValue)
          Deprecated. Replaced by SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).
 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
Deprecated. Client code should call either SchemaNode.formatToXsString(Object) or SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).

Throws:
PathAccessException

formatValue

public String formatValue(Path path,
                          String ignored)
Deprecated. Client code should call either SchemaNode.formatToXsString(Object) or SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).


formatValues

public List formatValues(Path path)
Deprecated. Client code should call, on each element of the List value, either SchemaNode.formatToXsString(Object) or SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).

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.orchestranetworks.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.orchestranetworks.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.orchestranetworks.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.orchestranetworks.schema.Path)

getDescription

public String getDescription(Path aPath)
                      throws PathAccessException
Deprecated. Replaced by SchemaNode.getDescription(Locale).

Throws:
PathAccessException

getLabel

public String getLabel(Path aPath)
                throws PathAccessException
Deprecated. Replaced by SchemaNode.getLabel(Locale).

Throws:
PathAccessException

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.orchestranetworks.schema.Path)

getLocale

public Locale getLocale()
Deprecated. Historically was linked to a locale. This is no more the case.


getNomenclatureItemLabel

public String getNomenclatureItemLabel(Path path,
                                       String aFormattedValue)
Deprecated. Replaced by SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale).


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.orchestranetworks.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 ebx.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)
EBX.Platform 4.5.3 [0607:0001]
Copyright Orchestra Networks 2000-2008. All rights reserved.