ch.elca.el4j.services.persistence.generic.dto
Class AbstractIntKeyIntOptimisticLockingDto

java.lang.Object
  extended by ch.elca.el4j.services.persistence.generic.dto.AbstractIntOptimisticLockingDto
      extended by ch.elca.el4j.services.persistence.generic.dto.AbstractIntKeyIntOptimisticLockingDto
All Implemented Interfaces:
OptimisticLockingObject, PrimaryKeyObject, PrimaryKeyOptimisticLockingObject, Serializable

@MappedSuperclass
public abstract class AbstractIntKeyIntOptimisticLockingDto
extends AbstractIntOptimisticLockingDto
implements PrimaryKeyOptimisticLockingObject

This class is an abstract dto which uses an integer as key value and also an integer for optimistic locking version controlling.

Author:
Martin Zeltner (MZE)
See Also:
Serialized Form
File-location:
AbstractIntKeyIntOptimisticLockingDto
Last check-in date:
2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873

Constructor Summary
AbstractIntKeyIntOptimisticLockingDto()
           
 
Method Summary
 boolean equals(Object obj)
          
 int getKey()
           
 Object getKeyAsObject()
          
 int hashCode()
          
 boolean isKeyNew()
           
 void resetNew()
          Reset the key state to "new".
 void setKey(int key)
           
 void setKey(Object keyObject)
          Convenience method to set the key.
 void useGeneratedKey()
          This method will be called when the primary key object is requested to generate a key object for himself.
 
Methods inherited from class ch.elca.el4j.services.persistence.generic.dto.AbstractIntOptimisticLockingDto
getOptimisticLockingVersion, increaseOptimisticLockingVersion, setOptimisticLockingVersion
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.elca.el4j.services.persistence.generic.dto.OptimisticLockingObject
increaseOptimisticLockingVersion
 

Constructor Detail

AbstractIntKeyIntOptimisticLockingDto

public AbstractIntKeyIntOptimisticLockingDto()
Method Detail

getKey

public int getKey()
Returns:
Returns the key.

getKeyAsObject

public Object getKeyAsObject()

Specified by:
getKeyAsObject in interface PrimaryKeyObject
Returns:
Returns the key as an object or null if it does not exist.

setKey

public void setKey(int key)
Parameters:
key - The key to set.

setKey

public void setKey(Object keyObject)
Convenience method to set the key. The given parameter must be an Number otherwise it will be rejected.

Specified by:
setKey in interface PrimaryKeyObject
Parameters:
keyObject - Is the key as object to set.

isKeyNew

public boolean isKeyNew()
Specified by:
isKeyNew in interface PrimaryKeyObject
Returns:
Returns true if the key has never be set by using method setKey.

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

resetNew

public void resetNew()
Reset the key state to "new". This is required in some circumstances (offlining), otherwise it should NOT be used.


useGeneratedKey

public void useGeneratedKey()
This method will be called when the primary key object is requested to generate a key object for himself. Does nothing, because primary key will be generated by database.

Specified by:
useGeneratedKey in interface PrimaryKeyObject


Copyright © 2005-2011 ELCA. All Rights Reserved.