WebObjects 5.2.3

com.webobjects.eointerface
Class EOMasterPeerAssociation

java.lang.Object
  extended bycom.webobjects.eocontrol.EODelayedObserver
      extended bycom.webobjects.eointerface.EOAssociation
          extended bycom.webobjects.eointerface.EOMasterAssociation
              extended bycom.webobjects.eointerface.EOMasterDetailAssociation
                  extended bycom.webobjects.eointerface.EOMasterPeerAssociation
All Implemented Interfaces:
EOObserving, NSDisposable

public class EOMasterPeerAssociation
extends EOMasterDetailAssociation

An EOMasterPeerAssociation binds two EODisplayGroups together in a master-detail relationship, where the detail EODisplayGroup shows the destination objects for the relationship of the master EODisplayGroup.

In a master-peer arrangement, the detail display group's data source is independent. Detail objects are fetched independently from the detail's data source, which means that changes to one display group aren't automatically reflected in the other. To update the other display group, it's necessary to save the changes made and then have the other display group fetch its objects again.

Contrast this with a master-detail setup using an EOMasterDetailAssociation. With an EOMasterDetailAssociation, the display group's data sources also operate in a master-detail arrangement, meaning changes to one are immediately reflected in the other. The detail objects are taken directly from the selected object in the master display group, so that changes to the objects in one display group are instantly reflected in the other. Master-peer setups display these advantages over master-detail setups:

You can use them to display the destination objects for relationships that are defined in the model but are not declared as class properties. This is typically done for rarely accessed information, or information that is costly to access. By not defining the relationship as a class property, the destination objects aren't stored as instance variables in the source objects, which saves memory and the cost of constructing faults for the relationship.

Because the detail display group fetches objects with its own data source, you can configure the detail data source with an auxiliary EOQualifier to limit the objects fetched. This further reduces the cost of fetching data.

You can use an EOMasterPeerAssociation to fetch detail information that may be updated in another editing context or even in another application. Thus this association helps you to remain "up to date" with the database.

Generally, master-peer setups are only appropriate when no insertions or deletions will be made in the detail display group. For a master-detail relationship that reflects changes between two display groups, including insertions and deletions, use an EOMasterDetailAssociation.

Usable With:
EODisplayGroups whose data sources are not EODetailDataSources

Aspects:

parentA relationship from the master EODisplayGroup.

Example

Suppose you have a database of salesmen and their associated sales. Each salesman has a city ID. The sales are related to the salesmen by salesman ID, but also have a city ID. You want a list of all the sales in a salesman's city so you could evaluate it against other salesmen. For this, you create a relationship between salesman and sales based on city ID (the relationship is not a class property). You can then display that information using an EOMasterPeerAssociation.


Field Summary
 
Fields inherited from class com.webobjects.eointerface.EOAssociation
ActionAspect, ArgumentAspect, AttributeAspectSignature, AttributeToManyAspectSignature, AttributeToOneAspectSignature, AttributeToOneToManyAspectSignature, BackgroundColorAspect, BoldAspect, ChildrenAspect, DestinationAspect, EnabledAspect, ExpandedIconAspect, IconAspect, IgnoreValue, IsLeafAspect, ItalicAspect, MatchKey1Aspect, MatchKey2Aspect, MatchKey3Aspect, NullAspectSignature, ParentAspect, RootAspect, SelectedIndexAspect, SelectedObjectAspect, SelectedTitleAspect, SetValue, SourceAspect, TextColorAspect, TitlesAspect, ToManyAspectSignature, ToOneAspectSignature, ToOneToManyAspectSignature, UnsetValue, URLAspect, ValueAspect
 
Fields inherited from class com.webobjects.eocontrol.EODelayedObserver
ObserverNumberOfPriorities, ObserverPriorityFifth, ObserverPriorityFirst, ObserverPriorityFourth, ObserverPriorityImmediate, ObserverPriorityLater, ObserverPrioritySecond, ObserverPrioritySixth, ObserverPriorityThird
 
Constructor Summary
EOMasterPeerAssociation(Object object)
          Creates a new EOMasterPeerAssociation to monitor and update the objects in object, an EODisplayGroup.
 
Method Summary
 boolean isUsableWithObject(Object object)
          Returns true if object is an instance of EODisplayGroup and its data source is either null or an EODetailDataSource (EOControl).
 void subjectChanged()
          See the subjectChanged method description in the superclass EOAssociation.
 
Methods inherited from class com.webobjects.eointerface.EOMasterDetailAssociation
dispose
 
Methods inherited from class com.webobjects.eointerface.EOMasterAssociation
primaryAspect, priority
 
Methods inherited from class com.webobjects.eointerface.EOAssociation
aspects, aspectSignatures, associationClassesForObject, bindAspect, breakConnection, copyMatchingBindingsFromAssociation, displayGroupForAspect, displayGroupKeyForAspect, endEditing, establishConnection, isConnected, isEnabled, isEnabledAtIndex, isExplicitlyDisabled, object, objectKeysTaken, registerAssociationClass, setExplicitlyDisabled, setObject, setValueForAspect, setValueForAspectAtIndex, shouldEndEditing, shouldEndEditingAtIndex, valueForAspect, valueForAspectAtIndex
 
Methods inherited from class com.webobjects.eocontrol.EODelayedObserver
discardPendingNotification, objectWillChange, observerQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EOMasterPeerAssociation

public EOMasterPeerAssociation(Object object)
Creates a new EOMasterPeerAssociation to monitor and update the objects in object, an EODisplayGroup. You normally set up associations with Interface Builder, in which case you don't need to create them programmatically. However, if you do create them up programmatically, setting them up is a multi-step process. After creating an association, you must bind its aspects and establish its connections.

Parameters:
object - EODisplayGroup for this association to monitor and update
See Also:
EOAssociation.bindAspect(java.lang.String, com.webobjects.eointerface.EODisplayGroup, java.lang.String), EOAssociation.establishConnection()
Method Detail

isUsableWithObject

public boolean isUsableWithObject(Object object)
Returns true if object is an instance of EODisplayGroup and its data source is either null or an EODetailDataSource (EOControl).

Overrides:
isUsableWithObject in class EOMasterDetailAssociation
Parameters:
object - this method should verify that object is usable with the association
Returns:
true if object is an instance of EODisplayGroup and its data source is not null and is not an an instance of com.webobjects.eocontrol.EODetailDataSource
See Also:
EOAssociation.isUsableWithObject(java.lang.Object)

subjectChanged

public void subjectChanged()
Description copied from class: EOMasterDetailAssociation
See the subjectChanged method description in the superclass EOAssociation.

Overrides:
subjectChanged in class EOMasterDetailAssociation
See Also:
EOAssociation.subjectChanged()

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.