Expresso 5-6

com.jcorporate.expresso.core.dataobjects.jdbc
Class JoinedDataField

java.lang.Object
  extended bycom.jcorporate.expresso.core.dataobjects.jdbc.JoinedDataField
All Implemented Interfaces:
DataField

public class JoinedDataField
extends Object
implements DataField

Data Field that is aware of local/forein key relations. If you set the local key, it will set the foreign key as well. This i

Author:
Michael Rimov

Constructor Summary
protected JoinedDataField()
          Protected constructor.
 
Method Summary
 BigDecimal asBigDecimal()
          Retrieve the wrapped object as a BigDecimal object or zero if we're unable to convert it.
 Boolean asBoolean()
          Retrieve the boolean object value.
 Date asDate()
          Retrieve the wrapped object as a Date object or possibly null if we can't convert it or the object is null.
 Double asDouble()
          Retrieve the wrapped object as a Double object or zero if we can't convert i
 Integer asInteger()
          Retrieves the wrapped object as an Integer or zero if it's an invalid format.
 InputStream asStream()
          Allows for retrieval of BLOB database types.
 String asString()
          Retrieves the wrapped object as a String
 void cacheIsChangedComparison()
          call when add() or update() has occurred, and currentValue of data fields should be considered 'original value' for purposes of determining 'isChanged'
 void checkValue()
          Make sure the value of the field is valid.
 Map getAllAttributes()
          Returns a Read Only Map of all attributes in name-value pairs.
 Object getAttribute(String attributeName)
          Retrieves any user defined attributes for this field.
 DataFieldMetaData getFieldMetaData()
          Returns a handle to the Field MetaData object.
static JoinedDataField getInstance(JoinedDataObject owner, DataObject localObj, String localField, DataObject remoteObj, String foreignField)
          Construct a new JoinedDataField object
 Object getOriginalValue()
          Deprecated. 8/04 v.5.5 do not expose this cache
 DataObject getOwner()
          Returns a handle to the DataObject that is the container for this Data Field
 Object getValue()
          Retrieve the value of the object.
 boolean isChanged()
          Used for change logging.
 boolean isNull()
          Returns true if the object is null.
 boolean isValueSet()
          Used for change logging.
 void resetChanged()
          Resets the changed flag and sets the original value field to null
 void setAttribute(String attributeName, Object value)
          Sets an attribute for this particular instance of the Data field
 void setFieldMetaData(DataFieldMetaData newMetadata)
          Sets the metadata object for this field.
 void setOwner(DataObject newOwner)
          Sets the owner of a given DataObject
 void setValue(Object newValue)
          Sets the wrapped object for the data field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoinedDataField

protected JoinedDataField()
Protected constructor. Do not use normally.

Method Detail

getInstance

public static JoinedDataField getInstance(JoinedDataObject owner,
                                          DataObject localObj,
                                          String localField,
                                          DataObject remoteObj,
                                          String foreignField)
Construct a new JoinedDataField object

Parameters:
owner - the creating data object
localObj - the 'Left' DataObject
localField - the 'Left' join field
remoteObj - the 'Right' DataObject
foreignField - the 'Right' join field.
Returns:
an instantiated JoinedDataField instance.

getValue

public Object getValue()
Retrieve the value of the object. It is the same with the local key AND the foreign key.

Specified by:
getValue in interface DataField
Returns:
java.lang.Object

asString

public String asString()
Description copied from interface: DataField
Retrieves the wrapped object as a String

Specified by:
asString in interface DataField
Returns:
java.lang.String

asBoolean

public Boolean asBoolean()
Description copied from interface: DataField
Retrieve the boolean object value.

Specified by:
asBoolean in interface DataField
Returns:
java.lang.Boolean

asInteger

public Integer asInteger()
Description copied from interface: DataField
Retrieves the wrapped object as an Integer or zero if it's an invalid format.

Specified by:
asInteger in interface DataField
Returns:
a java.lang.Integer object, or null if the object is null.

asDate

public Date asDate()
Description copied from interface: DataField
Retrieve the wrapped object as a Date object or possibly null if we can't convert it or the object is null.

Specified by:
asDate in interface DataField
Returns:
a properly instantiated Date Object if we're able to convert it.

asBigDecimal

public BigDecimal asBigDecimal()
Description copied from interface: DataField
Retrieve the wrapped object as a BigDecimal object or zero if we're unable to convert it.

Specified by:
asBigDecimal in interface DataField
Returns:
a properly instantiated BigDecimal Object if we're able to convert it.

asDouble

public Double asDouble()
Description copied from interface: DataField
Retrieve the wrapped object as a Double object or zero if we can't convert i

Specified by:
asDouble in interface DataField
Returns:
a properly instantiated Double Object if we're able to convert it.

getOriginalValue

public Object getOriginalValue()
Deprecated. 8/04 v.5.5 do not expose this cache

Specified by:
getOriginalValue in interface DataField
Returns:
the original object or null

asStream

public InputStream asStream()
Description copied from interface: DataField
Allows for retrieval of BLOB database types.

Specified by:
asStream in interface DataField
Returns:
java.io.InputStream

isChanged

public boolean isChanged()
Description copied from interface: DataField
Used for change logging.

Specified by:
isChanged in interface DataField
Returns:
true if the field has changed since the last reset

isValueSet

public boolean isValueSet()
Description copied from interface: DataField
Used for change logging.

Specified by:
isValueSet in interface DataField
Returns:
true if the field has been set since the last reset

checkValue

public void checkValue()
                throws DataException
Description copied from interface: DataField
Make sure the value of the field is valid.

Specified by:
checkValue in interface DataField
Throws:
DataException - if the field value is not valid

resetChanged

public void resetChanged()
Description copied from interface: DataField
Resets the changed flag and sets the original value field to null

Specified by:
resetChanged in interface DataField

setValue

public void setValue(Object newValue)
Description copied from interface: DataField
Sets the wrapped object for the data field

Specified by:
setValue in interface DataField
Parameters:
newValue - a new Object to set the value to

isNull

public boolean isNull()
Description copied from interface: DataField
Returns true if the object is null.

Specified by:
isNull in interface DataField
Returns:
true if the object is null

setAttribute

public void setAttribute(String attributeName,
                         Object value)
Description copied from interface: DataField
Sets an attribute for this particular instance of the Data field

Specified by:
setAttribute in interface DataField
Parameters:
attributeName - the name of the attribute to set
value - the value to set it to

getAttribute

public Object getAttribute(String attributeName)
Description copied from interface: DataField
Retrieves any user defined attributes for this field.

Specified by:
getAttribute in interface DataField
Parameters:
attributeName - the name of the attribute to retrieve
Returns:
an object or null if the attribute doesn't exist

getAllAttributes

public Map getAllAttributes()
Description copied from interface: DataField
Returns a Read Only Map of all attributes in name-value pairs. If there are no attributes then getAllAttributes will return a null map.

Specified by:
getAllAttributes in interface DataField
Returns:
java.util.map

getOwner

public DataObject getOwner()
Description copied from interface: DataField
Returns a handle to the DataObject that is the container for this Data Field

Specified by:
getOwner in interface DataField
Returns:
DataObject the containing data object.

setOwner

public void setOwner(DataObject newOwner)
Description copied from interface: DataField
Sets the owner of a given DataObject

Specified by:
setOwner in interface DataField
Parameters:
newOwner - The new parent object.

getFieldMetaData

public DataFieldMetaData getFieldMetaData()
Description copied from interface: DataField
Returns a handle to the Field MetaData object.

Specified by:
getFieldMetaData in interface DataField
Returns:
DataFieldMetaData

setFieldMetaData

public void setFieldMetaData(DataFieldMetaData newMetadata)
Description copied from interface: DataField
Sets the metadata object for this field.

Specified by:
setFieldMetaData in interface DataField
Parameters:
newMetadata - the new Field Meta data object... for example DBField

cacheIsChangedComparison

public void cacheIsChangedComparison()
call when add() or update() has occurred, and currentValue of data fields should be considered 'original value' for purposes of determining 'isChanged'

Specified by:
cacheIsChangedComparison in interface DataField

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.