Objectivity for Java Reference

com.objy.db.app
Class Relationship

java.lang.Object
  |
  +--com.objy.db.app.Relationship
Direct Known Subclasses:
ManyToMany, ManyToOne, OneToMany, OneToOne

public abstract class Relationship
extends Object

Abstract superclass for classes that define relationships between objects.

API Summary

Because this class is abstract, you never instantiate it; instead, you work with instances of its derived classes. You should not create your own subclasses of this class.

The class on which a relationship is being defined must define a public static relationship method that returns a properly initialized instance of the corresponding subclass of Relationship:

This provides the information necessary to define the relationship in the Objectivity/DB schema. The name of the static method should be formed by appending "_Relationship" to the method that is being defined. To define a relationship on a class, you must also a declare a non-static relationship field typed as either:

API Summary

Constant Types
Copy modes
    Specify how the relationship is handled when a copy of the object is created.
COPY_COPY
COPY_DELETE
COPY_MOVE
Version modes
    Specify how the relationship is handled when a new version of the object is created.
VERSION_COPY
VERSION_DELETE
VERSION_MOVE
Access control modes
    Specify how the relationship may be accessed.
PRIVATE
PROTECTED
PUBLIC
Inline modes
    Specify how the relationship should be stored.
INLINE_NONE
INLINE_LONG
INLINE_SHORT

Functionality
Getting Information getMemberName()
getOtherClass()
getOtherMember()
getCopyMode()
getVersionMode()
getAccessControl()
getInlineMode()
Testing isBidirectional()
isDeletePropagated()
isLockPropagated()
isToMany()
isOtherToMany()
isInline()
Setting Properties setAccessControl(int)


Field Summary
static byte COPY_COPY
          Copy mode: Copy this relationship from an object to a copy of the object.
static byte COPY_DELETE
          Copy mode: Delete this relationship in the copy of an object and leave it in the original object.
static byte COPY_MOVE
          Copy mode: Move this relationship from an object to a copy of the object.
static byte INLINE_LONG
          Inline mode: Store the relationship as a long inline.
static byte INLINE_NONE
          Inline mode: Store the relationship non-inline.
static byte INLINE_SHORT
          Inline mode: Store the relationship as a short inline.
static int PRIVATE
          Access-control mode: Allow private access to the relationship.
static int PROTECTED
          Access-control mode: Allow protected access to the relationship.
static int PUBLIC
          Access-control mode: Allow public access to the relationship.
static byte VERSION_COPY
          Version mode: Copy this relationship from an object to a new version of the object.
static byte VERSION_DELETE
          Version mode: Delete this relationship in the new version of an object and leave it in the original object.
static byte VERSION_MOVE
          Version mode: Move this relationship from an object to a new version of the object.
 
Method Summary
 void assertOtherRelMatches(String className, Relationship otherRel)
          Reserved for internal use; you should not call this method.
 void assertValidMember(String className, Class memberClass, String actualMemberName)
          Reserved for internal use; you should not call this method.
 void dumpRelInfo()
          Reserved for internal use; you should not call this method.
 int getAccessControl()
          Gets the access control for this relationship in the schema.
 long getAssocNum()
          Reserved for internal use; you should not call this method.
 byte getCopyMode()
          Gets the copy mode for this relationship.
 int getDirection()
          Reserved for internal use; you should not call this method.
 byte getInlineMode()
          Gets the mode in which this relationship is stored.
 long getMemberID()
          Reserved for internal use; you should not call this method.
 String getMemberName()
          Gets the name of the field defining this relationship.
 String getOtherClass()
          Gets the name of the related class for this relationship.
 String getOtherMember()
          Gets the name of the relationship field in the related class.
 byte getVersionMode()
          Gets the version mode for this relationship.
 boolean isBidirectional()
          Tests whether this relationship is bidirectional.
 boolean isDefined()
          Reserved for internal use; you should not call this method.
 boolean isDeletePropagated()
          Tests whether propagation of object deletion is enabled for this relationship.
 boolean isInline()
          Tests whether the relationship is inline or not.
 boolean isLockPropagated()
          Tests whether propagation of object locking is enabled for this relationship.
abstract  boolean isOtherToMany()
          Tests whether the inverse of this relationship is a to-many relationship.
abstract  boolean isToMany()
          Tests whether this relationship is a to-many relationship.
 void setAccessControl(int accessControl)
          Sets the access control for this relationship in the schema.
 void setAssocNum(long assocNum)
          Reserved for internal use; you should not call this method.
 void setDefined(boolean flag)
          Reserved for internal use; you should not call this method.
 void setDirection(int _direction)
          Reserved for internal use; you should not call this method.
 void setMemberID(long memberID)
          Reserved for internal use; you should not call this method.
 void setMemberIDAndAssocNum(long memberID, long assocNum)
          Reserved for internal use; you should not call this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPY_DELETE

public static final byte COPY_DELETE
Copy mode: Delete this relationship in the copy of an object and leave it in the original object.

COPY_MOVE

public static final byte COPY_MOVE
Copy mode: Move this relationship from an object to a copy of the object.

COPY_COPY

public static final byte COPY_COPY
Copy mode: Copy this relationship from an object to a copy of the object.

VERSION_DELETE

public static final byte VERSION_DELETE
Version mode: Delete this relationship in the new version of an object and leave it in the original object.

Note: Versioning objects is not supported in this release. These constants are defined so that relationships can be defined to interoperate with other programming interfaces that do support the version operation.


VERSION_MOVE

public static final byte VERSION_MOVE
Version mode: Move this relationship from an object to a new version of the object.

Note: Versioning objects is not supported in this release. These constants are defined so that relationships can be defined to interoperate with other programming interfaces that do support the version operation.


VERSION_COPY

public static final byte VERSION_COPY
Version mode: Copy this relationship from an object to a new version of the object.

Note: Versioning objects is not supported in this release. These constants are defined so that relationships can be defined to interoperate with other programming interfaces that do support the version operation.


PUBLIC

public static final int PUBLIC
Access-control mode: Allow public access to the relationship.

PRIVATE

public static final int PRIVATE
Access-control mode: Allow private access to the relationship.

PROTECTED

public static final int PROTECTED
Access-control mode: Allow protected access to the relationship.

INLINE_NONE

public static final byte INLINE_NONE
Inline mode: Store the relationship non-inline.

INLINE_LONG

public static final byte INLINE_LONG
Inline mode: Store the relationship as a long inline.

INLINE_SHORT

public static final byte INLINE_SHORT
Inline mode: Store the relationship as a short inline.
Method Detail

getMemberName

public String getMemberName()
Gets the name of the field defining this relationship.

Returns:
The name of the field.

getOtherClass

public String getOtherClass()
Gets the name of the related class for this relationship.

Returns:
The name of the related class.

isBidirectional

public boolean isBidirectional()
Tests whether this relationship is bidirectional.

Returns:
True if the relationship is bidirectional; otherwise, false.

getOtherMember

public String getOtherMember()
Gets the name of the relationship field in the related class.

Returns:
The name of the relationship field in the related class.

getCopyMode

public byte getCopyMode()
Gets the copy mode for this relationship.

Returns:
The copy mode for this relationship; one of the following constants defined in this class:
COPY_DELETE
This relationship will be deleted in a copy of the object. The relationship will remain in the old object.
COPY_MOVE
This relationship will be moved from an object to a copy of the object.
COPY_COPY
This relationship will be copied from an object to a copy of the object.

getVersionMode

public byte getVersionMode()
Gets the version mode for this relationship.

Returns:
The version mode for this relationship; one of the following constants defined in this class:
VERSION_DELETE
This relationship will be deleted in the new version of the object. The relationship will remain in the old object.
VERSION_MOVE
This relationship will be moved from an object to the new version of the object.
VERSION_COPY
This relationship will be copied from an object to the new version of the object.

isDeletePropagated

public boolean isDeletePropagated()
Tests whether propagation of object deletion is enabled for this relationship.

Returns:
True if propagation of object deletion is enabled for this relationship; otherwise, false.

isLockPropagated

public boolean isLockPropagated()
Tests whether propagation of object locking is enabled for this relationship.

Returns:
True if propagation of object locking is enabled for this relationship; otherwise, false.

getMemberID

public long getMemberID()
Reserved for internal use; you should not call this method.

getAssocNum

public long getAssocNum()
Reserved for internal use; you should not call this method.

getAccessControl

public int getAccessControl()
Gets the access control for this relationship in the schema.

Returns:
The access control for this relationship; one of the following constants defined in this class:
PUBLIC
Public access.
PROTECTED
Protected access.
PRIVATE
Private access.

See Also:
setAccessControl(int)

setAccessControl

public void setAccessControl(int accessControl)
Sets the access control for this relationship in the schema.

If this method is never called, the default access control in the schema is the access control of the static method that returns this relationship. For example, if this relationship is in the fleet field of a Vehicle object, its default access control is the access control of the Vehicle.fleet_Relationship static method.

Parameters:
accessControl - The access control for this relationship; one of the following constants defined in this class:
PUBLIC
Public access.
PROTECTED
Protected access.
PRIVATE
Private access.

See Also:
getAccessControl()

getInlineMode

public byte getInlineMode()
Gets the mode in which this relationship is stored.

Returns:
The mode in which this relationship is stored; one of the following constants defined in this class:
INLINE_NONE
The relationship is non-inline.
INLINE_LONG
The relationship is long inline.
INLINE_SHORT
The relationship is short inline.

See Also:
setAccessControl(int), isInline()

isInline

public boolean isInline()
Tests whether the relationship is inline or not.

Returns:
True if the relationship is inline. False if it is not.

isDefined

public boolean isDefined()
Reserved for internal use; you should not call this method.

setDefined

public void setDefined(boolean flag)
Reserved for internal use; you should not call this method.

setDirection

public void setDirection(int _direction)
Reserved for internal use; you should not call this method.

getDirection

public int getDirection()
Reserved for internal use; you should not call this method.

setMemberIDAndAssocNum

public void setMemberIDAndAssocNum(long memberID,
                                   long assocNum)
Reserved for internal use; you should not call this method.

setAssocNum

public void setAssocNum(long assocNum)
Reserved for internal use; you should not call this method.

setMemberID

public void setMemberID(long memberID)
Reserved for internal use; you should not call this method.

isToMany

public abstract boolean isToMany()
Tests whether this relationship is a to-many relationship.

This method is abstract, so it can only be called on a subclass of Relationship.

Returns:
True if this relationship is a to-many relationship; otherwise, false.

isOtherToMany

public abstract boolean isOtherToMany()
Tests whether the inverse of this relationship is a to-many relationship.

This method is abstract, so it can only be called on a subclass of Relationship.

Returns:
True if the inverse of this relationship is a to-many relationship; otherwise, false.

assertValidMember

public void assertValidMember(String className,
                              Class memberClass,
                              String actualMemberName)
Reserved for internal use; you should not call this method.

assertOtherRelMatches

public void assertOtherRelMatches(String className,
                                  Relationship otherRel)
Reserved for internal use; you should not call this method.

dumpRelInfo

public void dumpRelInfo()
Reserved for internal use; you should not call this method.

Objectivity for Java Reference

Copyright © 2000 Objectivity, Inc. All rights reserved.