FileDocCategorySizeDatePackage
MappingClassElement.javaAPI DocGlassfish v2 API12245Fri May 04 22:34:44 BST 2007com.sun.jdo.api.persistence.model.mapping

MappingClassElement

public interface MappingClassElement implements MappingElement
author
raccah
version
%I%

Fields Summary
public static final String
MAPPING_EXTENSION
Constant representing mapping file extension.
public static final int
NONE_CONSISTENCY
Constant representing Consistency level. NONE_CONSISTENCY implies that no consistency semantics are enforced.
public 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.
public 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.
public 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.
public 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.
public 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.
public 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.
Constructors Summary
Methods Summary
public voidaddField(MappingFieldElement field)
Adds a field to the list of fields in this mapping class.

param
field field element to be added
exception
ModelException if impossible

public MappingReferenceKeyElementaddSecondaryTable(MappingTableElement parentTable, org.netbeans.modules.dbschema.TableElement table)
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.

param
parent mapping table element which should also be the primary table.
param
table table element to be used as a secondary table.
exception
ModelException if impossible

public 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.

param
table table element to be added as either a primary or secondary table.
exception
ModelException if impossible

public intgetConsistencyLevel()
Gets the consistency level of this mapping class.

return
the consistency level, one of {@link #NONE_CONSISTENCY}, {@link #CHECK_MODIFIED_AT_COMMIT_CONSISTENCY}, {@link #CHECK_ALL_AT_COMMIT_CONSISTENCY}, {@link #LOCK_WHEN_MODIFIED_CONSISTENCY}, {@link #LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY}, {@link #LOCK_WHEN_LOADED_CONSISTENCY}, or {@link #VERSION_CONSISTENCY}.

public java.lang.StringgetDatabaseRoot()
Returns the name of the SchemaElement which represents the database used by the tables mapped to this mapping class element.

return
the name of the database root for this mapping class

public MappingFieldElementgetField(java.lang.String name)
Scans through this mapping class looking for a field whose name matches the name passed in.

param
name name of the field to find.
return
the mapping field whose name matches the name parameter

public java.util.ArrayListgetFields()
Returns the list of fields (MappingFieldElements) in this mapping class. This list includes both local and relationship fields.

return
the mapping fields in this mapping class

public MappingTableElementgetTable(java.lang.String name)
Scans through this mapping class looking for a table whose name matches the name passed in.

param
name name of the table to find.
return
the meta data table whose name matches the name parameter

public java.util.ArrayListgetTables()
Returns the list of tables (MappingTableElements) used by this mapping class.

return
the meta data tables for this mapping class

public java.util.ListgetVersionFields()
Returns the list of version fields (MappingFieldElements) in this mapping class. This list only includes fields if the consistency level is {@link #VERSION_CONSISTENCY}.

return
the version fields in this mapping class

public intgetVersionNumber()
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.

return
version number

public booleanhasOldVersionNumber()
Returns true if the version number of this MappingClassElement object is older than the current version number of the archiving scheme.

see
#getVersionNumber
return
true if it is in need of updating, false otherwise

public booleanisModified()
Gets the modified flag for this mapping class.

return
true if there have been (property) changes to this class, false otherwise.

public booleanisNavigable()
Gets the navigable flag for this mapping class.

return
true if lazy initialization will be used, false if access to a non-fetched field will result in an exception. The default is true.

public voidpostUnarchive()
This 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.

exception
ModelException if impossible

public voidpreArchive()
This method is called prior to storing a MappingClassElement in a .mapping file. This method provides a hook to do any conversion before archiving.

exception
ModelException if impossible

public voidremoveField(MappingFieldElement field)
Removes a field from the list of fields in this mapping class.

param
field field element to be removed
exception
ModelException if impossible

public voidremoveTable(MappingTableElement table)
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.

param
table mapping table element to be removed from this mapping class.
exception
ModelException if impossible

public voidsetConsistencyLevel(int level)
Set the consistency level of this mapping class.

param
level an integer indicating the consistency level, one of: {@link #NONE_CONSISTENCY},{@link #CHECK_MODIFIED_AT_COMMIT_CONSISTENCY}, {@link #CHECK_ALL_AT_COMMIT_CONSISTENCY}, {@link #LOCK_WHEN_MODIFIED_CONSISTENCY}, {@link #LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY}, {@link #LOCK_WHEN_LOADED_CONSISTENCY}, or {@link #VERSION_CONSISTENCY}.
exception
ModelException if impossible.

public voidsetDatabaseRoot(org.netbeans.modules.dbschema.SchemaElement root)
Set the database root for this MappingClassElement. The root represents the database used by the tables mapped to this mapping class.

param
root the new database root
exception
ModelException if impossible

public voidsetModified(boolean flag)
Set the modified flag for this mapping class to flag. This is usually set to true by property changes and false after a save.

param
flag if true, this class is marked as modified; if false, it is marked as unmodified.

public voidsetNavigable(boolean flag)
Set the navigable flag for this mapping class to flag.

param
flag if true, lazy initialization will be used; if false, access to a non-fetched field will result in an exception.
exception
ModelException if impossible

public voidsetPrimaryTable(org.netbeans.modules.dbschema.TableElement table)
Set the primary table for this mapping class to the supplied table.

param
table table element to be used as the primary table.
exception
ModelException if impossible