Class PersistenceClassElement
java.lang.Object
com.sun.jdo.api.persistence.model.jdo.PersistenceElement
com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement
- All Implemented Interfaces:
FieldElementHolder,PersistenceElementProperties,Comparable
- Version:
- %I%
- Author:
- raccah
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePluggable implementation of the storage of class element properties. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant representing jdo identity managed by the application.static final intConstant representing jdo identity managed by the database.static final intConstant representing unmanaged jdo identity.Fields inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElementProperties
PROP_CARDINALITY, PROP_COLLECTION_CLASS, PROP_DELETE_ACTION, PROP_ELEMENT_CLASS, PROP_FIELDS, PROP_GROUPS, PROP_IDENTITY, PROP_INVERSE_FIELD, PROP_KEY_CLASS, PROP_KEY_FIELD, PROP_MODIFIED, PROP_NAME, PROP_PERSISTENCE, PROP_PREFETCH, PROP_SENSITIVITY, PROP_UPDATE_ACTION -
Constructor Summary
ConstructorsConstructorDescriptionCreate new PersistenceClassElement with no implementation.Create new PersistenceClassElement with the provided implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the supplied group to the collection of concurrency groups for this class.voidaddConcurrencyGroups(ConcurrencyGroupElement[] groups) Add the supplied groups to the collection of concurrency groups for this class.voidaddField(PersistenceFieldElement field) Add the supplied field to the collection of fields maintained by this holder.voidaddFields(PersistenceFieldElement[] fields) Add the supplied fields to the collection of fields maintained by this holder.booleanTests whether the supplied group is in the collection of groups maintained by this class.booleanTests whether the supplied field is in the collection of fields maintained by this holder.static PersistenceClassElementReturns the persistence class element associated with the class with the given string name, using the given model object to look it up.getConcurrencyGroup(String name) Returns the concurrency group with the supplied name from the collection of groups maintained by this class.Returns the collection of fields groups by this class in the form of an array.Returns the field with the supplied name from the collection of fields maintained by this holder.Returns the collection of fields maintained by this holder in the form of an array.Get the fully qualified name of the primary key class for this class element.intGet the object identity type of this class element.Get the package name of this class element.getRelationship(String name) Returns the relationship with the supplied name from the collection of relationships maintained by this holder.Returns the subset of the collection of fields which are relationahips.booleanGets the modified flag for this persistence class.voidRemove the supplied group from the collection of concurrency groups for this class.voidRemoved the supplied groups from the collection of concurrency groups for this class.voidRemove the supplied field from the collection of fields maintained by this holder.voidremoveFields(PersistenceFieldElement[] fields) Removed the supplied fields from the collection of fields maintained by this holder.voidsetConcurrencyGroups(ConcurrencyGroupElement[] groups) Sets the collection of concurrency groups maintained by this class to the contents of the supplied array.voidsetFields(PersistenceFieldElement[] fields) Sets the collection of fields maintained by this holder to the contents of the supplied array.voidsetKeyClass(String name) Set the primary key class for this class element.voidsetModified(boolean flag) Set the modified flag for this persistence class to flag.voidSet the name of this persistence element.voidsetObjectIdentityType(int type) Set the object identity type of this class element.Methods inherited from class com.sun.jdo.api.persistence.model.jdo.PersistenceElement
addPropertyChangeListener, addVetoableChangeListener, compareTo, equals, getImpl, getMessages, getName, hashCode, removePropertyChangeListener, removeVetoableChangeListener, setImpl, toString
-
Field Details
-
APPLICATION_IDENTITY
public static final int APPLICATION_IDENTITYConstant representing jdo identity managed by the application.- See Also:
-
DATABASE_IDENTITY
public static final int DATABASE_IDENTITYConstant representing jdo identity managed by the database.- See Also:
-
UNMANAGED_IDENTITY
public static final int UNMANAGED_IDENTITYConstant representing unmanaged jdo identity.- See Also:
-
-
Constructor Details
-
PersistenceClassElement
public PersistenceClassElement()Create new PersistenceClassElement with no implementation. This constructor should only be used for cloning and archiving. -
PersistenceClassElement
Create new PersistenceClassElement with the provided implementation. The implementation is responsible for storing all properties of the object.- Parameters:
impl- the implementation to use
-
-
Method Details
-
forName
Returns the persistence class element associated with the class with the given string name, using the given model object to look it up.- Parameters:
name- the fully qualified name of the desired classmodel- the model object to be used to look it up- Returns:
- persistence class element representing the desired class
-
getPackage
Get the package name of this class element.- Returns:
- the package
- See Also:
-
isModified
public boolean isModified()Gets the modified flag for this persistence class.- Returns:
trueif there have been (property) changes to this class,falseotherwise.
-
setModified
public void setModified(boolean flag) Set the modified flag for this persistence 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.
-
getObjectIdentityType
public int getObjectIdentityType()Get the object identity type of this class element.- Returns:
- the object identity type, one of
APPLICATION_IDENTITY,DATABASE_IDENTITY, orUNMANAGED_IDENTITY
-
setObjectIdentityType
Set the object identity type of this class element.- Parameters:
type- - an integer indicating the object identity type, one of:APPLICATION_IDENTITY,DATABASE_IDENTITY, orUNMANAGED_IDENTITY- Throws:
ModelException- if impossible
-
getKeyClass
Get the fully qualified name of the primary key class for this class element. This value is only used ifgetObjectIdentityTypereturnsAPPLICATION_IDENTITY- Returns:
- the fully qualified key class name,
nullif the identity type is not managed by the application - See Also:
-
setKeyClass
Set the primary key class for this class element. For now the key class is required to be in the same package with the same name as this class and the suffix "Key" (any capitalization), or an inner class of this class with the name "OID" (any capitalization).- Parameters:
name- - the fully qualified name which represents the primary key class. This value is only used ifgetObjectIdentityTypereturnsAPPLICATION_IDENTITY- Throws:
ModelException- if impossible- See Also:
-
setName
Set the name of this persistence element. This method overrides the one in PersistenceElement in order to keep thekey classin sync if possible.- Overrides:
setNamein classPersistenceElement- Parameters:
name- the name- Throws:
ModelException- if impossible
-
addField
Add the supplied field to the collection of fields maintained by this holder.- Specified by:
addFieldin interfaceFieldElementHolder- Parameters:
field- the field to be added- Throws:
ModelException- if impossible
-
addFields
Add the supplied fields to the collection of fields maintained by this holder.- Specified by:
addFieldsin interfaceFieldElementHolder- Parameters:
fields- the array of fields to be added- Throws:
ModelException- if impossible
-
removeField
Remove the supplied field from the collection of fields maintained by this holder.- Specified by:
removeFieldin interfaceFieldElementHolder- Parameters:
field- the field to be removed- Throws:
ModelException- if impossible
-
removeFields
Removed the supplied fields from the collection of fields maintained by this holder.- Specified by:
removeFieldsin interfaceFieldElementHolder- Parameters:
fields- the array of fields to be removed- Throws:
ModelException- if impossible
-
getFields
Returns the collection of fields maintained by this holder in the form of an array.- Specified by:
getFieldsin interfaceFieldElementHolder- Returns:
- the fields maintained by this holder
-
setFields
Sets the collection of fields maintained by this holder to the contents of the supplied array.- Specified by:
setFieldsin interfaceFieldElementHolder- Parameters:
fields- the fields maintained by this holder- Throws:
ModelException- if impossible
-
getField
Returns the field with the supplied name from the collection of fields maintained by this holder.- Specified by:
getFieldin interfaceFieldElementHolder- Parameters:
name- the name of the field to be found- Returns:
- the field with the supplied name,
nullif none exists
-
containsField
Tests whether the supplied field is in the collection of fields maintained by this holder.- Specified by:
containsFieldin interfaceFieldElementHolder- Parameters:
field- the field to be tested
-
getRelationships
Returns the subset of the collection of fields which are relationahips.- Returns:
- the relationship fields maintained by this holder
- See Also:
-
getRelationship
Returns the relationship with the supplied name from the collection of relationships maintained by this holder.- Parameters:
name- the name of the relationship to be found- Returns:
- the relationship with the supplied name,
nullif none exists - See Also:
-
addConcurrencyGroup
Add the supplied group to the collection of concurrency groups for this class.- Parameters:
group- the concurrency group to be added- Throws:
ModelException- if impossible
-
addConcurrencyGroups
Add the supplied groups to the collection of concurrency groups for this class.- Parameters:
groups- the array of concurrency groups to be added- Throws:
ModelException- if impossible
-
removeConcurrencyGroup
Remove the supplied group from the collection of concurrency groups for this class.- Parameters:
group- the concurrency group to be removed- Throws:
ModelException- if impossible
-
removeConcurrencyGroups
Removed the supplied groups from the collection of concurrency groups for this class.- Parameters:
groups- the array of concurrency groups to be removed- Throws:
ModelException- if impossible
-
getConcurrencyGroups
Returns the collection of fields groups by this class in the form of an array.- Returns:
- the concurrency groups maintained by this class
-
setConcurrencyGroups
Sets the collection of concurrency groups maintained by this class to the contents of the supplied array.- Parameters:
groups- the concurrency groups maintained by this holder- Throws:
ModelException- if impossible
-
getConcurrencyGroup
Returns the concurrency group with the supplied name from the collection of groups maintained by this class.- Parameters:
name- the name of the concurrency group to be found- Returns:
- the concurrency group with the supplied name,
nullif none exists
-
containsConcurrencyGroup
Tests whether the supplied group is in the collection of groups maintained by this class.- Parameters:
group- the concurrency group to be tested
-