IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class HashtableFormat

java.lang.Object
  extended by com.ibm.btt.base.HashtableFormat
All Implemented Interfaces:
Cacheable, java.io.Externalizable, java.io.Serializable

public class HashtableFormat
extends java.lang.Object
implements Externalizable, Cacheable

This is an special formatter used by the database services. When formatting the data within an operation context, it returns a Hashtable, not a String. In the resulting Hashtable, the key is the name of the DataField and the value is the result of formatting the DataField value using the formatter specificied in the "HashtableFormat" external definition.

See Also:
Serialized Form

Field Summary
 java.lang.String dataElementName
          Keeps the name of the data element the formatter is managing.
 
Constructor Summary
HashtableFormat()
           
 
Method Summary
 HashtableFormat add(java.lang.Object aFormatElement)
          Adds a format element in the HashtableFormat vector of elements.
 HashtableFormat addElementAt(java.lang.Object aFormatElement, int i)
          Adds a format element in the HashtableFormat vector of elements at the specified index.
 HashtableFormat addFirst(java.lang.Object aFormatElement)
          Adds a format element to the first position of the HashtableFormat vector of elements.
 java.lang.Object at(int anIndex)
          Returns the format element in the HashtableFormat vector of elements at the given position.
 Externalizer externalizer()
          Returns the Externalizer assigned to the FormatElement class.
 Hashtable format(Context aContext)
          Performs the formatting process getting the data from the context aContext.
 Hashtable format(KeyedCollection aKeyedCollection)
          Formats the data element aKeyedCollection.
 java.lang.String getDataElementName()
          Returns the value of the dataElementName attribute.
 Vector getElements()
          Returns a Vector containing all of the format elements.
 java.lang.String getName()
          Returns the name of the class.
 java.lang.String getTagName()
          Returns the tag associated with the name of the class.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes the hashtable with the Tag attributes.
 boolean isCacheable()
          This method finds out if THIS particular object can be cached.
protected  java.lang.Object obtainDataElement(FormatElement aFormatElement, Context aContext)
          Returns the DataElement in the context aContext which will format aFormatElement.
protected  DataElement obtainDataElement(FormatElement aFormatElement, KeyedCollection aKeyedCollection)
          Returns the DataElement within the keyed collection aKeyedCollection which will format aFormatElement.
protected  java.lang.Object obtainDataElement(ObjectFormat anObjectFormat, Context aContext)
          Returns the DataElement in the context aContext which will format anObjectFormat.
protected  DataElement obtainDataElement(ObjectFormat anObjectFormat, KeyedCollection aKeyedCollection)
          Returns the DataElement in the keyed collection aKeyedCollection which will format anObjectFormat.
 void readExternal()
          This method will find the tag that corresponds to the name of THIS entity.
 void readExternal(java.io.ObjectInput s)
          Invokes the object creation from an ObjectInput.
 void reinitialize()
          This method will reinitialize THIS object.
 void removeAll()
          Removes all elements from the vector of format elements.
 java.lang.Object removeAt(int anIndex)
          Removes the format element from the given index in HashtableFormat vector of elements.
 void removeExternal()
          Removes the object's tags from the XML file in which it is externalized.
 void setDataElementName(java.lang.String aString)
          Sets the dataElementName attribute value to aString.
 void setElements(Vector v)
          Sets the value of the elements attribute to v.
 void setName(java.lang.String aName)
          Sets the HashtableFormat instance name to aName.
 int size()
          Returns the size of the vector of format elements.
 java.lang.String toString()
          Returns an XML representation of the format element instance.
 Vector toStrings()
          Returns a Vector containing XML representations of the format elements.
 Vector toTags()
          Returns a Vector with the HashtableFormat instance represented as a Tag.
 DataElement unformat(Hashtable aHashtable, Context aContext)
          Unformats the Hashtable aHashtable and updates the context aContext with the resulting data.
 DataElement unformat(Hashtable aHashtable, KeyedCollection aKeyedCollection)
          Unformats the Hashtable aHashtable and updates the keyed collection aKeyedCollection with the resulting data.
 void writeExternal()
          Writes the HashtableFormat instance converted to tags to its XML file.
 void writeExternal(java.io.ObjectOutput s)
          Provides concrete serialization handling for HashtableFormat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataElementName

public java.lang.String dataElementName
Keeps the name of the data element the formatter is managing.

Constructor Detail

HashtableFormat

public HashtableFormat()
Method Detail

add

public HashtableFormat add(java.lang.Object aFormatElement)
Adds a format element in the HashtableFormat vector of elements.

Parameters:
aFormatElement - Object
Returns:
com.ibm.btt.base.HashtableFormat

addElementAt

public HashtableFormat addElementAt(java.lang.Object aFormatElement,
                                    int i)
Adds a format element in the HashtableFormat vector of elements at the specified index.

Parameters:
aFormatElement - java.lang.Object
Returns:
com.ibm.btt.base.HashtableFormat

addFirst

public HashtableFormat addFirst(java.lang.Object aFormatElement)
Adds a format element to the first position of the HashtableFormat vector of elements.

Parameters:
aFormatElement - java.lang.Object
Returns:
com.ibm.btt.base.HashtableFormat

at

public java.lang.Object at(int anIndex)
Returns the format element in the HashtableFormat vector of elements at the given position.

Parameters:
anIndex - int
Returns:
java.lang.Object

externalizer

public Externalizer externalizer()
                          throws java.io.IOException
Returns the Externalizer assigned to the FormatElement class.

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

format

public Hashtable format(Context aContext)
                 throws DSEInvalidRequestException,
                        DSEInvalidClassException,
                        DSEInvalidArgumentException
Performs the formatting process getting the data from the context aContext.

Parameters:
aContext - com.ibm.btt.base.Context
Returns:
com.ibm.btt.base.Hashtable
Throws:
DSEInvalidRequestException
DSEInvalidClassException
DSEInvalidArgumentException

format

public Hashtable format(KeyedCollection aKeyedCollection)
                 throws DSEInvalidRequestException,
                        DSEInvalidClassException,
                        DSEInvalidArgumentException
Formats the data element aKeyedCollection.

Parameters:
aKeyedCollection - com.ibm.btt.base.KeyedCollection
Returns:
com.ibm.btt.base.Hashtable
Throws:
DSEInvalidRequestException
DSEInvalidClassException
DSEInvalidArgumentException

getDataElementName

public java.lang.String getDataElementName()
Returns the value of the dataElementName attribute.

Returns:
java.lang.String

getElements

public Vector getElements()
Returns a Vector containing all of the format elements.

Returns:
com.ibm.btt.base.Vector

getName

public java.lang.String getName()
Returns the name of the class.

Specified by:
getName in interface Cacheable
Returns:
java.lang.String

getTagName

public java.lang.String getTagName()
Returns the tag associated with the name of the class.

Returns:
java.lang.String

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes the hashtable with the Tag attributes.

Parameters:
aTag - Tag
Returns:
data.DataElement
Throws:
java.io.IOException
DSEException

isCacheable

public boolean isCacheable()
This method finds out if THIS particular object can be cached.

Specified by:
isCacheable in interface Cacheable
Returns:
boolean

obtainDataElement

protected java.lang.Object obtainDataElement(FormatElement aFormatElement,
                                             Context aContext)
                                      throws DSEInvalidRequestException
Returns the DataElement in the context aContext which will format aFormatElement. This method handles particular cases.

Parameters:
aFormatElement - com.ibm.btt.base.FormatElement
aContext - com.ibm.btt.base.Context
Returns:
java.lang.Object
Throws:
com.ibm.btt.base.DSEInvalidRequestException.
DSEInvalidRequestException

obtainDataElement

protected DataElement obtainDataElement(FormatElement aFormatElement,
                                        KeyedCollection aKeyedCollection)
                                 throws DSEInvalidRequestException
Returns the DataElement within the keyed collection aKeyedCollection which will format aFormatElement. This method handles particular cases.

Parameters:
aFormatElement - com.ibm.btt.base.FormatElement
aKeyedCollection - com.ibm.btt.base.KeyedCollection
Returns:
com.ibm.btt.base.DataElement
Throws:
DSEInvalidRequestException

obtainDataElement

protected java.lang.Object obtainDataElement(ObjectFormat anObjectFormat,
                                             Context aContext)
                                      throws DSEInvalidRequestException
Returns the DataElement in the context aContext which will format anObjectFormat. This method handles particular cases.

Parameters:
anObjectFormat - com.ibm.btt.base.ObjectFormat
aContext - com.ibm.btt.base.Context
Returns:
java.lang.Object
Throws:
com.ibm.btt.base.DSEInvalidRequestException.
DSEInvalidRequestException

obtainDataElement

protected DataElement obtainDataElement(ObjectFormat anObjectFormat,
                                        KeyedCollection aKeyedCollection)
                                 throws DSEInvalidRequestException
Returns the DataElement in the keyed collection aKeyedCollection which will format anObjectFormat. This method handles particular cases.

Parameters:
anObjectFormat - com.ibm.btt.base.ObjectFormat
aKeyedCollection - com.ibm.btt.base.KeyedCollection
Returns:
com.ibm.btt.base.DataElement
Throws:
DSEInvalidRequestException

readExternal

public void readExternal()
                  throws java.io.IOException
This method will find the tag that corresponds to the name of THIS entity. Then it will initialize THIS entity with the contents of the tag.

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

reinitialize

public void reinitialize()
This method will reinitialize THIS object. It should be called immediately after being extracted from the cache.

Specified by:
reinitialize in interface Cacheable

removeAll

public void removeAll()
Removes all elements from the vector of format elements.


removeAt

public java.lang.Object removeAt(int anIndex)
Removes the format element from the given index in HashtableFormat vector of elements.

Parameters:
anIndex - int
Returns:
java.lang.Object

removeExternal

public void removeExternal()
                    throws java.io.IOException
Removes the object's tags from the XML file in which it is externalized.

Throws:
java.io.IOException

setDataElementName

public void setDataElementName(java.lang.String aString)
Sets the dataElementName attribute value to aString.

Parameters:
aString - java.lang.String

setElements

public void setElements(Vector v)
Sets the value of the elements attribute to v.

Parameters:
v - com.ibm.btt.base.Vector

setName

public void setName(java.lang.String aName)
Sets the HashtableFormat instance name to aName.

Parameters:
aName - java.lang.String

size

public int size()
Returns the size of the vector of format elements.

Returns:
int

toString

public java.lang.String toString()
Returns an XML representation of the format element instance.

Overrides:
toString in class java.lang.Object
Returns:
java.lang.String

toStrings

public Vector toStrings()
Returns a Vector containing XML representations of the format elements.

Returns:
com.ibm.btt.base.Vector

toTags

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

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

unformat

public DataElement unformat(Hashtable aHashtable,
                            Context aContext)
                     throws DSEInvalidArgumentException,
                            DSEInvalidRequestException
Unformats the Hashtable aHashtable and updates the context aContext with the resulting data. It returns the updated keyed collection.

Parameters:
aHashtable - com.ibm.btt.base.Hashtable
aContext - com.ibm.btt.base.Context
Returns:
com.ibm.btt.base.DataElement
Throws:
com.ibm.btt.base.DSEInvalidArgumentException.
com.ibm.btt.base.DSEInvalidRequestException.
DSEInvalidArgumentException
DSEInvalidRequestException

unformat

public DataElement unformat(Hashtable aHashtable,
                            KeyedCollection aKeyedCollection)
                     throws DSEInvalidRequestException,
                            DSEInvalidArgumentException
Unformats the Hashtable aHashtable and updates the keyed collection aKeyedCollection with the resulting data. It returns the updated keyed collection.

Parameters:
aHashtable - com.ibm.btt.base.Hashtable
aKeyedCollection - com.ibm.btt.base.KeyedCollection
Returns:
com.ibm.btt.base.DataElement
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

writeExternal

public void writeExternal()
                   throws java.io.IOException
Writes the HashtableFormat instance converted to tags to its XML file.

Throws:
java.io.IOException

writeExternal

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

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

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011