public class MappingClassElementImpl extends MappingElementImpl implements MappingClassElement
Modifier and Type | Field and Description |
---|---|
static int |
CLONE_DEEP |
static int |
CLONE_FIELDS |
static int |
CLONE_MASK |
static int |
NAVIGABLE |
CHECK_ALL_AT_COMMIT_CONSISTENCY, CHECK_MODIFIED_AT_COMMIT_CONSISTENCY, LOCK_WHEN_LOADED_CONSISTENCY, LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY, LOCK_WHEN_MODIFIED_CONSISTENCY, MAPPING_EXTENSION, NONE_CONSISTENCY, VERSION_CONSISTENCY
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
Constructor and Description |
---|
MappingClassElementImpl()
Create new MappingClassElementImpl with no corresponding persistence
element or name.
|
MappingClassElementImpl(PersistenceClassElement element)
Creates new MappingClassElementImpl with a corresponding
PersistenceClassElement
|
MappingClassElementImpl(String name)
Creates new MappingClassElementImpl with the corresponding name
|
Modifier and Type | Method and Description |
---|---|
void |
addField(MappingFieldElement field)
Adds a field to the list of fields in this mapping class.
|
MappingReferenceKeyElement |
addSecondaryTable(MappingTableElement parentTable,
org.netbeans.modules.dbschema.TableElement table)
Adds a reference to the supplied table as a secondary table for this
mapping class.
|
void |
addTable(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.
|
protected void |
firePropertyChange(String name,
Object o,
Object n)
Fires property change event.
|
protected void |
fireVetoableChange(String name,
Object o,
Object n)
Fires vetoable change event.
|
static MappingClassElement |
forName(String name,
Model model)
Returns the mapping class element associated with the class with the
given string name, using the given model object to look it up.
|
int |
getConsistencyLevel()
Gets the consistency level of this mapping class.
|
String |
getDatabaseRoot()
Returns the name of the SchemaElement which represents the
database used by the tables mapped to this mapping class.
|
MappingFieldElement |
getField(String name)
Scans through this mapping class looking for a field whose
name matches the name passed in.
|
ArrayList |
getFields()
Returns the list of fields (MappingFieldElements) in this mapping
class.
|
String |
getKeyClass()
Get the fully qualified name of the primary key class for this class
element.
|
PersistenceClassElement |
getPersistenceElement() |
int |
getProperties() |
MappingTableElement |
getTable(String name)
Scans through this mapping class looking for a table whose
name matches the name passed in.
|
ArrayList |
getTables()
Returns the list of tables (MappingTableElements) used by this mapping
class.
|
List |
getVersionFields()
Returns the list of version fields (MappingFieldElements) in this
mapping class.
|
int |
getVersionNumber()
Returns the version number of this MappingClassElement object.
|
boolean |
hasOldVersionNumber()
Returns true if the version number of this MappingClassElement object
is older than the current version number of the archiving scheme.
|
boolean |
isModified()
Gets the modified flag for this mapping class.
|
boolean |
isNavigable()
Gets the navigable flag for this mapping class.
|
void |
postUnarchive()
This method is called after a MappingClassElement is unarchived
from a .mapping file.
|
void |
preArchive()
This method is called prior to storing a MappingClassElement in a
.mapping file.
|
void |
removeField(MappingFieldElement field)
Removes a field from the list of fields in this mapping class.
|
void |
removeTable(MappingTableElement table)
Removes the reference to the supplied table as a mapped table for this
mapping class.
|
void |
setConsistencyLevel(int level)
Set the consistency level of this mapping class.
|
void |
setDatabaseRoot(org.netbeans.modules.dbschema.SchemaElement root)
Set the database root for this MappingClassElement.
|
void |
setFields(ArrayList fields)
Set the list of fields (MappingFieldElements) in this mapping
class.
|
void |
setModified(boolean flag)
Set the modified flag for this mapping class to flag.
|
void |
setNavigable(boolean flag)
Set the navigable flag for this mapping class to flag.
|
void |
setPersistenceElement(PersistenceClassElement element)
Set the persistence class element for this mapping class element.
|
void |
setPrimaryTable(org.netbeans.modules.dbschema.TableElement table)
Set the primary table for this mapping class to the supplied table.
|
protected void |
stripSchemaName()
Boston to Pilsen conversion.
|
protected static ArrayList |
toColumnObjects(String schemaName,
ArrayList columnNames)
Accept an arraylist of column names and return an array list containing
the corresponding column or column pair objects.
|
addPropertyChangeListener, addVetoableChangeListener, compareTo, equals, getMessages, getName, hashCode, removePropertyChangeListener, removeVetoableChangeListener, setName, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
compareTo
public static final int CLONE_FIELDS
public static final int CLONE_DEEP
public static final int CLONE_MASK
public static final int NAVIGABLE
public MappingClassElementImpl()
public MappingClassElementImpl(String name)
name
- the name of the elementpublic MappingClassElementImpl(PersistenceClassElement element)
element
- the persistence element with which to be associatedpublic int getVersionNumber()
getVersionNumber
in interface MappingClassElement
public boolean hasOldVersionNumber()
hasOldVersionNumber
in interface MappingClassElement
getVersionNumber()
public static MappingClassElement forName(String name, Model model)
name
- the fully qualified name of the desired classmodel
- the model object to be used to look it upprotected final void firePropertyChange(String name, Object o, Object n)
firePropertyChange
in class MappingElementImpl
name
- property nameo
- old valuen
- new valueprotected final void fireVetoableChange(String name, Object o, Object n) throws PropertyVetoException
fireVetoableChange
in class MappingElementImpl
name
- property nameo
- old valuen
- new valuePropertyVetoException
- when the change is vetoed by a listenerpublic final PersistenceClassElement getPersistenceElement()
public void setPersistenceElement(PersistenceClassElement element)
element
- the persistence class elementpublic boolean isModified()
isModified
in interface MappingClassElement
true
if there have been (property) changes to this
class, false
otherwise.public void setModified(boolean flag)
true
by property changes and false
after a save.setModified
in interface MappingClassElement
flag
- if true
, this class is marked as modified;
if false
, it is marked as unmodified.public int getConsistencyLevel()
getConsistencyLevel
in interface MappingClassElement
MappingClassElement.NONE_CONSISTENCY
,
MappingClassElement.CHECK_MODIFIED_AT_COMMIT_CONSISTENCY
,
MappingClassElement.CHECK_ALL_AT_COMMIT_CONSISTENCY
,
MappingClassElement.LOCK_WHEN_MODIFIED_CONSISTENCY
,
MappingClassElement.LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY
,
MappingClassElement.LOCK_WHEN_LOADED_CONSISTENCY
, or
MappingClassElement.VERSION_CONSISTENCY
.
The default is MappingClassElement.NONE_CONSISTENCY
.public void setConsistencyLevel(int level) throws ModelException
setConsistencyLevel
in interface MappingClassElement
level
- an integer indicating the consistency level, one of:
MappingClassElement.NONE_CONSISTENCY
,MappingClassElement.CHECK_MODIFIED_AT_COMMIT_CONSISTENCY
,
MappingClassElement.CHECK_ALL_AT_COMMIT_CONSISTENCY
,
MappingClassElement.LOCK_WHEN_MODIFIED_CONSISTENCY
,
MappingClassElement.LOCK_WHEN_MODIFIED_CHECK_ALL_AT_COMMIT_CONSISTENCY
,
MappingClassElement.LOCK_WHEN_LOADED_CONSISTENCY
, or
MappingClassElement.VERSION_CONSISTENCY
.ModelException
- if impossible.public String getDatabaseRoot()
getDatabaseRoot
in interface MappingClassElement
public void setDatabaseRoot(org.netbeans.modules.dbschema.SchemaElement root) throws ModelException
setDatabaseRoot
in interface MappingClassElement
root
- the new database rootModelException
- if impossiblepublic ArrayList getTables()
getTables
in interface MappingClassElement
public MappingTableElement getTable(String name)
getTable
in interface MappingClassElement
name
- name of the table to find.public void addTable(org.netbeans.modules.dbschema.TableElement table) throws ModelException
addTable
in interface MappingClassElement
table
- table element to be added as either a primary or secondary
table.ModelException
- if impossiblepublic void setPrimaryTable(org.netbeans.modules.dbschema.TableElement table) throws ModelException
setPrimaryTable
in interface MappingClassElement
table
- table element to be used as the primary table.ModelException
- if impossiblepublic MappingReferenceKeyElement addSecondaryTable(MappingTableElement parentTable, org.netbeans.modules.dbschema.TableElement table) throws ModelException
addSecondaryTable
in interface MappingClassElement
parentTable
- mapping table element which should also be the primary
table.table
- table element to be used as a secondary table.ModelException
- if impossiblepublic void removeTable(MappingTableElement table) throws ModelException
removeTable
in interface MappingClassElement
table
- mapping table element to be removed from this mapping class.ModelException
- if impossiblepublic ArrayList getFields()
getFields
in interface MappingClassElement
public MappingFieldElement getField(String name)
getField
in interface MappingClassElement
name
- name of the field to find.public void addField(MappingFieldElement field) throws ModelException
addField
in interface MappingClassElement
field
- field element to be addedModelException
- if impossiblepublic void removeField(MappingFieldElement field) throws ModelException
removeField
in interface MappingClassElement
field
- field element to be removedModelException
- if impossiblepublic List getVersionFields()
MappingClassElement.VERSION_CONSISTENCY
.getVersionFields
in interface MappingClassElement
public boolean isNavigable()
isNavigable
in interface MappingClassElement
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 void setNavigable(boolean flag) throws ModelException
setNavigable
in interface MappingClassElement
flag
- if true
, lazy initialization will be used;
if false
, access to a non-fetched field will result in an
exception.ModelException
- if impossibleprotected static ArrayList toColumnObjects(String schemaName, ArrayList columnNames)
schemaName
- the database root used to find the column objectscolumnNames
- array of column names.TableElement.forName(java.lang.String, org.netbeans.modules.dbschema.SchemaElement)
,
TableElement.getMember(org.netbeans.modules.dbschema.DBIdentifier)
public String getKeyClass()
getObjectIdentityType
returns APPLICATION_IDENTITY
null
if the
identity type is not managed by the applicationPersistenceClassElement.setObjectIdentityType(int)
,
PersistenceClassElement.APPLICATION_IDENTITY
public void setFields(ArrayList fields)
fields
- the list of mapping fields in this mapping classpublic int getProperties()
public void postUnarchive() throws ModelException
postUnarchive
in interface MappingClassElement
ModelException
- if impossiblepublic void preArchive()
preArchive
in interface MappingClassElement
protected void stripSchemaName()
Copyright © 2019. All rights reserved.