planetj.dataengine
Class AbstractContext

java.lang.Object
  |
  +--planetj.dataengine.AbstractContext
All Implemented Interfaces:
Cloneable, IContext, INavigationObject, Serializable
Direct Known Subclasses:
HTMLContext, JavaContext, SQLContext

public abstract class AbstractContext
extends Object
implements Serializable, Cloneable, INavigationObject, IContext

!!DA (6/11/2003 8:06:21 AM) documentation needed

Author:
PlanetJ Corporation
See Also:
Serialized Form

Field Summary
static String className
          Class name.
static int DEFAULT_TYPE
          Default type for parameter values.
static String PARAM_ESCAPE_NUMBERED
           
static String PARAM_ESCAPE_TABLE
           
static String PARAM_ESCAPE_USAGE_ID
           
static String PARAM_ESCAPE_USER
           
static String PARAM_ESCAPE_USER_USAGE_ID
           
static String PARAM_NUMBERED
           
static String PARAM_TABLE
           
static String PARAM_USAGE_ID
           
static String PARAM_USER
           
static String PARAM_USER_USAGE_ID
           
 
Constructor Summary
AbstractContext()
          AbstractContext constructor comment.
AbstractContext(IUser user)
          AbstractContext constructor comment.
 
Method Summary
 void clear()
          Wipes out info in this context, restoring the default values.
 void clearParameterValues()
          Clears all the parameter values for this context, as well as any validation exceptions.
 Object clone()
          Creates an unlocked copy of this context.
static boolean equals(Object one, Object two)
           
abstract  Object execute()
          Executes this context.
 String getCode()
          Gets this context's code string.
 long getDataTimestamp()
          Gets the time when the data in this context was read from its source.
 Iterator getDisplayParameters()
          Iterates over the parameters in this context which should be displayed to the user.
 ExecutingContext getExecutingContext()
          Gets this context's executing context.
 String getNavigationKey()
          Get the key used to store/retrieve this Row to/from navigation.
 String getNavigationListKey()
          Get the key used to store and retrieve a List of Rows that have been put into navigation.
 String getOriginalCode()
          Gets this context's original code string.
 IParameter getParameter(int index)
          Gets a parameter, based on its index
 IParameter getParameter(String uniqueId)
          Gets a parameter by its unique id, or by its context specific id
 ParameterCollection getParameterCollection()
          Gets the ParameterCollection which contains this context's parameters
 int getParameterCount()
          Gets the number of parameters present in this context
 int getParameterCount(Class paramClass)
          Gets the number of parameters present in this context which are of the specified class (or are subclasses of the specified class)
 Iterator getParameterDisplayFields()
          Deprecated. (6/11/2003 8:01:23 AM) This method will not allow setting the Field's default value from a user property. Replaced by getParameterDisplayFields(ExecutingContext)
 Iterator getParameterDisplayFields(ExecutingContext ec)
          Gets an Iterator for all of the display fields for this context's display parameters.
 List getParameters()
          Gets a List of this context's IParameter objects.
 Iterator getParameters(Class paramType)
          Iterates over the parameters in this context which are compatable with the specified Java type
 Row getParameterSource()
          Gets the row that was used to set the named parameters in this context, or null if no such row exists.
 ValidationExceptionCollection getParameterValidationExceptions()
          Be careful when you call this method because it is derived and spins through all the fields.
 PropertyGroup getPropertyGroup(String groupName)
          Gets the first PropertyGroup with the given property group name.
abstract  PropertyGroupList getPropertyGroups()
          Get all the property groups associated with this context.
 List getPropertyGroups(String groupName)
          Get this RowCollection's property groups with the given group name.
 Iterator getRowParameters()
          Gets an Iterator for iterating over this context's RowParameter objects
 boolean isCloneNeeded()
          Test to see if tiis navigation object should be clone upon storing and retrieving.
 boolean isContainsDisplayParameters()
          Tests if there are any parameters which should be displayed
 boolean isContainsParameters(Class paramType)
          Tests if this context contains any parameters which are of the specified Java type, or are subclasses of the specified Java type.
 boolean isLocked()
          Check to see if this context is locked.
 boolean isParameterized()
          Check if this context code is parameterized.
 void loadUserAndExecutingContextValues()
          When this method is invoked, values are taken from the user object and executing context and set on the appropriate Parameters.
 void loadUserValues()
          Deprecated. Use loadUserAndExecutingContextValues instead
 void lock()
          Locks this context, preventing its state from being altered.
 void parameterAltered()
          Callback method so that parameters can inform their context when they are alerted
 void removeNavigationKey()
          Clears out any navigation key that may have been set on this Row.
 void setCode(String code)
          Sets this context's code string.
 void setCode(String code, boolean shadowize)
          Sets this context's code string.
 void setDataTimestamp(long timestamp)
          Sets the time when the data in this context was read from its source.
 void setExecutingContext(ExecutingContext excontext)
          Sets this context's executing context.
 void setNavigationKey(String key)
          Set the key used to store/retrieve this Row to/from navigation.
 void setParameterCollection(ParameterCollection newParameters)
          Sets the ParameterCollection which contains this context's parameters.
 void setParameterDisplayValues(Row row)
          Provides values for all of this context's display parameters.
 void setParameterValue(int position, int value)
          Provides a value to a parameter for this context's code string.
 void setParameterValue(int position, Object value)
          Provides a value to a parameter for this context's code string.
 void setParameterValues(Row row)
          Provides values for all of this context's RowParameters and ContextParameterParameters.
 void setParameterValues(String parameterId, Object value)
          Sets the value of parameters in this context
 String toString()
          Gets a String representation of this context
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

className

public static final String className
Class name.


PARAM_USER

public static final String PARAM_USER
See Also:
Constant Field Values

PARAM_NUMBERED

public static final String PARAM_NUMBERED
See Also:
Constant Field Values

PARAM_USAGE_ID

public static final String PARAM_USAGE_ID
See Also:
Constant Field Values

PARAM_USER_USAGE_ID

public static final String PARAM_USER_USAGE_ID
See Also:
Constant Field Values

PARAM_TABLE

public static final String PARAM_TABLE
See Also:
Constant Field Values

PARAM_ESCAPE_USER

public static final String PARAM_ESCAPE_USER
See Also:
Constant Field Values

PARAM_ESCAPE_NUMBERED

public static final String PARAM_ESCAPE_NUMBERED
See Also:
Constant Field Values

PARAM_ESCAPE_USAGE_ID

public static final String PARAM_ESCAPE_USAGE_ID
See Also:
Constant Field Values

PARAM_ESCAPE_USER_USAGE_ID

public static final String PARAM_ESCAPE_USER_USAGE_ID
See Also:
Constant Field Values

PARAM_ESCAPE_TABLE

public static final String PARAM_ESCAPE_TABLE
See Also:
Constant Field Values

DEFAULT_TYPE

public static final int DEFAULT_TYPE
Default type for parameter values.

See Also:
Constant Field Values
Constructor Detail

AbstractContext

public AbstractContext()
AbstractContext constructor comment.


AbstractContext

public AbstractContext(IUser user)
AbstractContext constructor comment.

Method Detail

clear

public void clear()
           throws DataEngineException
Wipes out info in this context, restoring the default values. If a subclass overrides this method, they need to make sure they call the super method to allow clearing parameter values and names. They don't need to check if the context is locked because the super's method will do so.

DataEngineException

clearParameterValues

public void clearParameterValues()
                          throws CMException
Clears all the parameter values for this context, as well as any validation exceptions.

CMException

clone

public Object clone()
Creates an unlocked copy of this context.

Specified by:
clone in interface INavigationObject
Overrides:
clone in class Object

equals

public static final boolean equals(Object one,
                                   Object two)

execute

public abstract Object execute()
                        throws CMException
Executes this context. Their may or may not be any results returned. If their are no results after execution, then null is returned.

CMException

getCode

public String getCode()
Gets this context's code string.


getDataTimestamp

public long getDataTimestamp()
Gets the time when the data in this context was read from its source. Long.MIN_VALUE is returned if the value is not known.


getDisplayParameters

public Iterator getDisplayParameters()
Iterates over the parameters in this context which should be displayed to the user. The Iterator cannot not be altered.

Specified by:
getDisplayParameters in interface IContext

getExecutingContext

public ExecutingContext getExecutingContext()
Gets this context's executing context.

Specified by:
getExecutingContext in interface IContext

getNavigationKey

public String getNavigationKey()
Get the key used to store/retrieve this Row to/from navigation.

Specified by:
getNavigationKey in interface INavigationObject

getNavigationListKey

public String getNavigationListKey()
Get the key used to store and retrieve a List of Rows that have been put into navigation. If any subclasses need to be grouped separate, they can override this method and specify their own navigation list key.

Specified by:
getNavigationListKey in interface INavigationObject

getOriginalCode

public String getOriginalCode()
Gets this context's original code string.

Specified by:
getOriginalCode in interface IContext

getParameter

public IParameter getParameter(int index)
Gets a parameter, based on its index

Specified by:
getParameter in interface IContext

getParameter

public IParameter getParameter(String uniqueId)
Gets a parameter by its unique id, or by its context specific id

Specified by:
getParameter in interface IContext

getParameterCollection

public ParameterCollection getParameterCollection()
Gets the ParameterCollection which contains this context's parameters


getParameterCount

public int getParameterCount()
Gets the number of parameters present in this context

Specified by:
getParameterCount in interface IContext

getParameterCount

public int getParameterCount(Class paramClass)
Gets the number of parameters present in this context which are of the specified class (or are subclasses of the specified class)

Specified by:
getParameterCount in interface IContext

getParameterDisplayFields

public Iterator getParameterDisplayFields()
Deprecated. (6/11/2003 8:01:23 AM) This method will not allow setting the Field's default value from a user property. Replaced by getParameterDisplayFields(ExecutingContext)

Gets an Iterator for all of the display fields for this context's display parameters.

Returns:
iterator of Field's.

getParameterDisplayFields

public Iterator getParameterDisplayFields(ExecutingContext ec)
Gets an Iterator for all of the display fields for this context's display parameters.

Parameters:
ec - current context in which code is executing.
Returns:
iterator of Field's.

getParameters

public List getParameters()
Gets a List of this context's IParameter objects. The list cannot be altered

Specified by:
getParameters in interface IContext

getParameters

public Iterator getParameters(Class paramType)
Iterates over the parameters in this context which are compatable with the specified Java type

Specified by:
getParameters in interface IContext

getParameterSource

public Row getParameterSource()
Gets the row that was used to set the named parameters in this context, or null if no such row exists.


getParameterValidationExceptions

public ValidationExceptionCollection getParameterValidationExceptions()
Be careful when you call this method because it is derived and spins through all the fields. This will return a collection of al the Exceptions of each field.

Specified by:
getParameterValidationExceptions in interface IContext

getPropertyGroup

public PropertyGroup getPropertyGroup(String groupName)
Gets the first PropertyGroup with the given property group name.

Specified by:
getPropertyGroup in interface IContext

getPropertyGroups

public abstract PropertyGroupList getPropertyGroups()
Get all the property groups associated with this context.

Specified by:
getPropertyGroups in interface IContext

getPropertyGroups

public List getPropertyGroups(String groupName)
Get this RowCollection's property groups with the given group name.

Specified by:
getPropertyGroups in interface IContext

getRowParameters

public Iterator getRowParameters()
Gets an Iterator for iterating over this context's RowParameter objects


isCloneNeeded

public boolean isCloneNeeded()
Description copied from interface: INavigationObject
Test to see if tiis navigation object should be clone upon storing and retrieving.

Specified by:
isCloneNeeded in interface INavigationObject

isContainsDisplayParameters

public boolean isContainsDisplayParameters()
Tests if there are any parameters which should be displayed


isContainsParameters

public boolean isContainsParameters(Class paramType)
Tests if this context contains any parameters which are of the specified Java type, or are subclasses of the specified Java type.


isLocked

public boolean isLocked()
Check to see if this context is locked. If locked, it cannot cannot be altered.


isParameterized

public boolean isParameterized()
Check if this context code is parameterized.


loadUserAndExecutingContextValues

public void loadUserAndExecutingContextValues()
                                       throws DataEngineException
When this method is invoked, values are taken from the user object and executing context and set on the appropriate Parameters.

DataEngineException

loadUserValues

public void loadUserValues()
                    throws DataEngineException
Deprecated. Use loadUserAndExecutingContextValues instead

When this method is invoked, values are taken from the user object and set on any UserParameters.

DataEngineException

lock

public void lock()
Locks this context, preventing its state from being altered. Once locked, it cannot be unlocked.


parameterAltered

public void parameterAltered()
                      throws DataEngineException
Callback method so that parameters can inform their context when they are alerted

Specified by:
parameterAltered in interface IContext
DataEngineException

removeNavigationKey

public void removeNavigationKey()
Clears out any navigation key that may have been set on this Row.

Specified by:
removeNavigationKey in interface INavigationObject

setCode

public void setCode(String code)
Sets this context's code string.


setCode

public void setCode(String code,
                    boolean shadowize)
Sets this context's code string.


setDataTimestamp

public void setDataTimestamp(long timestamp)
Sets the time when the data in this context was read from its source. This is an internal DataEngine method and should not be invoked by other applications


setExecutingContext

public void setExecutingContext(ExecutingContext excontext)
Sets this context's executing context.

Specified by:
setExecutingContext in interface IContext

setNavigationKey

public void setNavigationKey(String key)
Set the key used to store/retrieve this Row to/from navigation.

Specified by:
setNavigationKey in interface INavigationObject

setParameterCollection

public void setParameterCollection(ParameterCollection newParameters)
Sets the ParameterCollection which contains this context's parameters. All existing parameters and their values are lost


setParameterDisplayValues

public void setParameterDisplayValues(Row row)
                               throws CMException
Provides values for all of this context's display parameters. For each display parameter, if the Row contains a field with the same name as the parameter's column name, then that Field's value is used to set that parameter.

CMException

setParameterValue

public void setParameterValue(int position,
                              int value)
                       throws CMException
Provides a value to a parameter for this context's code string. (If this context does not use parameters, then this method is irrelevant.)

Parameters:
position - The index of the parameter whose value is being supplied. The first parameter is 0, the second is 1, etc.
value - The value to give to the parameter.
CMException

setParameterValue

public void setParameterValue(int position,
                              Object value)
                       throws CMException
Provides a value to a parameter for this context's code string. (If this context does not use parameters, then this method is irrelevant.)

Parameters:
position - The index of the parameter whose value is being supplied. The first parameter is 0, the second is 1, etc.
value - The value to give to the parameter. This value may be null. After the value is passed to this method it must never be changed. If it is possible for this value to change, you should clone it and pass a clone which will not change to this method.
CMException

setParameterValues

public void setParameterValues(String parameterId,
                               Object value)
                        throws CMException
Sets the value of parameters in this context

Specified by:
setParameterValues in interface IContext
Parameters:
parameterId - A String which identifies the parameters whose values will be set. This String can either be a context specific id, a name, or by a named index. The context specific id looks like ¤3¿ or ¤0¿ The parameter name is the string corresponding to the parameter's key or column (e.g. BALANCE or VAL) A parameter name may correspond to multiple parameters, in which case all of these parameters will have their values set by this method The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2)
value - The value to set parameters to
CMException

setParameterValues

public void setParameterValues(Row row)
                        throws CMException
Provides values for all of this context's RowParameters and ContextParameterParameters. For each RowParameter, if the Row contains a field with the same name, then that Field's value is used to set that parameter. For each ConextParameterParameter, if the context contains the parameter number specified, its value is used.

Specified by:
setParameterValues in interface IContext
CMException

toString

public String toString()
Gets a String representation of this context

Overrides:
toString in class Object