com.esri.arcgis.geodatabase
Class IRelationshipClassProxy

java.lang.Object
  extended by com.esri.arcgis.interop.Dispatch
      extended by com.esri.arcgis.geodatabase.IRelationshipClassProxy
All Implemented Interfaces:
IRelationshipClass, Externalizable, Serializable
Direct Known Subclasses:
IRelationshipClass2Proxy

public class IRelationshipClassProxy
extends com.esri.arcgis.interop.Dispatch
implements IRelationshipClass, Serializable

Provides access to members that return information about the relationship class, create relationships, relationship rules and get related objects.

Superseded By

IRelationshipClass2

Description

A RelationshipClass is an association between two object classes; one is the origin class and the other the destination class. The RelationshipClass can have cardinality taking the form of 1-1, 1-M, M-N (One-to-One, One-to-Many, Many-to-Many). A RelationshipClass may be simple or composite. Composite relationship classes are 1-M where the origin class controls the lifetime of the destination class. Simple relationship classes are peer-to-peer where the related objects can exist independent of each other.

Remarks

Relationships can be between spatial, non-spatial objects, or between spatial and non-spatial objects. The spatial objects will be stored in feature classes, and the non-spatial in object classes, however, all of the relationships will be maintained in the relationship class. RelationshipClasses can be created using the IRelationshipClassContainer interface on the FeatureDataset Class.

The IRelationshipClass interface provides information about a relationship class, functionality to create and delete individual relationships, and methods to find related objects. The members of this interface can be split into three logical groups: the properties that correspond to how the relationship class was created, the object-to-object methods that deal with individual relationships, and lastly the relationship rules methods.

The OriginPrimaryKey, OriginForeignKey, DestinationPrimaryKey, and DestinationForeignKey properties can be somewhat confusing—their use is different depending on whether the relationship class is attributed.

The object-to-object methods such as GetObjectsRelatedToObjectSet make a lot of use of the ISet interface, which manipulates a set of generic objects. When adding objects to a set with a cursor, make sure that the cursor is non-recycling.

When using CreateRelationship, remember that this operation will write a value into the foreign key field. Therefore it is possible that you could overwrite, and therefore delete, an existing relationship. Similarly, DeleteRelationship will remove the foreign key value, so that field must allow null values unless you want to ensure that all objects in the class belong to relationships.

The IRelationshipClass::IsAttributed property will only return true if there are extra relationship attributes beyond those required to relate the objects. The IRelationshipClass::GetRelationship method is useful for accessing the relationship attributes.

When To Use

Use the RelationshipClass when you want to maintain particular associations between objects in a geodatabase.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

See Also:
Serialized Form

Field Summary
 boolean noncastable
           
 
Fields inherited from class com.esri.arcgis.interop.Dispatch
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef
 
Constructor Summary
  IRelationshipClassProxy()
           
  IRelationshipClassProxy(Object obj)
           
protected IRelationshipClassProxy(Object obj, String iid)
           
 
Method Summary
 void addListener(String iidStr, Object theListener, Object theSource)
           
 void addRelationshipRule(IRule rule)
          Adds a relationship rule to this relationship class.
 IRelationship createRelationship(IObject originObject, IObject destinationObject)
          Creates a new relationship between the two specified objects.
 void deleteRelationship(IObject originObject, IObject destinationObject)
          Deletes the relationship that associates the two specified objects.
 void deleteRelationshipRule(IRule rule)
          Deletes a relationship rule from this relationship class.
 void deleteRelationshipsForObject(IObject anObject)
          Deletes all relationships that apply to a specified object.
 void deleteRelationshipsForObjectSet(ISet anObjectSet)
          Deletes all relationships that apply to the specified origin or destination object set.
 String getBackwardPathLabel()
          The backward path label for the relationship class.
 int getCardinality()
          The cardinality for the relationship class.
 IObjectClass getDestinationClass()
          The destination object class.
 String getDestinationForeignKey()
          The relationship destination foreign Key.
 String getDestinationPrimaryKey()
          The relationship destination primary Key.
 IFeatureDataset getFeatureDataset()
          The feature dataset, if any, to which this relationship class belongs.
 String getForwardPathLabel()
          The forward path label for the relationship class.
 int getNotification()
          The notification direction for the relationship class.
 IRelClassEnumRowPairs getObjectsMatchingObjectSet(ISet srcObjectSet)
          Gets rows pairs of objects that are related to the specified origin or destination object set.
 ISet getObjectsRelatedToObject(IObject anObject)
          Gets the objects that are related to the specified object.
 ISet getObjectsRelatedToObjectSet(ISet anObjectSet)
          Gets the objects that are related to the specified origin or destination object set.
 IObjectClass getOriginClass()
          The origin object class.
 String getOriginForeignKey()
          The relationship origin foreign Key.
 String getOriginPrimaryKey()
          The relationship origin primary Key.
 IRelationship getRelationship(IObject originObject, IObject destinationObject)
          Get the relationship that associates the two specified objects.
 int getRelationshipClassID()
          The relationship class ID.
 IEnumRule getRelationshipRules()
          The relationship rules that apply to this relationship class.
 IEnumRelationship getRelationshipsForObject(IObject anObject)
          Get all relationships that apply to a specified object.
 IEnumRelationship getRelationshipsForObjectSet(ISet anObjectSet)
          Get all relationships that apply to the specified origin or destination object set.
 boolean isAttributed()
          Indicates if the relationships in this relationship class have attributes.
 boolean isComposite()
          Indicates if the relationship class represents a composite relationship in which the origin object class represents the composite object.
 void removeListener(String iidStr, Object theListener)
           
 
Methods inherited from class com.esri.arcgis.interop.Dispatch
bindUsingMoniker, constructVtblPosTable, convertToNative, cookieForListener, createDispatch, createObjrefMonikerDisplayName, equals, getActiveObject, getActiveObject, getDefaultProperty, getDispatchIdOfName, getLastErrorCode, getMtsObjectContext, getObjRef, getPropertyByName, getPropertyByName, getVtblPos, hashCode, initDispatch, invoke, invokeMethodByName, invokeMethodByName, invokeMethodByName, invokePropertyGetByName, invokePropertyPutByName, invokePropertyPutByRefByName, isNativeMode, isObjRef, optimizedVtblInvoke, queryInterface, readExternal, release, setNativeMode, setPropertyByName, toString, vtblInvoke, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noncastable

public boolean noncastable
Constructor Detail

IRelationshipClassProxy

public IRelationshipClassProxy()

IRelationshipClassProxy

public IRelationshipClassProxy(Object obj)
                        throws IOException
Throws:
IOException

IRelationshipClassProxy

protected IRelationshipClassProxy(Object obj,
                                  String iid)
                           throws IOException
Throws:
IOException
Method Detail

addListener

public void addListener(String iidStr,
                        Object theListener,
                        Object theSource)
                 throws IOException
Overrides:
addListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

removeListener

public void removeListener(String iidStr,
                           Object theListener)
                    throws IOException
Overrides:
removeListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

getOriginPrimaryKey

public String getOriginPrimaryKey()
                           throws IOException,
                                  AutomationException
The relationship origin primary Key.

Example:

IRelationshipClassSet pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

String sPrimaryKeyField = pRelationshipClass.getOriginPrimaryKey();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getOriginPrimaryKey in interface IRelationshipClass
Returns:
The relOrigPKey
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDestinationPrimaryKey

public String getDestinationPrimaryKey()
                                throws IOException,
                                       AutomationException
The relationship destination primary Key.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

String  sPrimaryKeyField = pRelationshipClass.getDestinationPrimaryKey();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getDestinationPrimaryKey in interface IRelationshipClass
Returns:
The relDestPKey
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getOriginForeignKey

public String getOriginForeignKey()
                           throws IOException,
                                  AutomationException
The relationship origin foreign Key.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

String   sPrimaryKeyField = pRelationshipClass.getOriginForeignKey();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getOriginForeignKey in interface IRelationshipClass
Returns:
The relOrigFKey
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDestinationForeignKey

public String getDestinationForeignKey()
                                throws IOException,
                                       AutomationException
The relationship destination foreign Key.

Remarks

The DestinationForeignKey property returns the name of the destination foreign key field. This property is null except in the case of attributed relationship classes, in which case it is the name of a field in the relationship table. The values in this field reference values in the field designated as the destination primary key.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

String   sPrimaryKeyField = pRelationshipClass.getDestinationForeignKey();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getDestinationForeignKey in interface IRelationshipClass
Returns:
The relDestFKey
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipClassID

public int getRelationshipClassID()
                           throws IOException,
                                  AutomationException
The relationship class ID.

Remarks

The RelationshipClassID property returns the ID of the relationship class. This ID uniquely identifies a relationship class within its geodatabase relative to other relationship classes. It is equivalent to IObjectClass::ObjectClassID except that it applies to relationship classes rather than object classes.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

long lClassID = pRelationshipClass.getRelationshipClassID();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getRelationshipClassID in interface IRelationshipClass
Returns:
The relClassId
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getOriginClass

public IObjectClass getOriginClass()
                            throws IOException,
                                   AutomationException
The origin object class.

Remarks

When using a relationship class, the OriginClass property is used for returning an interface to the origin objectclass .

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getOriginClass in interface IRelationshipClass
Returns:
A reference to a com.esri.arcgis.geodatabase.IObjectClass
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDestinationClass

public IObjectClass getDestinationClass()
                                 throws IOException,
                                        AutomationException
The destination object class.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

IObjectClass pObjectClass = pRelationshipClass.getDestinationClass();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getDestinationClass in interface IRelationshipClass
Returns:
A reference to a com.esri.arcgis.geodatabase.IObjectClass
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getFeatureDataset

public IFeatureDataset getFeatureDataset()
                                  throws IOException,
                                         AutomationException
The feature dataset, if any, to which this relationship class belongs.

Remarks

The FeatureDataset property returns the feature dataset that this relationship class belongs to. If the relationship class exists outside of a feature dataset, a null value will be returned.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

IFeatureDataset pFeatureDataset = pRelationshipClass.getFeatureDataset();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getFeatureDataset in interface IRelationshipClass
Returns:
A reference to a com.esri.arcgis.geodatabase.IFeatureDataset
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getForwardPathLabel

public String getForwardPathLabel()
                           throws IOException,
                                  AutomationException
The forward path label for the relationship class.

Remarks

The ForwardPathLabel property returns the path label for the forward direction path. An example can be shown by using a relationship between a pump station and its pumps. A forward path label may be something like "Contains". It would be read as a pump station 'Contains' pumps.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

String sPathLabel = pRelationshipClass.getForwardPathLabel();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getForwardPathLabel in interface IRelationshipClass
Returns:
The forwardLabel
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBackwardPathLabel

public String getBackwardPathLabel()
                            throws IOException,
                                   AutomationException
The backward path label for the relationship class.

Remarks

The BackwardPathLabel property returns the path label for the backward direction path. An example can be shown by using a relationship between a pump station and its pumps. A backward path label may be something like "Contained by". It would be read as a pump is 'Contained by' the pump station.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

String sPathLabel = pRelationshipClass.getBackwardPathLabel();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getBackwardPathLabel in interface IRelationshipClass
Returns:
The backwardLabel
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCardinality

public int getCardinality()
                   throws IOException,
                          AutomationException
The cardinality for the relationship class.

Remarks

The Cardinality property returns the cardinality of the relationship class as an esriRelCardinality enumeration value. It refers to the type of relationship formed between an origin class and a destination class. It can be one of three types: esriRelCardinalityOneToOne (1-1), esriRelCardinalityOneToMany (1-M), or esriRelCardinalityManyToMany (M-N).

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

esriRelCardinality eCardinality = pRelationshipClass.getCardinality();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getCardinality in interface IRelationshipClass
Returns:
A com.esri.arcgis.geodatabase.esriRelCardinality constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getNotification

public int getNotification()
                    throws IOException,
                           AutomationException
The notification direction for the relationship class.

Remarks

The Notification property returns the relationship class' notification behavior as as esriRelNotification enumeration value. A notification occurs when an event happens, such as a deletion or an edit. It can be one of four type: esriRelNotificationNone, esriRelNotificationForward, esriRelNotificationBackward, or esriRelNotificationBoth. None means no notification will take place, forward means that notification will happen from the origin to the destination, backward means notification occurs from the destination to the origin, and both means notification will happen both ways when an event occurs.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

esriRelNotification eNotification = pRelationshipClass.getNotification();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getNotification in interface IRelationshipClass
Returns:
A com.esri.arcgis.geodatabase.esriRelNotification constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isAttributed

public boolean isAttributed()
                     throws IOException,
                            AutomationException
Indicates if the relationships in this relationship class have attributes.

Remarks

The IsAttributed property indicates whether this relationship class is attributed or not. An attributed relationship class has extra attributes that are being maintained for each relationship. For example, in a relationship class between parcels and owners, percentage of ownership each particular owner has could be stored as a relationship attribute.

The IsAttributed property will only return true if there are extra relationship attributes beyond those required to relate the objects. In the case of relationship classes with M:N cardinality, there will be a relationship table (see 'AttributedRelationshipClass' in the object model diagram), but IsAttributed will return False, unless there are additional attributes.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isAttributed in interface IRelationshipClass
Returns:
The isAttributed
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isComposite

public boolean isComposite()
                    throws IOException,
                           AutomationException
Indicates if the relationship class represents a composite relationship in which the origin object class represents the composite object.

Remarks

The IsComposite property indicates whether this relationship class is composite or simple. A composite relationship class is one where objects in the origin class control the lifetime of the objects in the destination class. When the origin object is deleted, the related destination object is also deleted. Composite relationship classes are always one to many relationships, but this can be constrained to one to one through the use of relationship rules.

If a relationship class is not composite, it is considered 'simple', and related objects are independent of each other. Simple relationships can be of any cardinality.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isComposite in interface IRelationshipClass
Returns:
The isComposite
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

createRelationship

public IRelationship createRelationship(IObject originObject,
                                        IObject destinationObject)
                                 throws IOException,
                                        AutomationException
Creates a new relationship between the two specified objects.

Remarks

The CreateRelationship method creates a relationship between the origin object and the destination object specified in the parameters. By default, when a relationship class is created, a relationship is created between the objects with corresponding primary and foreign key values. When subsequently using CreateRelationship, remember that this operation will write a value into the foreign key field. Therefore, in the case of 1:1 and 1:M relationship classes, it is possible that you could overwrite, and therefore delete, an existing relationship.

This method should be called within an edit session.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

ITable pOriginTable = new ITableProxy(pFeatureWorkspace.openTable("origintable"));

ITable pDestinationTable = new ITableProxy(pFeatureWorkspace.openTable("destinationtable"));

IFeature pOriginFeature = new IFeatureProxy(pOriginTable.getRow(2));

IFeature pDestinationFeature = new IFeatureProxy(pDestinationTable.getRow(2));

IWorkspaceEdit pWorkspaceEdit = pWorkspace;

pWorkspaceEdit.startEditing(true);

pWorkspaceEdit.startEditOperation();

IRelationship pRelationship = pRelationshipClass.createRelationship(pOriginFeature, pDestinationFeature);

pWorkspaceEdit.stopEditOperation();

pWorkspaceEdit.stopEditing(true);

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
createRelationship in interface IRelationshipClass
Parameters:
originObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
destinationObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IRelationship
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationship

public IRelationship getRelationship(IObject originObject,
                                     IObject destinationObject)
                              throws IOException,
                                     AutomationException
Get the relationship that associates the two specified objects.

Remarks

When using a relationship class, the GetRelationship method is used for returning a relationship interface to the relationship between the origin object and destination object specified in the function parameters. This can be used to retrieve the relationship between two objects.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getRelationship in interface IRelationshipClass
Parameters:
originObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
destinationObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IRelationship
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationship

public void deleteRelationship(IObject originObject,
                               IObject destinationObject)
                        throws IOException,
                               AutomationException
Deletes the relationship that associates the two specified objects.

Remarks

The DeleteRelationship method deletes the relationship between the origin object and destination object specified in the parameters. This will remove the entry for this relationship from the relationship class.

This method should be called within an edit session.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

ITable pOriginTable = new ITableProxy(pFeatureWorkspace.openTable("origintable"));

ITable pDestinationTable = new ITableProxy(pFeatureWorkspace.openTable("destinationtable"));

IFeature pOriginFeature = new IFeatureProxy(pOriginTable.getRow(2));

IFeature pDestinationFeature = new IFeatureProxy(pDestinationTable.getRow(2));

pRelationshipClass.deleteRelationship(pOriginFeature, pDestinationFeature);

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
deleteRelationship in interface IRelationshipClass
Parameters:
originObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
destinationObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getObjectsRelatedToObject

public ISet getObjectsRelatedToObject(IObject anObject)
                               throws IOException,
                                      AutomationException
Gets the objects that are related to the specified object.

Remarks

The GetObjectsRelatedToObject method returns a set of Objects (or subtypes of Object, such as features) that are related to the anObject object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getObjectsRelatedToObject in interface IRelationshipClass
Parameters:
anObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.system.ISet
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipsForObject

public IEnumRelationship getRelationshipsForObject(IObject anObject)
                                            throws IOException,
                                                   AutomationException
Get all relationships that apply to a specified object.

Remarks

The GetRelationshipsForObject method returns an IEnumRelationship enumerator containing the relationships that the anObject parameter participates in.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getRelationshipsForObject in interface IRelationshipClass
Parameters:
anObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumRelationship
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationshipsForObject

public void deleteRelationshipsForObject(IObject anObject)
                                  throws IOException,
                                         AutomationException
Deletes all relationships that apply to a specified object.

Remarks

The DeleteRelationshipsForObject method is used for removing all of the relationships in the relationship class that the specified object belongs to. Note that this method is bi-directional; the specified object could belong to the origin class or destination class.

This method should be called within an edit session.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

ITable pOriginTable = new ITableProxy(pFeatureWorkspace.openTable("origintable"));

IFeature pOriginFeature = new IFeatureProxy(pOriginTable.getRow(2));

pRelationshipClass.DeleteRelationshipsForObject(pOriginFeature)

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
deleteRelationshipsForObject in interface IRelationshipClass
Parameters:
anObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getObjectsRelatedToObjectSet

public ISet getObjectsRelatedToObjectSet(ISet anObjectSet)
                                  throws IOException,
                                         AutomationException
Gets the objects that are related to the specified origin or destination object set.

Remarks

The GetObjectsRelatedToObjectSet method returns a set of objects that are related to the objects contained by the anObjectSet parameter. It behaves the same as GetObjectsRelatedToObject, except that it accepts a set of objects as a parameter.

If multiple objects in the input set are related to a common object, that object will only be included once in the returned set.

If the input set is constructed with a cursor, ensure that a non-recycling cursor is used.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getObjectsRelatedToObjectSet in interface IRelationshipClass
Parameters:
anObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Returns:
A reference to a com.esri.arcgis.system.ISet
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipsForObjectSet

public IEnumRelationship getRelationshipsForObjectSet(ISet anObjectSet)
                                               throws IOException,
                                                      AutomationException
Get all relationships that apply to the specified origin or destination object set.

Remarks

The GetRelationshipsForObjectSet method returns an IEnumRelationship enumerator containing the relationships that the objects in anObjectSet parameter participate in.

If the input set is constructed with a cursor, ensure that a non-recycling cursor is used.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getRelationshipsForObjectSet in interface IRelationshipClass
Parameters:
anObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumRelationship
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getObjectsMatchingObjectSet

public IRelClassEnumRowPairs getObjectsMatchingObjectSet(ISet srcObjectSet)
                                                  throws IOException,
                                                         AutomationException
Gets rows pairs of objects that are related to the specified origin or destination object set.

Remarks

The GetObjectsMatchingObjectSet method returns an enumerator of related object pairs based on the object set provided as a parameter. The enumerator contains a related object pair for each relationship participated in by the input objects. For example, in a relationship class with 1:1 cardinality, passing three objects into this method will return three related object pairs, assuming all three objects participate in a relationship. In a relationship class with 1:M or M:N cardinality, passing in a single object could conceivably result in an enumerator with multiple related object pairs, if the object participates in several relationships.

If the input set is constructed with a cursor, ensure that a non-recycling cursor is used.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getObjectsMatchingObjectSet in interface IRelationshipClass
Parameters:
srcObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IRelClassEnumRowPairs
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationshipsForObjectSet

public void deleteRelationshipsForObjectSet(ISet anObjectSet)
                                     throws IOException,
                                            AutomationException
Deletes all relationships that apply to the specified origin or destination object set.

Remarks

The DeleteRelationshipsForObjectSet method is used for removing all relationships in a particular relationship class for the specified set of objects.

This method works in the same way as the DeleteRelationshipsForObject method, except on a set of objects rather than a single one. If a cursor is used to populate the set with objects, ensure that a non-recycling cursor is used.

This method should be called within an edit session.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

ITable pOriginTable = new ITableProxy(pFeatureWorkspace.openTable("origintable"));

IFeature pOriginFeature = new IFeatureProxy(pOriginTable.getRow(2));

ISet pVSet = new  ISet();

pVSet.add(pOriginTable.getRow(1));

pVSet.add(pOriginTable.getRow(2));

pVSet.add(pOriginTable.getRow(3));

pVSet.reset();

pRelationshipClass.deleteRelationshipsForObjectSet(pVSet);

pVSet = null;

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
deleteRelationshipsForObjectSet in interface IRelationshipClass
Parameters:
anObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipRules

public IEnumRule getRelationshipRules()
                               throws IOException,
                                      AutomationException
The relationship rules that apply to this relationship class.

Remarks

The RelationshipRules property retrieves the relationship rules of the relationship class as an IEnumRule enumerator. These rules are used to control which object subtypes from the origin class can be related to which object subtypes in the destination class. They can also be used to specify a valid cardinality range for all permissable subtype pairs. For example, in a feature class containing utility poles divided into wooden and steel subtypes, relationship rules could be used to specify that wooden poles may have one to three transformers attached, but steel poles may have one to five transformers attached.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

IEnumRule pEnumRule = pRelationshipClass.getRelationshipRules();

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getRelationshipRules in interface IRelationshipClass
Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumRule
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addRelationshipRule

public void addRelationshipRule(IRule rule)
                         throws IOException,
                                AutomationException
Adds a relationship rule to this relationship class.

Remarks

The AddRelationshipRule method adds a new relationship rule to the relationship class. Relationship classes can have an associated set of relationship rules. These rules are used to control which object subtypes from the origin class can be related to which object subtypes in the destination class. They can also be used to specify a valid cardinality range for all permissable subtype pairs. For example, in a feature class containing utility poles divided into wooden and steel subtypes, relationship rules could be used to specify that wooden poles may have one to three transformers attached, but steel poles may have one to five transformers attached.

Example:

IRelationshipClass pRelationshipClass = null;

pRelationshipClass = pFeatureWorkspace.openRelationshipClass("relclass");

IFeatureClass pPoleFeatureClass = null;

IFeatureClass pPoleFeatureClass = new

IFeatureClassProxy(pFeatureWorkspace.OpenFeatureClass("poles"));

IFeatureClass pTransFeatureClass = null;

IFeatureClass pTransFeatureClass = new

IFeatureClassProxy(pFeatureWorkspace.OpenFeatureClass("transformers"));

IRelationshipRule pRelationshipRule = null;

IRelationshipRule pRelationshipRule = new RelationshipRule();

pRelationshipRule.setDestinationClassID(pTransFeatureClass.getObjectClassID());

pRelationshipRule.setDestinationSubtypeCode (178);

pRelationshipRule.setDestinationMaximumCardinality ( 1);

pRelationshipRule.setDestinationMinimumCardinality ( 5);

pRelationshipRule.setOriginClassID(pPoleFeatureClass.getObjectClassID());

pRelationshipRule.setOriginSubtypeCode ( 101);

pRelationshipRule.setOriginMaximumCardinality ( 1);

pRelationshipRule.setOriginMinimumCardinality ( 1);

pRelationshipClass.addRelationshipRule(pRelationshipRule);

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
addRelationshipRule in interface IRelationshipClass
Parameters:
rule - A reference to a com.esri.arcgis.geodatabase.IRule (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationshipRule

public void deleteRelationshipRule(IRule rule)
                            throws IOException,
                                   AutomationException
Deletes a relationship rule from this relationship class.

Remarks

The DeleteRelationshipRule method deletes a relationship rule from the relationship class. Relationship classes can have an associated set of relationship rules. These rules are used to control which object subtypes from the origin class can be related to which object subtypes in the destination class. They can also be used to specify a valid cardinality range for all permissable subtype pairs. For example, in a feature class containing utility poles divided into wooden and steel subtypes, relationship rules could be used to specify that wooden poles may have one to three transformers attached, but steel poles may have one to five transformers attached.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
deleteRelationshipRule in interface IRelationshipClass
Parameters:
rule - A reference to a com.esri.arcgis.geodatabase.IRule (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.