IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.base
Class DataElement

java.lang.Object
  extended bycom.ibm.btt.base.DataElement
All Implemented Interfaces:
java.lang.Cloneable, DSECloneable, Externalizable, java.io.Externalizable, java.io.Serializable, TypedData
Direct Known Subclasses:
DataCollection, DataField

public abstract class DataElement
extends java.lang.Object
implements Externalizable, TypedData, DSECloneable

The DataElement class is the abstract base class to represent data.

See Also:
Serialized Form

Field Summary
protected  java.lang.String description
           
(package private) static Externalizer externalizer
           
protected  java.lang.String name
           
protected  Hashtable parameters
           
protected  ElementState state
           
 
Constructor Summary
DataElement()
           
 
Method Summary
abstract  java.lang.Object clone()
          This method must be implemented by the subclasses.
 Externalizer externalizer()
          Returns the externalizer instance of this class.
 java.lang.String getCompositeKey()
          Returns the compositeKey.
 java.lang.String getDescription()
          Returns the description of the data.
 PropertyDescription getDescriptor()
          Returns the PropertyDescriptor for this business object.
 DataElement getElementAt(java.lang.String aName)
          Throws an exception.
 ErrorInfo getErrorInfo()
          Returns the errorInfo property.
static Externalizer getExternalizer()
          Gets the externalizer.
 Key getKey()
          Returns a Key object which can be used to identify this business object.
 java.lang.String getName()
          Gets the name property (java.lang.String) value.
 java.lang.Object getParameter(java.lang.String parameterName)
          Returns the value of the element in the hashtable of parameters.
 Hashtable getParameters()
          Returns the Hashtable of parameters for this business object.
 ElementState getState()
          Gets the state property.
 java.lang.String getTagName()
          Gets a tag name.
abstract  java.lang.Object getValue()
          Returns the value of the data element.
 boolean isAmended()
          Returns true if the amended flag is activated and false otherwise.
 boolean isCached()
          Returns the isCached.
 boolean isSerializable()
           
abstract  Vector nestedElements()
          Returns all the DataElements included in a collection at any level.
abstract  void nestedElements(java.util.Hashtable theTable)
          Returns all the DataElements included in this collection at any level.
abstract  Vector nestedFields()
          Returns all the DataFields at any level included in a collection.
 void readExternal()
          Initializes a DataElement with its external value.
 void readExternal(java.io.ObjectInput s)
          Invokes the object creation from an ObjectInput.
static java.lang.Object readObject(java.lang.String name)
          Instantiates a DataElement named name from the definition file.
 DataElement removeElementAt(java.lang.String aName)
          Throws an exception.
 void removeExternal()
          Removes the tags for this object from the definition file in which it is externalized.
 void setAmended(boolean aValue)
          Sets the amended flag to aValue.
 void setCompositeKey(java.lang.String aCompositeKey)
          Sets the compositeKey.
 void setDescription(java.lang.String aDescription)
          Sets the value of description.
 void setDescriptor(PropertyDescription descriptor)
          Sets the PropertyDescriptor for this business object to that passed.
 void setErrorInfo(ErrorInfo anErrorInfo)
          Sets the errorInfo attribute.
static void setExternalizer(Externalizer anExternalizer)
          Sets the externalizer.
 void setIsCached(boolean cached)
          Sets the isCached.
 void setName(java.lang.String aName)
          Sets the name property (java.lang.String) value.
 void setParameter(java.lang.String parameterName, java.lang.Object parameterValue)
          Sets the value of the element in the Hashtable of paramaters.
 void setParameters(Hashtable theParameters)
          Sets the Hashtable of paramaters for this business object.
 void setSerializable(boolean b)
           
 void setState(ElementState aState)
          Sets the state property.
abstract  void setValue(java.lang.Object aValue)
          Throws an exception.
 Vector toStrings()
          Returns a visual representation of this data element.
 Vector toTags()
          Returns a Vector with the DataElement represented as a Tag.
 DataElement tryGetElementAt(java.lang.String aName)
          Returns null.
 java.lang.Object validate(java.lang.Object toValidate)
          Validates the object using its property descriptor.
abstract  java.lang.Object validate(java.lang.Object toValidate, java.lang.String convType)
          This method must be implemented by the subclasses.
 java.lang.Object validateObject(java.lang.Object toValidate)
          Validates an object using its validator directly without conversion.
 void writeExternal()
          Converts the instance into tags and writes the tags into a file.
 void writeExternal(java.io.ObjectOutput s)
          Provides concrete serialization handling for DataElement.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.btt.base.Externalizable
initializeFrom
 

Field Detail

name

protected java.lang.String name

description

protected java.lang.String description

externalizer

static Externalizer externalizer

state

protected ElementState state

parameters

protected Hashtable parameters
Constructor Detail

DataElement

public DataElement()
Method Detail

clone

public abstract java.lang.Object clone()
                                throws java.lang.CloneNotSupportedException
This method must be implemented by the subclasses.

Specified by:
clone in interface DSECloneable
Returns:
java.lang.Object
Throws:
java.lang.CloneNotSupportedException

externalizer

public Externalizer externalizer()
                          throws java.io.IOException
Returns the externalizer instance of this class.

Specified by:
externalizer in interface Externalizable
Returns:
com.ibm.btt.base.Externalizer
Throws:
java.io.IOException

getDescription

public java.lang.String getDescription()
Returns the description of the data.

Returns:
java.lang.String

getDescriptor

public PropertyDescription getDescriptor()
Returns the PropertyDescriptor for this business object.

Specified by:
getDescriptor in interface TypedData
Returns:
PropertyDescription

getElementAt

public DataElement getElementAt(java.lang.String aName)
                         throws DSEObjectNotFoundException
Throws an exception. Implemented in order to provide polymorphism.

Parameters:
aName - java.lang.String
Throws:
DSEObjectNotFoundException

getErrorInfo

public ErrorInfo getErrorInfo()
Returns the errorInfo property.

Returns:
com.ibm.btt.base.ErrorInfo

getExternalizer

public static Externalizer getExternalizer()
                                    throws java.io.IOException
Gets the externalizer.

Returns:
com.ibm.btt.base.Externalizer
Throws:
java.io.IOException

getKey

public Key getKey()
           throws DSETypeException
Returns a Key object which can be used to identify this business object. For business objects which are not Typed, of simple Type, or simply do not support unique Keys, a Key with a value of zero is returned.

Specified by:
getKey in interface TypedData
Returns:
Key
Throws:
DSETypeExceotion - - If key can not be build from this business object
DSETypeException - - If the key can not be built from this business object

getName

public java.lang.String getName()
Gets the name property (java.lang.String) value.

Specified by:
getName in interface Externalizable
Returns:
- The name property value
See Also:
setName(java.lang.String)

getParameter

public java.lang.Object getParameter(java.lang.String parameterName)
Returns the value of the element in the hashtable of parameters.

Parameters:
parameterName - String
Returns:
Object - The element value

getParameters

public Hashtable getParameters()
Returns the Hashtable of parameters for this business object.

Returns:
com.ibm.btt.base.Hashtable

getState

public ElementState getState()
Gets the state property.

Returns:
com.ibm.btt.base.types.ElementState

getTagName

public java.lang.String getTagName()
Gets a tag name.

Returns:
java.lang.String

getValue

public abstract java.lang.Object getValue()
Returns the value of the data element. It is an abstract method.

Returns:
java.lang.Object

isAmended

public boolean isAmended()
Returns true if the amended flag is activated and false otherwise.

Returns:
boolean

nestedElements

public abstract Vector nestedElements()
Returns all the DataElements included in a collection at any level.

Returns:
com.ibm.btt.base.Vector

nestedElements

public abstract void nestedElements(java.util.Hashtable theTable)
Returns all the DataElements included in this collection at any level.

Returns:
java.util.Hashtable

nestedFields

public abstract Vector nestedFields()
Returns all the DataFields at any level included in a collection.

Returns:
com.ibm.btt.base.Vector

readExternal

public void readExternal()
                  throws java.io.IOException
Initializes a DataElement with its external value. This instance requires an id (name). The externalizer and its tagInputStream are initialized.

Specified by:
readExternal in interface Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput s)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Invokes the object creation from an ObjectInput.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
s - java.io.ObjectInput
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readObject

public static java.lang.Object readObject(java.lang.String name)
                                   throws java.io.IOException
Instantiates a DataElement named name from the definition file.

Returns:
java.lang.Object
Throws:
java.io.IOException

removeElementAt

public DataElement removeElementAt(java.lang.String aName)
                            throws DSEObjectNotFoundException
Throws an exception. Implemented to provide polymorphism.

Parameters:
aName - java.lang.String
Returns:
com.ibm.btt.base.DataElement
Throws:
DSEObjectNotFoundException

removeExternal

public void removeExternal()
                    throws java.io.IOException
Removes the tags for this object from the definition file in which it is externalized.

Specified by:
removeExternal in interface Externalizable
Throws:
java.io.IOException

setAmended

public void setAmended(boolean aValue)
Sets the amended flag to aValue.

Parameters:
aValue - boolean

setDescription

public void setDescription(java.lang.String aDescription)
Sets the value of description.

Parameters:
aDescription - java.lang.String

setDescriptor

public void setDescriptor(PropertyDescription descriptor)
Sets the PropertyDescriptor for this business object to that passed.

Specified by:
setDescriptor in interface TypedData
Parameters:
descriptor - PropertyDescription

setErrorInfo

public void setErrorInfo(ErrorInfo anErrorInfo)
Sets the errorInfo attribute.

Returns:
com.ibm.btt.base.ErrorInfo

setExternalizer

public static void setExternalizer(Externalizer anExternalizer)
Sets the externalizer.

Parameters:
anExternalizer - com.ibm.btt.base.Externalizer

setName

public void setName(java.lang.String aName)
Sets the name property (java.lang.String) value.

Specified by:
setName in interface Externalizable
Parameters:
aName - java.lang.String

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.Object parameterValue)
Sets the value of the element in the Hashtable of paramaters.

Parameters:
parameterName - String
parameterValue - Object

setParameters

public void setParameters(Hashtable theParameters)
Sets the Hashtable of paramaters for this business object.


setState

public void setState(ElementState aState)
Sets the state property.

Parameters:
aState - com.ibm.btt.base.types.ElementState

setValue

public abstract void setValue(java.lang.Object aValue)
                       throws DSEInvalidArgumentException
Throws an exception. This method is implemented to maintain polymorphism.

Parameters:
aValue - java.lang.Object
Throws:
DSEInvalidArgumentException

toStrings

public Vector toStrings()
Returns a visual representation of this data element.

Specified by:
toStrings in interface Externalizable
Returns:
Vector

toTags

public Vector toTags()
              throws java.io.IOException
Returns a Vector with the DataElement represented as a Tag.

Specified by:
toTags in interface Externalizable
Returns:
com.ibm.btt.base.Vector
Throws:
java.io.IOException

tryGetElementAt

public DataElement tryGetElementAt(java.lang.String aName)
Returns null. Implemented in order to provide polymorphism.

Parameters:
aName - java.lang.String

validate

public java.lang.Object validate(java.lang.Object toValidate)
                          throws DSETypeException
Validates the object using its property descriptor.

Returns:
java.lang.Object
Throws:
DSETypeException - - If the object has not been successfully validated

validate

public abstract java.lang.Object validate(java.lang.Object toValidate,
                                          java.lang.String convType)
                                   throws DSETypeException
This method must be implemented by the subclasses.

Parameters:
toValidate - java.lang.String
convType - java.lang.String
Returns:
java.lang.Object
Throws:
DSETypeException

validateObject

public java.lang.Object validateObject(java.lang.Object toValidate)
                                throws DSETypeException
Validates an object using its validator directly without conversion. If validator is not defined, the object is returned.

Returns:
java.lang.Object - The validated object
Throws:
DSETypeException - - If the object has not been successfully validated

writeExternal

public void writeExternal()
                   throws java.io.IOException
Converts the instance into tags and writes the tags into a file.

Specified by:
writeExternal in interface Externalizable
Throws:
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput s)
                   throws java.io.IOException
Provides concrete serialization handling for DataElement.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
s - java.io.ObjectOutput
Throws:
java.io.IOException

isCached

public boolean isCached()
Returns the isCached.

Returns:
boolean

setIsCached

public void setIsCached(boolean cached)
Sets the isCached.


getCompositeKey

public java.lang.String getCompositeKey()
Returns the compositeKey.

Returns:
String

setCompositeKey

public void setCompositeKey(java.lang.String aCompositeKey)
Sets the compositeKey.


isSerializable

public boolean isSerializable()
Returns:
true if this data element is serializable.

setSerializable

public void setSerializable(boolean b)
Parameters:
b -

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005