Class RelationshipElementImpl
- java.lang.Object
-
- com.sun.jdo.api.persistence.model.jdo.impl.PersistenceElementImpl
-
- com.sun.jdo.api.persistence.model.jdo.impl.PersistenceMemberElementImpl
-
- com.sun.jdo.api.persistence.model.jdo.impl.PersistenceFieldElementImpl
-
- com.sun.jdo.api.persistence.model.jdo.impl.RelationshipElementImpl
-
- All Implemented Interfaces:
PersistenceElement.Impl,PersistenceElementProperties,PersistenceFieldElement.Impl,PersistenceMemberElement.Impl,RelationshipElement.Impl
public class RelationshipElementImpl extends PersistenceFieldElementImpl implements RelationshipElement.Impl
- Version:
- %I%
- Author:
- raccah
-
-
Field Summary
-
Fields inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElement.Impl
ADD, REMOVE, SET
-
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
Constructors Constructor Description RelationshipElementImpl()Create new RelationshipElementImpl with no corresponding name.RelationshipElementImpl(String name)Creates new RelationshipElementImpl with the corresponding name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeInverseRelationship(RelationshipElement inverseRelationship)Changes the inverse relationship element for this relationship element.StringgetCollectionClass()Get the collection class (for example Set, List, Vector, etc.) for this relationship element.intgetDeleteAction()Get the delete action for this relationship element.StringgetElementClass()Get the element class for this relationship element.StringgetInverseRelationshipName()Get the relative name of the inverse relationship field for this relationship element.intgetLowerBound()Get the lower cardinality bound for this relationship element.intgetUpdateAction()Get the update action for this relationship element.intgetUpperBound()Get the upper cardinality bound for this relationship element.booleanisPrefetch()Determines 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.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.impl.PersistenceFieldElementImpl
getPersistenceType, isKey, isReadSensitive, isWriteSensitive, setKey, setPersistenceType, setReadSensitive, setWriteSensitive
-
Methods inherited from class com.sun.jdo.api.persistence.model.jdo.impl.PersistenceMemberElementImpl
firePropertyChange, fireVetoableChange
-
Methods inherited from class com.sun.jdo.api.persistence.model.jdo.impl.PersistenceElementImpl
addPropertyChangeListener, addVetoableChangeListener, attachToElement, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElement.Impl
addPropertyChangeListener, addVetoableChangeListener, attachToElement, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
-
Methods inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceFieldElement.Impl
getPersistenceType, isKey, isReadSensitive, isWriteSensitive, setKey, setPersistenceType, setReadSensitive, setWriteSensitive
-
-
-
-
Constructor Detail
-
RelationshipElementImpl
public RelationshipElementImpl()
Create new RelationshipElementImpl with no corresponding name. This constructor should only be used for cloning and archiving.
-
RelationshipElementImpl
public RelationshipElementImpl(String name)
Creates new RelationshipElementImpl with the corresponding name- Parameters:
name- the name of the element
-
-
Method Detail
-
getUpdateAction
public int getUpdateAction()
Get the update action for this relationship element.- Specified by:
getUpdateActionin interfaceRelationshipElement.Impl- Returns:
- the update action, one of
RelationshipElement.NONE_ACTION,RelationshipElement.NULLIFY_ACTION,RelationshipElement.RESTRICT_ACTION,RelationshipElement.CASCADE_ACTION, orRelationshipElement.AGGREGATE_ACTION. The default is NONE_ACTION.
-
setUpdateAction
public void setUpdateAction(int action) throws ModelExceptionSet the update action for this relationship element.- Specified by:
setUpdateActionin interfaceRelationshipElement.Impl- Parameters:
action- - an integer indicating the update action, one of:RelationshipElement.NONE_ACTION,RelationshipElement.NULLIFY_ACTION,RelationshipElement.RESTRICT_ACTION,RelationshipElement.CASCADE_ACTION, orRelationshipElement.AGGREGATE_ACTION- Throws:
ModelException- if impossible
-
getDeleteAction
public int getDeleteAction()
Get the delete action for this relationship element.- Specified by:
getDeleteActionin interfaceRelationshipElement.Impl- Returns:
- the delete action, one of
RelationshipElement.NONE_ACTION,RelationshipElement.NULLIFY_ACTION,RelationshipElement.RESTRICT_ACTION,RelationshipElement.CASCADE_ACTION, orRelationshipElement.AGGREGATE_ACTION. The default is NONE_ACTION.
-
setDeleteAction
public void setDeleteAction(int action) throws ModelExceptionSet the delete action for this relationship element.- Specified by:
setDeleteActionin interfaceRelationshipElement.Impl- Parameters:
action- - an integer indicating the delete action, one of:RelationshipElement.NONE_ACTION,RelationshipElement.NULLIFY_ACTION,RelationshipElement.RESTRICT_ACTION,RelationshipElement.CASCADE_ACTION, orRelationshipElement.AGGREGATE_ACTION- Throws:
ModelException- if impossible
-
isPrefetch
public boolean isPrefetch()
Determines whether this relationship element should prefetch or not.- Specified by:
isPrefetchin interfaceRelationshipElement.Impl- Returns:
trueif the relationship should prefetch,falseotherwise. The default isfalse.
-
setPrefetch
public void setPrefetch(boolean flag) throws ModelExceptionSet whether this relationship element should prefetch or not.- Specified by:
setPrefetchin interfaceRelationshipElement.Impl- 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. The default is 0.- Specified by:
getLowerBoundin interfaceRelationshipElement.Impl- Returns:
- the lower cardinality bound
-
setLowerBound
public void setLowerBound(int lowerBound) throws ModelExceptionSet the lower cardinality bound for this relationship element.- Specified by:
setLowerBoundin interfaceRelationshipElement.Impl- 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. The default is Integer.MAX_VALUE. ReturnsInteger.MAX_VALUEforn- Specified by:
getUpperBoundin interfaceRelationshipElement.Impl- Returns:
- the upper cardinality bound
-
setUpperBound
public void setUpperBound(int upperBound) throws ModelExceptionSet the upper cardinality bound for this relationship element.- Specified by:
setUpperBoundin interfaceRelationshipElement.Impl- Parameters:
upperBound- - an integer indicating the upper cardinality bound (useInteger.MAX_VALUEforn)- Throws:
ModelException- if impossible
-
getCollectionClass
public String getCollectionClass()
Get the collection class (for example Set, List, Vector, etc.) for this relationship element.- Specified by:
getCollectionClassin interfaceRelationshipElement.Impl- Returns:
- the collection class
-
setCollectionClass
public void setCollectionClass(String collectionClass) throws ModelException
Set the collection class for this relationship element.- Specified by:
setCollectionClassin interfaceRelationshipElement.Impl- Parameters:
collectionClass- - a string indicating the type of collection (for example Set, List, Vector, etc.)- Throws:
ModelException- if impossible
-
getElementClass
public String getElementClass()
Get the element class for this relationship element. If primitive types are supported, you can usewrapperclass.TYPE.toString()to specify them.- Specified by:
getElementClassin interfaceRelationshipElement.Impl- Returns:
- the element class
-
setElementClass
public void setElementClass(String elementClass) throws ModelException
Set the element class for this relationship element.- Specified by:
setElementClassin interfaceRelationshipElement.Impl- 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
public String 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.- Specified by:
getInverseRelationshipNamein interfaceRelationshipElement.Impl- Returns:
- the relative name of the inverse relationship element
- See Also:
RelationshipElement.getInverseRelationship(com.sun.jdo.api.persistence.model.Model)
-
changeInverseRelationship
public void changeInverseRelationship(RelationshipElement inverseRelationship) throws ModelException
Changes the inverse relationship element for this relationship element. This method is invoked for both sides fromRelationshipElement.setInverseRelationship(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.- Specified by:
changeInverseRelationshipin interfaceRelationshipElement.Impl- 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
-
-