com.taggercat.model
Class AbstractTCEntity

java.lang.Object
  extended by com.taggercat.model.AbstractTCEntity
All Implemented Interfaces:
TCEntity, java.io.Serializable

public abstract class AbstractTCEntity
extends java.lang.Object
implements TCEntity, java.io.Serializable

The standard super class for all Tagger Cat entities. The undo functionality is also implemented in this class.

See Also:
Serialized Form
 

Constructor Summary
AbstractTCEntity()
           
 
Method Summary
 void afterDelete(DataSource datasource)
          Called after the entity is deleted.
 void afterInsert(DataSource datasource)
          Called after the entity is inserted into the owning datasource.
 void afterSave(DataSource datasource)
          Called after the entity is saved, but before the modified and newly inserted property flags are reset.
 void afterUpdate(DataSource datasource, java.lang.String propertyName, java.lang.Object newValue, java.lang.Object oldValue)
          Called after a property is modified
 void beforeSave(DataSource datasource)
          Called prior to the entity being saved.
 void beforeUpdate(DataSource datasource, java.lang.String propertyName, java.lang.Object newValue, java.lang.Object oldValue)
          Called before a property is modified.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getEntityClassName()
          Returns the entities the fully qualified entity class name; the name without the proxy name mangling.
 java.lang.String getEntityName()
          Returns the entities unqualified name; the name without the package prefix.
 java.io.Serializable getIdentifier()
           
 java.lang.String getIdentifierPropertyName()
           
 boolean getNewlyInserted()
           
 java.lang.Object getOldValue(java.lang.String propertyName)
          Gets the property's old value, this can be the most recent value on the undo stack, or the unmodified value.
 java.lang.Object getOriginalValue(java.lang.String propertyName)
          Gets the property's original value, this can be the first value on the undo stack, or the unmodified value if there is not a value on the undo stack.
 java.lang.String getPKHexCode()
          Tagger Cat sets a temporary PKHexCode for any transient entity, Otherwise, it is the HEX Code representation of the primary key
 java.lang.String getPropertyStringValue(java.lang.String propertyName)
           
 java.lang.Object getPropertyValue(java.lang.String propertyName)
           
 java.lang.String getRowID()
          Gets the rowID for this entity.
 java.lang.Object getUserValue(java.lang.String key)
          Gets a user specified value.
 java.util.Map<java.lang.String,java.lang.Object> getUserValues()
          Gets the user values Map.
 int hashCode()
           
 boolean hasUndoValues()
          Returns true if this entity has any changed values
 boolean isFullyMaterialized()
           
 boolean isModified()
           
 boolean isNewlyInserted()
           
 boolean isPropertyNull(java.lang.String propertyName)
           
 void pushOldValue(java.lang.String propertyName, java.lang.Object value)
           
 void setFullyMaterialized()
           
 void setFullyMaterialized(boolean fullyMaterialized)
           
 void setIdentifierPropertyName(java.lang.String identifierPropertyName)
          Sets the name of the identifier property name.
 void setModified()
           
 void setModified(boolean state)
           
 void setNewlyInserted()
           
 void setNewlyInserted(boolean newlyInserted)
           
 void setPKHexCode(java.lang.String pkHexCode)
           
 void setUserValue(java.lang.String key, java.lang.Object value)
           
 void undo(org.hibernate.metadata.ClassMetadata entityMetadata)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTCEntity

public AbstractTCEntity()
Method Detail

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String propertyName)
Specified by:
getPropertyValue in interface TCEntity

getPropertyStringValue

public java.lang.String getPropertyStringValue(java.lang.String propertyName)
Specified by:
getPropertyStringValue in interface TCEntity

isPropertyNull

public boolean isPropertyNull(java.lang.String propertyName)
Specified by:
isPropertyNull in interface TCEntity

isNewlyInserted

public boolean isNewlyInserted()
Specified by:
isNewlyInserted in interface TCEntity

getNewlyInserted

public boolean getNewlyInserted()
Specified by:
getNewlyInserted in interface TCEntity

setNewlyInserted

public void setNewlyInserted()
Specified by:
setNewlyInserted in interface TCEntity

setModified

public void setModified()
Specified by:
setModified in interface TCEntity

isModified

public boolean isModified()
Specified by:
isModified in interface TCEntity

getIdentifier

public java.io.Serializable getIdentifier()
Specified by:
getIdentifier in interface TCEntity

hasUndoValues

public boolean hasUndoValues()
Returns true if this entity has any changed values

Specified by:
hasUndoValues in interface TCEntity

undo

public void undo(org.hibernate.metadata.ClassMetadata entityMetadata)
Specified by:
undo in interface TCEntity

getOldValue

public java.lang.Object getOldValue(java.lang.String propertyName)
Description copied from interface: TCEntity
Gets the property's old value, this can be the most recent value on the undo stack, or the unmodified value.

Specified by:
getOldValue in interface TCEntity
Returns:
the property's old value

getOriginalValue

public java.lang.Object getOriginalValue(java.lang.String propertyName)
Description copied from interface: TCEntity
Gets the property's original value, this can be the first value on the undo stack, or the unmodified value if there is not a value on the undo stack.

Specified by:
getOriginalValue in interface TCEntity
Returns:
the property's original value

pushOldValue

public void pushOldValue(java.lang.String propertyName,
                         java.lang.Object value)
Specified by:
pushOldValue in interface TCEntity

getPKHexCode

public java.lang.String getPKHexCode()
Tagger Cat sets a temporary PKHexCode for any transient entity, Otherwise, it is the HEX Code representation of the primary key

Specified by:
getPKHexCode in interface TCEntity

getRowID

public java.lang.String getRowID()
Gets the rowID for this entity. The rowID is synonymous for the PKHexCode.

Specified by:
getRowID in interface TCEntity
Returns:
the entity's PKHexCode

setPKHexCode

public void setPKHexCode(java.lang.String pkHexCode)
Specified by:
setPKHexCode in interface TCEntity

setModified

public void setModified(boolean state)
Specified by:
setModified in interface TCEntity

setNewlyInserted

public void setNewlyInserted(boolean newlyInserted)
Specified by:
setNewlyInserted in interface TCEntity

getUserValue

public java.lang.Object getUserValue(java.lang.String key)
Gets a user specified value. User values are arbitrary values placed into a Map with the specified key.

Specified by:
getUserValue in interface TCEntity
Parameters:
key - the key the value is saved under

getUserValues

public java.util.Map<java.lang.String,java.lang.Object> getUserValues()
Gets the user values Map.

Specified by:
getUserValues in interface TCEntity

setUserValue

public void setUserValue(java.lang.String key,
                         java.lang.Object value)
Specified by:
setUserValue in interface TCEntity

beforeSave

public void beforeSave(DataSource datasource)
                throws java.lang.Exception
Description copied from interface: TCEntity
Called prior to the entity being saved. This method will only called on instances that need to be saved to the DB; and not on unmodified instances.

Specified by:
beforeSave in interface TCEntity
Throws:
java.lang.Exception
Parameters:
datasource - the data source

afterSave

public void afterSave(DataSource datasource)
               throws java.lang.Exception
Description copied from interface: TCEntity
Called after the entity is saved, but before the modified and newly inserted property flags are reset. This method will only called on instances that are saved to the DB, not on unmodified instances.

Specified by:
afterSave in interface TCEntity
Throws:
java.lang.Exception
Parameters:
datasource - the data source

beforeUpdate

public void beforeUpdate(DataSource datasource,
                         java.lang.String propertyName,
                         java.lang.Object newValue,
                         java.lang.Object oldValue)
                  throws PropertyValueException
Description copied from interface: TCEntity
Called before a property is modified.

Specified by:
beforeUpdate in interface TCEntity
Throws:
PropertyValueException
Parameters:
datasource - the data source being updated
propertyName - the name of the property that is being modified
newValue - the new value being set
oldValue - the old value being updated

afterUpdate

public void afterUpdate(DataSource datasource,
                        java.lang.String propertyName,
                        java.lang.Object newValue,
                        java.lang.Object oldValue)
                 throws PropertyValueException
Description copied from interface: TCEntity
Called after a property is modified

Specified by:
afterUpdate in interface TCEntity
Throws:
PropertyValueException
Parameters:
datasource - the data source being updated
propertyName - the name of the property that is being modified
newValue - the new value being set
oldValue - the old value being updated

afterDelete

public void afterDelete(DataSource datasource)
                 throws java.lang.Exception
Description copied from interface: TCEntity
Called after the entity is deleted.

Specified by:
afterDelete in interface TCEntity
Throws:
java.lang.Exception

afterInsert

public void afterInsert(DataSource datasource)
                 throws java.lang.Exception
Description copied from interface: TCEntity
Called after the entity is inserted into the owning datasource. This method is not called after inserting into the DB.

Specified by:
afterInsert in interface TCEntity
Throws:
java.lang.Exception

getEntityClassName

public java.lang.String getEntityClassName()
Returns the entities the fully qualified entity class name; the name without the proxy name mangling.

Specified by:
getEntityClassName in interface TCEntity
Returns:
the entityName

getEntityName

public java.lang.String getEntityName()
Returns the entities unqualified name; the name without the package prefix.

Specified by:
getEntityName in interface TCEntity
Returns:
the entityShortName

getIdentifierPropertyName

public java.lang.String getIdentifierPropertyName()
Specified by:
getIdentifierPropertyName in interface TCEntity
Returns:
the identifierPropertyName

setIdentifierPropertyName

public void setIdentifierPropertyName(java.lang.String identifierPropertyName)
Description copied from interface: TCEntity
Sets the name of the identifier property name.

Specified by:
setIdentifierPropertyName in interface TCEntity
Parameters:
identifierPropertyName - the identifierPropertyName to set

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

isFullyMaterialized

public boolean isFullyMaterialized()

setFullyMaterialized

public void setFullyMaterialized(boolean fullyMaterialized)

setFullyMaterialized

public void setFullyMaterialized()