Interface MappingClassElement
-
- All Superinterfaces:
Comparable,MappingElement,MappingElementProperties
- All Known Implementing Classes:
MappingClassElementImpl
public interface MappingClassElement extends MappingElement
- Version:
- %I%
- Author:
- raccah
-
-
Field Summary
Fields Modifier and Type Field Description static intCHECK_ALL_AT_COMMIT_CONSISTENCYConstant representing Consistency level.static intCHECK_MODIFIED_AT_COMMIT_CONSISTENCYConstant representing Consistency level.static intLOCK_WHEN_LOADED_CONSISTENCYConstant representing Consistency level.static intLOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCYConstant representing Consistency level.static intLOCK_WHEN_MODIFIED_CONSISTENCYConstant representing Consistency level.static StringMAPPING_EXTENSIONConstant representing mapping file extension.static intNONE_CONSISTENCYConstant representing Consistency level.static intVERSION_CONSISTENCYConstant representing Consistency level.-
Fields inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElementProperties
PROP_ASSOCIATED_COLUMNS, PROP_COLUMNS, PROP_CONSISTENCY, PROP_DATABASE_ROOT, PROP_FETCH_GROUP, PROP_FIELDS, PROP_IN_CONCURRENCY_CHECK, PROP_KEY_COLUMNS, PROP_MODIFIED, PROP_NAME, PROP_NAVIGABLE, PROP_READ_ONLY, PROP_REFERENCING_KEYS, PROP_TABLE, PROP_TABLES, PROP_VERSION_FIELD
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddField(MappingFieldElement field)Adds a field to the list of fields in this mapping class.MappingReferenceKeyElementaddSecondaryTable(MappingTableElement parentTable, org.netbeans.modules.dbschema.TableElement table)Adds a reference to the supplied table as a secondary table for this mapping class.voidaddTable(org.netbeans.modules.dbschema.TableElement table)Convenience method which accepts a table element and attempts to add it as either a primary or secondary table depending on the existing list of tables and the foreign keys for the table.intgetConsistencyLevel()Gets the consistency level of this mapping class.StringgetDatabaseRoot()Returns the name of the SchemaElement which represents the database used by the tables mapped to this mapping class element.MappingFieldElementgetField(String name)Scans through this mapping class looking for a field whose name matches the name passed in.ArrayListgetFields()Returns the list of fields (MappingFieldElements) in this mapping class.MappingTableElementgetTable(String name)Scans through this mapping class looking for a table whose name matches the name passed in.ArrayListgetTables()Returns the list of tables (MappingTableElements) used by this mapping class.ListgetVersionFields()Returns the list of version fields (MappingFieldElements) in this mapping class.intgetVersionNumber()Returns the version number of this MappingClassElement object.booleanhasOldVersionNumber()Returns true if the version number of this MappingClassElement object is older than the current version number of the archiving scheme.booleanisModified()Gets the modified flag for this mapping class.booleanisNavigable()Gets the navigable flag for this mapping class.voidpostUnarchive()This method is called after a MappingClassElement is unarchived from a .mapping file.voidpreArchive()This method is called prior to storing a MappingClassElement in a .mapping file.voidremoveField(MappingFieldElement field)Removes a field from the list of fields in this mapping class.voidremoveTable(MappingTableElement table)Removes the reference to the supplied table as a mapped table for this mapping class.voidsetConsistencyLevel(int level)Set the consistency level of this mapping class.voidsetDatabaseRoot(org.netbeans.modules.dbschema.SchemaElement root)Set the database root for this MappingClassElement.voidsetModified(boolean flag)Set the modified flag for this mapping class to flag.voidsetNavigable(boolean flag)Set the navigable flag for this mapping class to flag.voidsetPrimaryTable(org.netbeans.modules.dbschema.TableElement table)Set the primary table for this mapping class to the supplied table.-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
-
-
-
-
Field Detail
-
MAPPING_EXTENSION
static final String MAPPING_EXTENSION
Constant representing mapping file extension.- See Also:
- Constant Field Values
-
NONE_CONSISTENCY
static final int NONE_CONSISTENCY
Constant representing Consistency level. NONE_CONSISTENCY implies that no consistency semantics are enforced.- See Also:
- Constant Field Values
-
CHECK_MODIFIED_AT_COMMIT_CONSISTENCY
static final int CHECK_MODIFIED_AT_COMMIT_CONSISTENCY
Constant representing Consistency level. CHECK_MODIFIED_AT_COMMIT_CONSISTENCY implies that at commit, consistency check is enforced for all fetched fields of modified objects.- See Also:
- Constant Field Values
-
CHECK_ALL_AT_COMMIT_CONSISTENCY
static final int CHECK_ALL_AT_COMMIT_CONSISTENCY
Constant representing Consistency level. CHECK_ALL_AT_COMMIT_CONSISTENCY implies that at commit, consistency check is enforced for all the fields of objects at this consistency level. Please note that this level is not supported in the current release.- See Also:
- Constant Field Values
-
LOCK_WHEN_MODIFIED_CONSISTENCY
static final int LOCK_WHEN_MODIFIED_CONSISTENCY
Constant representing Consistency level. LOCK_WHEN_MODIFIED_CONSISTENCY implies exclusive lock is obtained for data corresponding to this object when an attempt to modify the object is made. Please note that this level is not supported in the current release.- See Also:
- Constant Field Values
-
LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY
static final int LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY
Constant representing Consistency level. LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY implies exclusive lock is obtained for data corresponding to this object when an attempt to modify the object is made. Also at commit, consistency check is enforced for all the fields of objects at this consistency level. Please note that this level is not supported in the current release.- See Also:
- Constant Field Values
-
LOCK_WHEN_LOADED_CONSISTENCY
static final int LOCK_WHEN_LOADED_CONSISTENCY
Constant representing Consistency level. LOCK_WHEN_LOADED_CONSISTENCY implies that exclusive lock is obtained for data corresponding to this object before accessing it.- See Also:
- Constant Field Values
-
VERSION_CONSISTENCY
static final int VERSION_CONSISTENCY
Constant representing Consistency level. VERSION_CONSISTENCY implies that no lock is obtained for data corresponding to this object until it will be updated.- See Also:
- Constant Field Values
-
-
Method Detail
-
getVersionNumber
int getVersionNumber()
Returns the version number of this MappingClassElement object. Please note, the returned version number reflects the version number at the last save, NOT the version number of the memory representation.- Returns:
- version number
-
hasOldVersionNumber
boolean hasOldVersionNumber()
Returns true if the version number of this MappingClassElement object is older than the current version number of the archiving scheme.- Returns:
- true if it is in need of updating, false otherwise
- See Also:
getVersionNumber()
-
postUnarchive
void postUnarchive() throws ModelExceptionThis method is called after a MappingClassElement is unarchived from a .mapping file. This method provides a hook to do any checking (version number checking) and conversion after unarchiving.- Throws:
ModelException- if impossible
-
preArchive
void preArchive() throws ModelExceptionThis method is called prior to storing a MappingClassElement in a .mapping file. This method provides a hook to do any conversion before archiving.- Throws:
ModelException- if impossible
-
isModified
boolean isModified()
Gets the modified flag for this mapping class.- Returns:
trueif there have been (property) changes to this class,falseotherwise.
-
setModified
void setModified(boolean flag)
Set the modified flag for this mapping class to flag. This is usually set totrueby property changes andfalseafter a save.- Parameters:
flag- iftrue, this class is marked as modified; iffalse, it is marked as unmodified.
-
getConsistencyLevel
int getConsistencyLevel()
Gets the consistency level of this mapping class.- Returns:
- the consistency level, one of
NONE_CONSISTENCY,CHECK_MODIFIED_AT_COMMIT_CONSISTENCY,CHECK_ALL_AT_COMMIT_CONSISTENCY,LOCK_WHEN_MODIFIED_CONSISTENCY,LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY,LOCK_WHEN_LOADED_CONSISTENCY, orVERSION_CONSISTENCY.
-
setConsistencyLevel
void setConsistencyLevel(int level) throws ModelExceptionSet the consistency level of this mapping class.- Parameters:
level- an integer indicating the consistency level, one of:NONE_CONSISTENCY,CHECK_MODIFIED_AT_COMMIT_CONSISTENCY,CHECK_ALL_AT_COMMIT_CONSISTENCY,LOCK_WHEN_MODIFIED_CONSISTENCY,LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY,LOCK_WHEN_LOADED_CONSISTENCY, orVERSION_CONSISTENCY.- Throws:
ModelException- if impossible.
-
getDatabaseRoot
String getDatabaseRoot()
Returns the name of the SchemaElement which represents the database used by the tables mapped to this mapping class element.- Returns:
- the name of the database root for this mapping class
-
setDatabaseRoot
void setDatabaseRoot(org.netbeans.modules.dbschema.SchemaElement root) throws ModelExceptionSet the database root for this MappingClassElement. The root represents the database used by the tables mapped to this mapping class.- Parameters:
root- the new database root- Throws:
ModelException- if impossible
-
getTables
ArrayList getTables()
Returns the list of tables (MappingTableElements) used by this mapping class.- Returns:
- the meta data tables for this mapping class
-
getTable
MappingTableElement getTable(String name)
Scans through this mapping class looking for a table whose name matches the name passed in.- Parameters:
name- name of the table to find.- Returns:
- the meta data table whose name matches the name parameter
-
addTable
void addTable(org.netbeans.modules.dbschema.TableElement table) throws ModelExceptionConvenience method which accepts a table element and attempts to add it as either a primary or secondary table depending on the existing list of tables and the foreign keys for the table.- Parameters:
table- table element to be added as either a primary or secondary table.- Throws:
ModelException- if impossible
-
setPrimaryTable
void setPrimaryTable(org.netbeans.modules.dbschema.TableElement table) throws ModelExceptionSet the primary table for this mapping class to the supplied table.- Parameters:
table- table element to be used as the primary table.- Throws:
ModelException- if impossible
-
addSecondaryTable
MappingReferenceKeyElement addSecondaryTable(MappingTableElement parentTable, org.netbeans.modules.dbschema.TableElement table) throws ModelException
Adds a reference to the supplied table as a secondary table for this mapping class. It creates a MappingReferenceKeyElement for the supplied primary/secondary table pair.- Parameters:
parentTable- mapping table element which should also be the primary table.table- table element to be used as a secondary table.- Throws:
ModelException- if impossible
-
removeTable
void removeTable(MappingTableElement table) throws ModelException
Removes the reference to the supplied table as a mapped table for this mapping class. This works whether the table is the primary table or a secondary table.- Parameters:
table- mapping table element to be removed from this mapping class.- Throws:
ModelException- if impossible
-
getFields
ArrayList getFields()
Returns the list of fields (MappingFieldElements) in this mapping class. This list includes both local and relationship fields.- Returns:
- the mapping fields in this mapping class
-
getField
MappingFieldElement getField(String name)
Scans through this mapping class looking for a field whose name matches the name passed in.- Parameters:
name- name of the field to find.- Returns:
- the mapping field whose name matches the name parameter
-
addField
void addField(MappingFieldElement field) throws ModelException
Adds a field to the list of fields in this mapping class.- Parameters:
field- field element to be added- Throws:
ModelException- if impossible
-
removeField
void removeField(MappingFieldElement field) throws ModelException
Removes a field from the list of fields in this mapping class.- Parameters:
field- field element to be removed- Throws:
ModelException- if impossible
-
getVersionFields
List getVersionFields()
Returns the list of version fields (MappingFieldElements) in this mapping class. This list only includes fields if the consistency level isVERSION_CONSISTENCY.- Returns:
- the version fields in this mapping class
-
isNavigable
boolean isNavigable()
Gets the navigable flag for this mapping class.- Returns:
trueif lazy initialization will be used,falseif access to a non-fetched field will result in an exception. The default istrue.
-
setNavigable
void setNavigable(boolean flag) throws ModelExceptionSet the navigable flag for this mapping class to flag.- Parameters:
flag- iftrue, lazy initialization will be used; iffalse, access to a non-fetched field will result in an exception.- Throws:
ModelException- if impossible
-
-