com.esri.arcgis.geodatabase
Interface IRelationshipClassEvents

All Superinterfaces:
EventListener, Serializable
All Known Implementing Classes:
IRelationshipClassEventsAdapter, IRelationshipClassEventsProxy

public interface IRelationshipClassEvents
extends EventListener, Serializable

Provides access to events that occur with a relationship class.

Description

Both the RelationshipClass and AttributedRelationshipClass object support IRelationshipClassEvents as an outoing interface to provide events when Relationship objects are created, deleted and changed. A Relationship object supporting IRelationship is passed in to allow you to identify the origin and destination objects as well as the RelationshipClass itself.

Appropriate places to begin listening to IRelationshipClassEvents on a RelationshipClass include from within an Editor Extension or within a Class Extension. You must specifically identify the RelationshipClass that you wish to listen to events on.

OnCreate is fired if you create a new simple or attributed relationship in one of the following ways :

Note that if you call IRelationshipClass.CreateRelationship on a simple relationship this changes the foreign key inside the destination object to point to the new origin object: i.e the old relationship is deleted in creating the new relationship. No OnDelete event will be fired corresponding to this implicit deletion. An application may be interested in the details of the relationship that was implicitly deleted. This can be achieved by getting the ISimpleRelationshipChanges interface on the Relationship object passed in to the OnCreate event. This interface has a single property OldOriginKey that the application can use to get the key of the origin object. Any further fetching of the old origin object is up to the application using this key.

OnDelete is fired if you delete a simple or attributed relationship in one of the following ways:

OnChange is fired if you do any of the following:

Note that one can also create and delete relationships implicitly by directly using put_Value to set the origin foreign key field inside the destination object in the case of a simple relationship class. However, no events in IRelationshipClassEvents will be fired if the user does this (for eg. uses the Table document to directly set foreign key values in the destination object).

An application wishing to track such changes must listen to IObjectClassEvents.OnChange on the destination object class and track changes to the foreign key using IRowChanges. Note that IObjectClassEvents.OnChange will not be fired on the destination object class in a simple relationship class if the user changes the foreign key value using IRelationshipClass.CreateRelationship or IRelationshipClass.DeleteRelationship

It is important to note that retrieving the origin object or the destination object will issue queries against the database to retrieve the object requrested. This can slow down the process of creating/modifying relationships - This is specially true for attributed relationships.

Product Availability

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

See Also:
RelationshipClass, IRelationshipClassEvents, esriRelRole

Method Summary
 void onChange(IRelationshipClassEventsOnChangeEvent theEvent)
          This event is fired when a relationship's attributes are updated.
 void onCreate(IRelationshipClassEventsOnCreateEvent theEvent)
          This event is fired when a new relationship is created in the relationship class.
 void onDelete(IRelationshipClassEventsOnDeleteEvent theEvent)
          This event is fired when an relationship is deleted from the relationship class.
 

Method Detail

onCreate

void onCreate(IRelationshipClassEventsOnCreateEvent theEvent)
              throws IOException,
                     AutomationException
This event is fired when a new relationship is created in the relationship class.

Description

OnCreate is fired if you create a new simple or attributed relationship in one of the following ways :

Note that if you call IRelationshipClass::CreateRelationship on a simple relationship this changes the foreign key inside the destination object to point to the new origin object : i.e the old relationship is deleted in creating the new relationship. No OnDelete event will be fired corresponding to this implicit deletion. An application may be interested in the details of the relationship that was implicitly deleted. This can be achieved by getting the ISimpleRelationshipChanges interface on the Relationship object passed in to the OnCreate event. This interface has a single property OldOriginKey that the application can use to get the key of the origin object. Any further fetching of the old origin object is up to the application using this key.

Note that one can also create and delete relationships implicitly by directly using put_Value to set the origin foreign key field inside the destination object in the case of a simple relationship class. However, no events in IRelationshipClassEvents will be fired if the user does this (for eg. uses the Table document to directly set foreign key values in the destination object).

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
theEvent - The event
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onDelete

void onDelete(IRelationshipClassEventsOnDeleteEvent theEvent)
              throws IOException,
                     AutomationException
This event is fired when an relationship is deleted from the relationship class.

Description

OnDelete is fired if you delete a simple or attributed relationship in one of the following ways:

Note that one can also create and delete relationships implicitly by directly using put_Value to set the origin foreign key field inside the destination object in the case of a simple relationship class. However, no events in IRelationshipClassEvents will be fired if the user does this (for eg. uses the Table document to directly set foreign key values in the destination object).

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
theEvent - The event
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onChange

void onChange(IRelationshipClassEventsOnChangeEvent theEvent)
              throws IOException,
                     AutomationException
This event is fired when a relationship's attributes are updated.

Description

OnChange is fired if you do any of the following:

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
theEvent - The event
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.