Class RelationshipElement
java.lang.Object
com.sun.jdo.api.persistence.model.jdo.PersistenceElement
com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement
com.sun.jdo.api.persistence.model.jdo.PersistenceFieldElement
com.sun.jdo.api.persistence.model.jdo.RelationshipElement
- All Implemented Interfaces:
PersistenceElementProperties,Comparable
- Version:
- %I%
- Author:
- raccah
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePluggable implementation of the storage of relationship element properties. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant representing aggregate action.static final intConstant representing cascade action.static final intConstant representing no action.static final intConstant representing nullify action.static final intConstant representing restrict action.Fields inherited from class com.sun.jdo.api.persistence.model.jdo.PersistenceFieldElement
DERIVED, PERSISTENT, TRANSIENTFields 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 RelationshipElement with no implementation.RelationshipElement(RelationshipElement.Impl impl, PersistenceClassElement declaringClass) Create new RelationshipElement with the provided implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeInverseRelationship(RelationshipElement inverseRelationship) Changes the inverse relationship element for this relationship element.Get the collection class (for example Set, List, Vector, etc.) for this relationship element.intGet the delete action for this relationship element.Get the element class for this relationship element.getInverseRelationship(Model model) Get the inverse relationship element for this relationship element.Get the relative name of the inverse relationship field for this relationship element.intGet the lower cardinality bound for this relationship element.intGet the update action for this relationship element.intGet the upper cardinality bound for this relationship element.booleanDetermines whether this relationship element should prefetch or not.voidsetCollectionClass(String collectionClass) Set the collection class for this relationship element.voidsetDeleteAction(int action) Set the delete action for this relationship element.voidsetElementClass(String elementClass) Set the element class for this relationship element.voidsetInverseRelationship(RelationshipElement inverseRelationship, Model model) Set the inverse relationship element for this relationship element.voidsetLowerBound(int lowerBound) Set the lower cardinality bound for this relationship element.voidsetPrefetch(boolean flag) Set whether this relationship element should prefetch or not.voidsetUpdateAction(int action) Set the update action for this relationship element.voidsetUpperBound(int upperBound) Set the upper cardinality bound for this relationship element.Methods inherited from class com.sun.jdo.api.persistence.model.jdo.PersistenceFieldElement
getConcurrencyGroups, getFieldNumber, getPersistenceType, isKey, isReadSensitive, isWriteSensitive, setKey, setPersistenceType, setReadSensitive, setWriteSensitiveMethods inherited from class com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement
equals, getDeclaringClass, hashCode, setDeclaringClassMethods inherited from class com.sun.jdo.api.persistence.model.jdo.PersistenceElement
addPropertyChangeListener, addVetoableChangeListener, compareTo, getImpl, getMessages, getName, removePropertyChangeListener, removeVetoableChangeListener, setImpl, setName, toString
-
Field Details
-
NONE_ACTION
public static final int NONE_ACTIONConstant representing no action.- See Also:
-
NULLIFY_ACTION
public static final int NULLIFY_ACTIONConstant representing nullify action.- See Also:
-
RESTRICT_ACTION
public static final int RESTRICT_ACTIONConstant representing restrict action.- See Also:
-
CASCADE_ACTION
public static final int CASCADE_ACTIONConstant representing cascade action.- See Also:
-
AGGREGATE_ACTION
public static final int AGGREGATE_ACTIONConstant representing aggregate action.- See Also:
-
-
Constructor Details
-
RelationshipElement
public RelationshipElement()Create new RelationshipElement with no implementation. This constructor should only be used for cloning and archiving. -
RelationshipElement
Create new RelationshipElement with the provided implementation. The implementation is responsible for storing all properties of the object.- Parameters:
impl- the implementation to usedeclaringClass- the class to attach to
-
-
Method Details
-
getUpdateAction
public int getUpdateAction()Get the update action for this relationship element.- Returns:
- the update action, one of
NONE_ACTION,NULLIFY_ACTION,RESTRICT_ACTION,CASCADE_ACTION, orAGGREGATE_ACTION
-
setUpdateAction
Set the update action for this relationship element.- Parameters:
action- - an integer indicating the update action, one of:NONE_ACTION,NULLIFY_ACTION,RESTRICT_ACTION,CASCADE_ACTION, orAGGREGATE_ACTION- Throws:
ModelException- if impossible
-
getDeleteAction
public int getDeleteAction()Get the delete action for this relationship element.- Returns:
- the delete action, one of
NONE_ACTION,NULLIFY_ACTION,RESTRICT_ACTION,CASCADE_ACTION, orAGGREGATE_ACTION
-
setDeleteAction
Set the delete action for this relationship element.- Parameters:
action- - an integer indicating the delete action, one of:NONE_ACTION,NULLIFY_ACTION,RESTRICT_ACTION,CASCADE_ACTION, orAGGREGATE_ACTION- Throws:
ModelException- if impossible
-
isPrefetch
public boolean isPrefetch()Determines whether this relationship element should prefetch or not.- Returns:
trueif the relationship should prefetch,falseotherwise
-
setPrefetch
Set whether this relationship element should prefetch or not.- Parameters:
flag- - iftrue, the relationship is set to prefetch; otherwise, it is not- Throws:
ModelException- if impossible
-
getLowerBound
public int getLowerBound()Get the lower cardinality bound for this relationship element.- Returns:
- the lower cardinality bound
-
setLowerBound
Set the lower cardinality bound for this relationship element.- Parameters:
lowerBound- - an integer indicating the lower cardinality bound- Throws:
ModelException- if impossible
-
getUpperBound
public int getUpperBound()Get the upper cardinality bound for this relationship element. ReturnsInteger.MAX_VALUEforn- Returns:
- the upper cardinality bound
-
setUpperBound
Set the upper cardinality bound for this relationship element.- Parameters:
upperBound- - an integer indicating the upper cardinality bound (useInteger.MAX_VALUEforn)- Throws:
ModelException- if impossible
-
getCollectionClass
Get the collection class (for example Set, List, Vector, etc.) for this relationship element.- Returns:
- the collection class
-
setCollectionClass
Set the collection class for this relationship element.- Parameters:
collectionClass- - a string indicating the type of collection (for example Set, List, Vector, etc.)- Throws:
ModelException- if impossible
-
getElementClass
Get the element class for this relationship element. If primitive types are supported, you can usewrapperclass.TYPE.toString()to specify them.- Returns:
- the element class
-
setElementClass
Set the element class for this relationship element.- Parameters:
elementClass- - a string indicating the type of elements in the collection. If primitive types are supported, you can usewrapperclass.TYPE.toString()to specify them.- Throws:
ModelException- if impossible
-
getInverseRelationshipName
Get the relative name of the inverse relationship field for this relationship element. In the case of two-way relationships, the two relationship elements involved are inverses of each other. If this relationship element does not participate in a two-way relationship, this returnsnull. Note that it is possible to have this method return a value, but because of the combination of related class and lookup, there may be no corresponding RelationshipElement which can be found.- Returns:
- the relative name of the inverse relationship element
- See Also:
-
getInverseRelationship
Get the inverse relationship element for this relationship element. In the case of two-way relationships, the two relationship elements involved are inverses of each other. If this relationship element does not participate in a two-way relationship, this returnsnull. Note that it is also possible for this method to returnnulleven ifgetInverseRelationshipName()returns a value because the corresponding RelationshipElement cannot be found using the combination of related class and lookup (model).- Parameters:
model- the model object to be used to look it up- Returns:
- the inverse relationship element if it exists
- See Also:
-
setInverseRelationship
public void setInverseRelationship(RelationshipElement inverseRelationship, Model model) throws ModelException Set the inverse relationship element for this relationship element. In the case of two-way relationships, the two relationship elements involved are inverses of each other.- Parameters:
inverseRelationship- - a relationship element to be used as the inverse for this relationship element ornullif this relationship element does not participate in a two-way relationship.model- the model object to be used to look up the old inverse so it can be unset- Throws:
ModelException- if impossible
-
changeInverseRelationship
public void changeInverseRelationship(RelationshipElement inverseRelationship) throws ModelException Changes the inverse relationship element for this relationship element. This method is invoked for both sides fromsetInverseRelationship(com.sun.jdo.api.persistence.model.jdo.RelationshipElement, com.sun.jdo.api.persistence.model.Model)and should handle the vetoable change events, property change events, and setting the internal variable.- Parameters:
inverseRelationship- - a relationship element to be used as the inverse for this relationship element ornullif this relationship element does not participate in a two-way relationship.- Throws:
ModelException- if impossible
-