JDBaccess API 1.0

com.jdbaccess.transfer
Class TransferObject

java.lang.Object
  extended by com.jdbaccess.transfer.TransferObject
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Row

public abstract class TransferObject
extends java.lang.Object
implements java.io.Serializable

Abstract super class of all transfer object classes such as Employee but also of the special class Row. Transfer objects are serializable so that they can be exchanged between clients and servers.

See Also:
Serialized Form

Constructor Summary
TransferObject()
           
 
Method Summary
 java.lang.String getEntity()
          Gets the entity name of this transfer object
 Field getField(java.lang.String fieldName)
          Gets the field with that fieldName
 java.util.ArrayList getFields()
          Gets all fields of this object
static java.lang.String getIdentifierFieldName()
          Gets the identifier field name of the transfer object
 java.util.ArrayList getModifiedFieldNames()
          Returns all modified field names of this object
 java.lang.String getSequenceName()
          Get the sequence name of this object.
 java.lang.Object getValue(java.lang.String fieldName)
          Gets the value of this field with that field name
 com.jdbaccess.sql.LogicalCondition getWhereCondition()
          Gets the whereCondition of this transfer object.
 boolean hasIdField()
          Returns true if this object has an id field else false
 boolean hasModifiedFields()
          Returns true if at least one field value is modified else false
 boolean isModified(java.lang.String fieldName)
          Returns true if the field with this field name is modified
 void setAllFieldsModified()
          Sets all field values to modified.
 void setAllFieldsUnmodified()
          Sets all field values unmodified
 void setEntity(java.lang.String entity)
          Sets the entity name (table name) of this transfer object.
 void setSequenceName(java.lang.String sequenceName)
          Sets the sequence name of this transfer object.
 void setValue(java.lang.String fieldName, java.lang.Object value)
          Sets the value of the field with that field name.
 void setValueModified(java.lang.String fieldName, java.lang.Object value)
          Sets the value of the field with that field name.
 void setWhereCondition(com.jdbaccess.sql.LogicalCondition whereCondition)
          Sets the where condition
 java.lang.String toString()
          Returns a String representation of this transfer object
 com.jdbaccess.transfer.TransferObjectHelper xxxxxInternalGetTOHelper()
          !!!!
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransferObject

public TransferObject()
Method Detail

getIdentifierFieldName

public static java.lang.String getIdentifierFieldName()
Gets the identifier field name of the transfer object

Returns:
the identifier field name

getEntity

public java.lang.String getEntity()
Gets the entity name of this transfer object

Returns:
entity name of this transfer object

getSequenceName

public java.lang.String getSequenceName()
Get the sequence name of this object. A sequence name should be set by the subclass (e.g. Employee) of this transfer object class in its constructor. This method could be used in an Oracle environment when this transfer object is a transfer object with an id field for which an id value should be generated automatically by this sequence name.

Returns:
sequence name of this object

setEntity

public void setEntity(java.lang.String entity)
Sets the entity name (table name) of this transfer object.

Parameters:
entity - entity name (table name)

setSequenceName

public void setSequenceName(java.lang.String sequenceName)
Sets the sequence name of this transfer object.

Parameters:
sequenceName - sequence name

getWhereCondition

public com.jdbaccess.sql.LogicalCondition getWhereCondition()
Gets the whereCondition of this transfer object.

Returns:
Returns the whereCondition.

setWhereCondition

public void setWhereCondition(com.jdbaccess.sql.LogicalCondition whereCondition)
Sets the where condition

Parameters:
whereCondition - whereCondition as a LogicalCondition.

getValue

public java.lang.Object getValue(java.lang.String fieldName)
                          throws ApplicationException
Gets the value of this field with that field name

Parameters:
fieldName - name of the field which is case insensitive
Returns:
value of this field with that field name
Throws:
ApplicationException - if fieldName does not exist or an unsafe field access is done

setValue

public void setValue(java.lang.String fieldName,
                     java.lang.Object value)
              throws ApplicationException
Sets the value of the field with that field name. The field remains unmodified. Some value types are automatically transformed so that they fit into the field of the transfer object (Long to Integer, Integer to Long).

Parameters:
fieldName - is case insensitive
value - value to set
Throws:
ApplicationException - if fieldName does not exist or an unsafe field access is done
See Also:
setValueModified(String, Object)

setValueModified

public void setValueModified(java.lang.String fieldName,
                             java.lang.Object value)
                      throws ApplicationException
Sets the value of the field with that field name. The field is set modified. Some value types are automatically transformed so that they fit into the field of the transfer object (Long to Integer, Integer to Long).

Parameters:
fieldName - is case insensitive
value - value to set
Throws:
ApplicationException - if fieldName does not exist or an unsafe field access is done
See Also:
setValue(String, Object)

getFields

public java.util.ArrayList getFields()
                              throws ApplicationException
Gets all fields of this object

Returns:
all fields of this object as an ArrayList of Field
Throws:
ApplicationException - if an unsafe field access is done

hasModifiedFields

public boolean hasModifiedFields()
Returns true if at least one field value is modified else false

Returns:
true if at least one field value is modified else false

getModifiedFieldNames

public java.util.ArrayList getModifiedFieldNames()
Returns all modified field names of this object

Returns:
all modified field names of this object as an ArrayList of String

setAllFieldsUnmodified

public void setAllFieldsUnmodified()
Sets all field values unmodified


setAllFieldsModified

public void setAllFieldsModified()
                          throws ApplicationException
Sets all field values to modified.

Throws:
ApplicationException

hasIdField

public boolean hasIdField()
Returns true if this object has an id field else false

Returns:
true if this object has an id field else false

toString

public java.lang.String toString()
Returns a String representation of this transfer object

Overrides:
toString in class java.lang.Object
Returns:
String representation of this transfer object

getField

public Field getField(java.lang.String fieldName)
               throws ApplicationException
Gets the field with that fieldName

Parameters:
fieldName - fieldName is case insensitive
Returns:
field with that fieldName
Throws:
ApplicationException

isModified

public boolean isModified(java.lang.String fieldName)
Returns true if the field with this field name is modified

Parameters:
fieldName - name of the field
Returns:
true if the field with this field name is modified

xxxxxInternalGetTOHelper

public com.jdbaccess.transfer.TransferObjectHelper xxxxxInternalGetTOHelper()
!!!! Internal method. Do not use this method !!!!! Returns the transfer object helper object for internal operations

Returns:
transfer object helper object for internal operations

JDBaccess API 1.0

Copyright © 2005-2006 JDBaccess.com, Königsweg 210, D-14129 Berlin, Germany. All Rights Reserved.