com.mizar.persistence.jpa.beans
Class GenericBean

java.lang.Object
  extended by com.mizar.persistence.jpa.beans.GenericBean
All Implemented Interfaces:
JPAInterface, java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
Addr, AddrBean, Addrfn, AddrfnBean, AllIndColumnsBean, AllIndexesBean, AllProceduresBean, AllSdoGeomMetadataBean, AllTabColumnsBean, AllTablesBean, Ancestry, ApplicationLogBean, BasemapBean, BaseMapRow, BasemapStatusBean, BasemapTypeBean, CachedMapsRow, CharacteristicIterations, DbcensusColumn, DbcensusGroup, DbcensusTable, DcrawBean, DeliveryMethodBean, DownloadRequestBean, Facesah, Facesah, Facesal, Facesal, FacilityTypeBean, Featnames, FeatnamesBean, FeatureOfInterestRow, GeometryBean, GroupBean, GroupQuarters, HispanicLatino, Industry, Language, LoginHistory, MapOverlayRow, MdsysSdoGeomMetadataTableBean, MediaBean, Mtfcc, Mtfcc00, MtfccBean, PermissionBean, Race, Race, Race, RequestStatusBean, RequestTypeBean, RoleBean, SdoCachedMapsSuperClass, SdoCachedMapsTemplateBean, SdoCoordAxes, SdoCoordRefSys, SdoDiminfoTemplateBean, SdoMapsSuperClass, SdoStylesSuperClass, SdoThemesSuperClass, SdoThemesSuperClassFactory, SessionLogBean, SiteType, StateCountry, StreetName, StreetType, Uf1Geo, Uf1P1, Uf1P2, Uf1P3, Uf1P4, Uf1P5, Uf1P6, UscensusColumn, UscensusTable, UsdbcensusColumnJoin, UserBean, UserPropertiesBean, UserPropertiesNameBean, UserSdoGeomMetadataBean, UserSequencesBean, UserSynonymsBean, UserTabColumnsBean, UserTablesBean, VsgastatBean

public abstract class GenericBean
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable, JPAInterface

See Also:
RowInterface, Serialized Form

Field Summary
protected  org.apache.commons.logging.Log _logger
           
static int DELETE
           
static int EDIT
           
static int NEW
           
static int READ
           
protected static long serialVersionUID
           
 
Constructor Summary
GenericBean()
           
 
Method Summary
 int compareTo(java.lang.Object otherGenericBean)
          This generic method compares primary key values only
 boolean equals(java.lang.Object other)
           
static int getDELETE()
          Provided to expose constants to JSF EL
static int getEDIT()
          Provided to expose constants to JSF EL
 int getEntityState()
           
 java.lang.String getEntityStateLabel()
           
protected  org.apache.commons.logging.Log getLogger()
           
static int getNEW()
          Provided to expose constants to JSF EL
 java.lang.Object getPrimaryKeyValue()
          NOTE: If an implementing bean expects to be extended by a RowInterface in a often-used Table, you should override this method in order to avoid the overheads associated with the reflective code in JPAUtils.getPrimaryKeyValue(this)
static int getREAD()
          Provided to expose constants to JSF EL
 int hashCode()
           
 boolean isEditable()
           
 boolean isNew()
           
 void setEditable(boolean state)
          The method will set entityState to GenericBean.READ if state is false.
 void setEntityState(int state)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

READ

public static final int READ
See Also:
Constant Field Values

NEW

public static final int NEW
See Also:
Constant Field Values

EDIT

public static final int EDIT
See Also:
Constant Field Values

DELETE

public static final int DELETE
See Also:
Constant Field Values

serialVersionUID

protected static final long serialVersionUID
See Also:
Constant Field Values

_logger

protected org.apache.commons.logging.Log _logger
Constructor Detail

GenericBean

public GenericBean()
Method Detail

getLogger

protected org.apache.commons.logging.Log getLogger()

setEntityState

public void setEntityState(int state)
Parameters:
state - must be one of GenericBean.READ, .NEW, .EDIT, or .DELETE

getEntityState

public int getEntityState()
Returns:
one of GenericBean.READ, .NEW, .EDIT, or .DELETE

getEntityStateLabel

public java.lang.String getEntityStateLabel()
Returns:
one of "New", "Edit", "Review", "Deleted", or "Undefined"

setEditable

public void setEditable(boolean state)
The method will set entityState to GenericBean.READ if state is false. Otherwise it will set entityState to GenericBean.NEW if getPrimaryKeyValue() returns null and GenericBean.READ if not.

Parameters:
state -

isEditable

public boolean isEditable()
Returns:
true if getEntityState() returns GenericBean.NEW or GenericBean.EDIT, otherwise false.

isNew

public boolean isNew()
Returns:
true if getEntityState() returns GenericBean.NEW

getPrimaryKeyValue

public java.lang.Object getPrimaryKeyValue()

NOTE: If an implementing bean expects to be extended by a RowInterface in a often-used Table, you should override this method in order to avoid the overheads associated with the reflective code in JPAUtils.getPrimaryKeyValue(this)

 public Object getPrimaryKeyValue(){
   return getProperty();
 }
 

In the absence of an overriding method, this method provides a generic method to get the value of the primary key. This is especially useful for calls to em.find(object) from within abstract classes

Returns:
JPAUtils#getPrimaryKeyValue(this)
See Also:
RowInterface.getPrimaryKeyValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
#getPrimaryKeyValue().toString()

compareTo

public int compareTo(java.lang.Object otherGenericBean)
              throws java.lang.ClassCastException
This generic method compares primary key values only

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
otherGenericBean -
Returns:
Throws:
java.lang.ClassCastException

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object
Parameters:
other -
Returns:
true or false if reference values are all equal
See Also:
compareTo(Object)

hashCode

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

getREAD

public static int getREAD()
Provided to expose constants to JSF EL

Returns:
GenericBean.READ

getNEW

public static int getNEW()
Provided to expose constants to JSF EL

Returns:
GenericBean.NEW

getEDIT

public static int getEDIT()
Provided to expose constants to JSF EL

Returns:
GenericBean.EDIT

getDELETE

public static int getDELETE()
Provided to expose constants to JSF EL

Returns:
GenericBean.DELETE