org.nuiton.topia.persistence
Class TopiaEntityAbstract

java.lang.Object
  extended by org.nuiton.topia.persistence.TopiaEntityAbstract
All Implemented Interfaces:
Serializable, TopiaEntity

public abstract class TopiaEntityAbstract
extends Object
implements TopiaEntity

Classe de base de toutes les entités, cela permet de concentrer le code technique dans cette classe. L'identifiant peut-etre n'importe quoi Aucune restriction n'est faite dessus, il peut meme changer entre deux types d'entité si cela ne pose pas d'autre probleme (heritage entre ces entités).

Version:
$Id: TopiaEntityAbstract.java 1986 2010-06-01 15:16:53Z echatellier $
Author:
poussin
See Also:
Serialized Form

Field Summary
protected  PropertyChangeSupport readListeners
           
protected  VetoableChangeSupport readVetoables
           
protected  TopiaContext topiaContext
           
protected  Date topiaCreateDate
           
protected  String topiaId
           
protected  long topiaVersion
           
protected  PropertyChangeSupport writeListeners
           
protected  VetoableChangeSupport writeVetoables
           
 
Fields inherited from interface org.nuiton.topia.persistence.TopiaEntity
TOPIA_CREATE_DATE, TOPIA_ID, TOPIA_VERSION
 
Constructor Summary
TopiaEntityAbstract()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add listener for property writing.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add listener for property writing.
 void addPropertyListener(PropertyChangeListener listener)
          Add listener for property reading.
 void addPropertyListener(String propertyName, PropertyChangeListener listener)
          Add listener for property reading.
 void addVetoableChangeListener(String propertyName, VetoableChangeListener vetoable)
           
 void addVetoableChangeListener(VetoableChangeListener vetoable)
           
 void addVetoableListener(String propertyName, VetoableChangeListener vetoable)
           
 void addVetoableListener(VetoableChangeListener vetoable)
           
 void delete()
           
 boolean equals(Object obj)
          On est sur que les objets sont bien les memes car s'il n'ont pas d'id cela veut dire qu'il ne vienne pas de la meme session donc qu'il sont nouveau et different, ou bien qu'ils viennent de la meme session et dans ce cas l'egalite == fonctionne.
protected  void fireOnPostRead(String propertyName, int index, Object value)
           
protected  void fireOnPostRead(String propertyName, Object value)
           
protected  void fireOnPostWrite(String propertyName, int index, Object oldValue, Object newValue)
           
protected  void fireOnPostWrite(String propertyName, Object oldValue, Object newValue)
           
protected  void fireOnPreRead(String propertyName, Object value)
           
protected  void fireOnPreWrite(String propertyName, Object oldValue, Object newValue)
           
 List<TopiaEntity> getAggregate()
           
 List<TopiaEntity> getComposite()
           
protected  PropertyChangeSupport getReadPropertyChangeSupport()
          Initialize readListeners at first use or after deserialisation.
protected  VetoableChangeSupport getReadVetoableChangeSupport()
          Initialize readVetoables at first use or after deserialisation.
 TopiaContext getTopiaContext()
           
 Date getTopiaCreateDate()
          Technical date creation of the entity.
 String getTopiaId()
          Unique technical Id of the entity.
 long getTopiaVersion()
          Technical property to keep versionning of the entity.
protected  PropertyChangeSupport getWritePropertyChangeSupport()
          Initialize writeListeners at first use or after deserialisation.
protected  VetoableChangeSupport getWriteVetoableChangeSupport()
          Initialize writeVetoables at first use or after deserialisation.
 int hashCode()
          On utilise la date de creation comme hash code, cette date ne varie pas au cours du temps
 void postCreate()
          Called just after object creation and initialisation each entity impl can overide it to do something after creation
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
           
 void removePropertyListener(PropertyChangeListener listener)
           
 void removePropertyListener(String propertyName, PropertyChangeListener listener)
           
 void removeVetoableChangeListener(String propertyName, VetoableChangeListener vetoable)
           
 void removeVetoableChangeListener(VetoableChangeListener vetoable)
           
 void removeVetoableListener(String propertyName, VetoableChangeListener vetoable)
           
 void removeVetoableListener(VetoableChangeListener vetoable)
           
 void setTopiaContext(TopiaContext context)
           
 void setTopiaCreateDate(Date topiaCreateDate)
          Set the technical creation date of the entity.
 void setTopiaId(String v)
          Set the technical id of the entity.
 void setTopiaVersion(long v)
          Set the technical version of the entity.
 void update()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuiton.topia.persistence.TopiaEntity
accept
 

Field Detail

topiaId

protected String topiaId

topiaVersion

protected long topiaVersion

topiaCreateDate

protected Date topiaCreateDate

topiaContext

protected transient TopiaContext topiaContext

readVetoables

protected transient VetoableChangeSupport readVetoables

readListeners

protected transient PropertyChangeSupport readListeners

writeVetoables

protected transient VetoableChangeSupport writeVetoables

writeListeners

protected transient PropertyChangeSupport writeListeners
Constructor Detail

TopiaEntityAbstract

public TopiaEntityAbstract()
Method Detail

getReadVetoableChangeSupport

protected VetoableChangeSupport getReadVetoableChangeSupport()
Initialize readVetoables at first use or after deserialisation.

Returns:
readVetoables

getReadPropertyChangeSupport

protected PropertyChangeSupport getReadPropertyChangeSupport()
Initialize readListeners at first use or after deserialisation.

Returns:
readListeners

getWriteVetoableChangeSupport

protected VetoableChangeSupport getWriteVetoableChangeSupport()
Initialize writeVetoables at first use or after deserialisation.

Returns:
writeVetoables

getWritePropertyChangeSupport

protected PropertyChangeSupport getWritePropertyChangeSupport()
Initialize writeListeners at first use or after deserialisation.

Returns:
writeListeners

getTopiaId

public String getTopiaId()
Description copied from interface: TopiaEntity
Unique technical Id of the entity. This id contains the full qualified name of the entity interface. This id has also an index and his used to identify uniquely the entity in the database.

Specified by:
getTopiaId in interface TopiaEntity
Returns:
the technical Id of the entity

setTopiaId

public void setTopiaId(String v)
Description copied from interface: TopiaEntity
Set the technical id of the entity. Careful, use this method only for copy. The technical id is generated by ToPIA when entity is created using TopiaDAO.create(Object...).

Specified by:
setTopiaId in interface TopiaEntity
Parameters:
v - technical id to set

getTopiaVersion

public long getTopiaVersion()
Description copied from interface: TopiaEntity
Technical property to keep versionning of the entity. The version is incremented on each change of the entity.

Specified by:
getTopiaVersion in interface TopiaEntity
Returns:
the current version of the entity

setTopiaVersion

public void setTopiaVersion(long v)
Description copied from interface: TopiaEntity
Set the technical version of the entity. Careful, use this method only for copy. The version is automatically incremented on entity changes.

Specified by:
setTopiaVersion in interface TopiaEntity
Parameters:
v - technical version to set

getTopiaCreateDate

public Date getTopiaCreateDate()
Description copied from interface: TopiaEntity
Technical date creation of the entity. This date doesn't change through time and was initialized on entity creation when using TopiaDAO.create(Object...).

Specified by:
getTopiaCreateDate in interface TopiaEntity
Returns:
the creation date of the entity

setTopiaCreateDate

public void setTopiaCreateDate(Date topiaCreateDate)
Description copied from interface: TopiaEntity
Set the technical creation date of the entity. Careful, use this method only for copy. This date is immutable and was created on entity creation.

Specified by:
setTopiaCreateDate in interface TopiaEntity
Parameters:
topiaCreateDate - technical create date to set

getTopiaContext

public TopiaContext getTopiaContext()
Specified by:
getTopiaContext in interface TopiaEntity

setTopiaContext

public void setTopiaContext(TopiaContext context)
                     throws TopiaException
Parameters:
context - The context to set.
Throws:
TopiaException - if any pb ?

postCreate

public void postCreate()
                throws TopiaException
Description copied from interface: TopiaEntity
Called just after object creation and initialisation each entity impl can overide it to do something after creation

Specified by:
postCreate in interface TopiaEntity
Throws:
TopiaException - if any pb

update

public void update()
            throws TopiaException
Specified by:
update in interface TopiaEntity
Throws:
TopiaException - if any pb

delete

public void delete()
            throws TopiaException
Specified by:
delete in interface TopiaEntity
Throws:
TopiaException - if any pb

getComposite

public List<TopiaEntity> getComposite()
                               throws TopiaException
Specified by:
getComposite in interface TopiaEntity
Returns:
all object that must be deleted if this object is deleted
Throws:
TopiaException - if any pb

getAggregate

public List<TopiaEntity> getAggregate()
                               throws TopiaException
Specified by:
getAggregate in interface TopiaEntity
Returns:
all object that are aggregate with this instance, aggreate object are not removed automaticaly
Throws:
TopiaException - if any pb

hashCode

public int hashCode()
On utilise la date de creation comme hash code, cette date ne varie pas au cours du temps

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
On est sur que les objets sont bien les memes car s'il n'ont pas d'id cela veut dire qu'il ne vienne pas de la meme session donc qu'il sont nouveau et different, ou bien qu'ils viennent de la meme session et dans ce cas l'egalite == fonctionne.

Overrides:
equals in class Object

fireOnPreRead

protected void fireOnPreRead(String propertyName,
                             Object value)

fireOnPostRead

protected void fireOnPostRead(String propertyName,
                              Object value)

fireOnPostRead

protected void fireOnPostRead(String propertyName,
                              int index,
                              Object value)

fireOnPreWrite

protected void fireOnPreWrite(String propertyName,
                              Object oldValue,
                              Object newValue)

fireOnPostWrite

protected void fireOnPostWrite(String propertyName,
                               Object oldValue,
                               Object newValue)

fireOnPostWrite

protected void fireOnPostWrite(String propertyName,
                               int index,
                               Object oldValue,
                               Object newValue)

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Description copied from interface: TopiaEntity
Add listener for property writing.

Specified by:
addPropertyChangeListener in interface TopiaEntity
Parameters:
propertyName - name of property to listen
listener - the listener to register

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: TopiaEntity
Add listener for property writing.

Specified by:
addPropertyChangeListener in interface TopiaEntity
Parameters:
listener - the listener to register

addVetoableChangeListener

public void addVetoableChangeListener(String propertyName,
                                      VetoableChangeListener vetoable)
Specified by:
addVetoableChangeListener in interface TopiaEntity

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener vetoable)
Specified by:
addVetoableChangeListener in interface TopiaEntity

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface TopiaEntity

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface TopiaEntity

removeVetoableChangeListener

public void removeVetoableChangeListener(String propertyName,
                                         VetoableChangeListener vetoable)
Specified by:
removeVetoableChangeListener in interface TopiaEntity

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener vetoable)
Specified by:
removeVetoableChangeListener in interface TopiaEntity

addPropertyListener

public void addPropertyListener(String propertyName,
                                PropertyChangeListener listener)
Description copied from interface: TopiaEntity
Add listener for property reading.

Specified by:
addPropertyListener in interface TopiaEntity
Parameters:
propertyName - the property name to listen
listener - the listener to register

addPropertyListener

public void addPropertyListener(PropertyChangeListener listener)
Description copied from interface: TopiaEntity
Add listener for property reading.

Specified by:
addPropertyListener in interface TopiaEntity
Parameters:
listener - the listener to register

addVetoableListener

public void addVetoableListener(String propertyName,
                                VetoableChangeListener vetoable)
Specified by:
addVetoableListener in interface TopiaEntity

addVetoableListener

public void addVetoableListener(VetoableChangeListener vetoable)
Specified by:
addVetoableListener in interface TopiaEntity

removePropertyListener

public void removePropertyListener(String propertyName,
                                   PropertyChangeListener listener)
Specified by:
removePropertyListener in interface TopiaEntity

removePropertyListener

public void removePropertyListener(PropertyChangeListener listener)
Specified by:
removePropertyListener in interface TopiaEntity

removeVetoableListener

public void removeVetoableListener(String propertyName,
                                   VetoableChangeListener vetoable)
Specified by:
removeVetoableListener in interface TopiaEntity

removeVetoableListener

public void removeVetoableListener(VetoableChangeListener vetoable)
Specified by:
removeVetoableListener in interface TopiaEntity


Copyright © 2004-2010 CodeLutin. All Rights Reserved.