org.objectweb.speedo.metadata
Class SpeedoClass

java.lang.Object
  extended by org.objectweb.speedo.metadata.SpeedoElement
      extended by org.objectweb.speedo.metadata.SpeedoClass
All Implemented Interfaces:
java.io.Serializable

public class SpeedoClass
extends SpeedoElement

Describes a persistence capable class.

Author:
S.Chassande-Barrioz
See Also:
Serialized Form

Field Summary
static byte ALREADY_ENHANCED
          The class has been previously enhanced and no additional operation is required.
 java.util.HashMap callBacks
          Register some callback methods and their associated application method to which the callback is mapped.
static byte ENHANCEMENT_FAILED
          The enhancement of the class has failed.
static byte ENHANCEMENT_REQUIRED
          The enhancement is required.
 byte enhancementStatus
          Specify the status of the persistent class with regards to the enhancement process.
 java.util.Map fetchGroups
          Description of fetchgroups defined for this class.
 java.util.Map fields
          Description of persistent capable fields of this class.
 SpeedoIdentity identity
          Defines the identifier of the persistent class.
 SpeedoInheritance inheritance
          Defines the inheritance strategy if this class inherits from a persistent class.
 boolean isAbstract
          Indicates if the class is abstract.
 boolean isDetachable
          Attribute detachable.
 boolean isInstanceCallbacks
          Indicates if the class implements InstanceCallbacks
 boolean isSerializable
          Indicates if the class implements Serailizable
 SpeedoJoin[] joinToExtTables
          Is the join to reach external tables.
 org.objectweb.jorm.metainfo.api.Class jormclass
          JORM meta object corresponding to this Speedo meta object.
 SpeedoTable mainTable
          The main table of the persistent class.
 SpeedoPackage moPackage
          Description of the package which contains this class.
 java.lang.String name
          Class name.
 java.util.Map name2query
          Contains the predefined query key = a query name value = the SpeedoPredefinedQuery instance
 java.lang.String nameForQuery
          Class name for queries.
static byte NO_NO_ARG_CONSTRUCTOR
          The persistent class has no no-arg constructor.
 byte noArgConstructorStatus
          Qualifies the status of the no-arg constructor of the persistent class.
static byte NON_PUBLIC_NO_ARG_CONSTRUCTOR
          The persistent class has no-arg constructor but it is not public
static byte PUBLIC_NO_ARG_CONSTRUCTOR
          The persistent class has a public no-arg constructor.
 SpeedoVersion version
          Description of the version.
 SpeedoField versionField
          Defines the field used for database optimitic locking policy.
 
Fields inherited from class org.objectweb.speedo.metadata.SpeedoElement
jdoExtension, personality
 
Constructor Summary
SpeedoClass()
           
 
Method Summary
 void add(java.lang.Object field)
          Adds a SpeedoField to the class.
 void add(java.lang.Object field, boolean failsOnError, org.objectweb.util.monolog.api.Logger logger)
          Adds a SpeedoField to the class.
 void addFetchGroup(java.lang.Object fetchGroup)
          Adds a SpeedoFetchGroup to the class.
 void addFetchGroup(java.lang.Object fetchGroup, boolean failsOnError, org.objectweb.util.monolog.api.Logger logger)
          Adds a SpeedoFetchgroup to the class.
 void addJoin(SpeedoJoin j)
           
 int computeFieldNumbers()
          Computes the field numbers for the fields of this class.
 boolean containsJoin(SpeedoJoin join)
           
 boolean enhancementFailed()
           
 boolean generateObjectId()
           
 SpeedoClass getAncestor()
           
 SpeedoColumn getColumn(java.lang.String colname, boolean mainonly)
          Look for a column with a given name defined into the given SpeedoClass.
 SpeedoTable getExtTable(java.lang.String tableName, boolean createifnone)
           
 SpeedoField getField(java.lang.String fieldName)
          Finds a field from its name.
 SpeedoField getFieldFromColumn(java.lang.String colname)
           
 java.lang.String getFQName()
           
 byte getIdentityType()
           
 SpeedoField getInheritedField(java.lang.String name)
           
 SpeedoJoin getJoin(java.lang.String tableName)
           
 SpeedoJoin getJoin(java.lang.String tableName, boolean createifnone)
           
 int getJoinIndex(SpeedoJoin join)
           
 java.lang.String getJormFileName()
           
 java.lang.String getObjectidClass()
           
 java.util.List getParents()
           
 int getPkFieldCount()
           
 java.util.List getPKFields()
           
 java.lang.String getSourceDesc()
           
 java.lang.String getSourceDescShort()
           
 SpeedoClass getSpeedoClassFromContext(java.lang.String className)
           
 SpeedoClass getSuper()
           
 java.lang.String getSuperClassName()
           
 java.util.List getTableIndexes()
           
 SpeedoField getUniquePKField()
          Find in the class or in its parent, the unique persistent field marked as primary key.
 java.lang.String getXMLFileName()
           
 boolean isAlreadyEnhanced()
           
 void removeJoin(SpeedoJoin j)
           
 boolean requireEnhancement()
           
 void setAlreadyEnhanced(boolean v)
           
 void setDatastoreIdSequenceName(java.lang.String sequenceName)
           
 void setIdentityType(byte identityType)
           
 void setRequireEnhancement(boolean v)
           
 void setSuperClassName(java.lang.String superClassName)
           
 java.lang.String toString()
          Transforms a SpeedoClass into a String.
 
Methods inherited from class org.objectweb.speedo.metadata.SpeedoElement
addExtension, addInArray, getExtension, getExtensionByKey, getExtensionValueByKey, indexOfInArray, removeInArray, setValueInArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALREADY_ENHANCED

public static final byte ALREADY_ENHANCED
The class has been previously enhanced and no additional operation is required.

See Also:
Constant Field Values

ENHANCEMENT_REQUIRED

public static final byte ENHANCEMENT_REQUIRED
The enhancement is required.

See Also:
Constant Field Values

ENHANCEMENT_FAILED

public static final byte ENHANCEMENT_FAILED
The enhancement of the class has failed.

See Also:
Constant Field Values

NO_NO_ARG_CONSTRUCTOR

public static final byte NO_NO_ARG_CONSTRUCTOR
The persistent class has no no-arg constructor.

See Also:
Constant Field Values

NON_PUBLIC_NO_ARG_CONSTRUCTOR

public static final byte NON_PUBLIC_NO_ARG_CONSTRUCTOR
The persistent class has no-arg constructor but it is not public

See Also:
Constant Field Values

PUBLIC_NO_ARG_CONSTRUCTOR

public static final byte PUBLIC_NO_ARG_CONSTRUCTOR
The persistent class has a public no-arg constructor.

See Also:
Constant Field Values

name

public java.lang.String name
Class name.


nameForQuery

public java.lang.String nameForQuery
Class name for queries.


moPackage

public SpeedoPackage moPackage
Description of the package which contains this class.


identity

public SpeedoIdentity identity
Defines the identifier of the persistent class.


versionField

public SpeedoField versionField
Defines the field used for database optimitic locking policy.


inheritance

public SpeedoInheritance inheritance
Defines the inheritance strategy if this class inherits from a persistent class.


version

public SpeedoVersion version
Description of the version.


isDetachable

public boolean isDetachable
Attribute detachable.


fields

public java.util.Map fields
Description of persistent capable fields of this class. The HashMap key is the field name.


fetchGroups

public java.util.Map fetchGroups
Description of fetchgroups defined for this class. The HashMap key is the field name.


isAbstract

public boolean isAbstract
Indicates if the class is abstract.


isInstanceCallbacks

public boolean isInstanceCallbacks
Indicates if the class implements InstanceCallbacks


isSerializable

public boolean isSerializable
Indicates if the class implements Serailizable


jormclass

public org.objectweb.jorm.metainfo.api.Class jormclass
JORM meta object corresponding to this Speedo meta object.


callBacks

public java.util.HashMap callBacks
Register some callback methods and their associated application method to which the callback is mapped. It contains an Integer key identifying a particular callback, which is associated with an ArrayList of methods to be called when this callback is fired. Such methods are specified through a metaobject specifying the callback:

See Also:
SpeedoCallback, HomeItf.PRE_NEW

enhancementStatus

public byte enhancementStatus
Specify the status of the persistent class with regards to the enhancement process. The 3 only possible state are #ALREADY_ENHANCED, #ENHANCEMENT_REQUIRED or #ENHANCEMENT_FAILED.

See Also:
ALREADY_ENHANCED, ENHANCEMENT_REQUIRED, ENHANCEMENT_FAILED

name2query

public java.util.Map name2query
Contains the predefined query key = a query name value = the SpeedoPredefinedQuery instance

See Also:
SpeedoPredefinedQuery

noArgConstructorStatus

public byte noArgConstructorStatus
Qualifies the status of the no-arg constructor of the persistent class.

See Also:
NO_NO_ARG_CONSTRUCTOR, NON_PUBLIC_NO_ARG_CONSTRUCTOR, PUBLIC_NO_ARG_CONSTRUCTOR

mainTable

public SpeedoTable mainTable
The main table of the persistent class. External tables are reachable from joins.

See Also:
joinToExtTables

joinToExtTables

public SpeedoJoin[] joinToExtTables
Is the join to reach external tables. It can be null if there is no external table.

Constructor Detail

SpeedoClass

public SpeedoClass()
Method Detail

getObjectidClass

public java.lang.String getObjectidClass()

getFQName

public java.lang.String getFQName()
Returns:
the fully qualified name of the class (include the package name) the package separator is a dot

toString

public java.lang.String toString()
Transforms a SpeedoClass into a String.

Overrides:
toString in class java.lang.Object
Returns:
the Sting corresponding to the SpeedoClass.

enhancementFailed

public boolean enhancementFailed()

isAlreadyEnhanced

public boolean isAlreadyEnhanced()

setAlreadyEnhanced

public void setAlreadyEnhanced(boolean v)

requireEnhancement

public boolean requireEnhancement()

setRequireEnhancement

public void setRequireEnhancement(boolean v)

add

public void add(java.lang.Object field)
Adds a SpeedoField to the class. Precondition: this field doesn't exist in the jdoFields HashMap.

Parameters:
field - field to add.

add

public void add(java.lang.Object field,
                boolean failsOnError,
                org.objectweb.util.monolog.api.Logger logger)
         throws SpeedoException
Adds a SpeedoField to the class.

Parameters:
field - field to add.
failsOnError - if an error must be thrown or creates a warning.
logger - logger for writting warn message if necessary.
Throws:
SpeedoException - if the field was already defined into the class.

setDatastoreIdSequenceName

public void setDatastoreIdSequenceName(java.lang.String sequenceName)

addFetchGroup

public void addFetchGroup(java.lang.Object fetchGroup)
Adds a SpeedoFetchGroup to the class. Precondition: this fetchgroup doesn't exist in the jdoFtechGroups HashMap.

Parameters:
fetchGroup - the fetchgroup to add.

addFetchGroup

public void addFetchGroup(java.lang.Object fetchGroup,
                          boolean failsOnError,
                          org.objectweb.util.monolog.api.Logger logger)
                   throws SpeedoException
Adds a SpeedoFetchgroup to the class.

Parameters:
fetchGroup - the fetchgroup to add.
failsOnError - if an error must be thrown or creates a warning.
logger - logger for writting warn message if necessary.
Throws:
SpeedoException - if the field was already defined into the class.

computeFieldNumbers

public int computeFieldNumbers()
Computes the field numbers for the fields of this class.

Returns:
the number of fields of this class (including inherited fields).

getJormFileName

public java.lang.String getJormFileName()

generateObjectId

public boolean generateObjectId()

getPkFieldCount

public int getPkFieldCount()

getPKFields

public java.util.List getPKFields()

getUniquePKField

public SpeedoField getUniquePKField()
                             throws SpeedoException
Find in the class or in its parent, the unique persistent field marked as primary key.

Returns:
the unique pk fields if it exists one, null otherwise.
Throws:
SpeedoException - if there are several persistent fields marked as primary key.

getSpeedoClassFromContext

public SpeedoClass getSpeedoClassFromContext(java.lang.String className)

getXMLFileName

public java.lang.String getXMLFileName()

getSuper

public SpeedoClass getSuper()

getInheritedField

public SpeedoField getInheritedField(java.lang.String name)

getAncestor

public SpeedoClass getAncestor()

getField

public SpeedoField getField(java.lang.String fieldName)
Finds a field from its name. The fields can belong this class or an ancestor of this class.

Parameters:
fieldName - is the name of a persistent field. the name can be fully qualified (ie the field name is prefixed by the class name, the separator is a dot or #)
Returns:
the SpeedoField instance if it has been found., otherwise null

getFieldFromColumn

public SpeedoField getFieldFromColumn(java.lang.String colname)

setIdentityType

public void setIdentityType(byte identityType)

getIdentityType

public byte getIdentityType()

setSuperClassName

public void setSuperClassName(java.lang.String superClassName)
                       throws SpeedoException
Throws:
SpeedoException

getSuperClassName

public java.lang.String getSuperClassName()

addJoin

public void addJoin(SpeedoJoin j)

removeJoin

public void removeJoin(SpeedoJoin j)

getSourceDesc

public java.lang.String getSourceDesc()

getSourceDescShort

public java.lang.String getSourceDescShort()

getJoin

public SpeedoJoin getJoin(java.lang.String tableName)

getJoin

public SpeedoJoin getJoin(java.lang.String tableName,
                          boolean createifnone)

getJoinIndex

public int getJoinIndex(SpeedoJoin join)

containsJoin

public boolean containsJoin(SpeedoJoin join)

getExtTable

public SpeedoTable getExtTable(java.lang.String tableName,
                               boolean createifnone)

getColumn

public SpeedoColumn getColumn(java.lang.String colname,
                              boolean mainonly)
Look for a column with a given name defined into the given SpeedoClass.

Parameters:
colname - The name of the column.
mainonly - Speficy if we must look only for main table columns.
Returns:
The column found or null if none.

getTableIndexes

public java.util.List getTableIndexes()

getParents

public java.util.List getParents()