• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: A simplest way to manage relationship?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A simplest way to manage relationship?


  • Subject: Re: A simplest way to manage relationship?
  • From: Anjo Krank <email@hidden>
  • Date: Sun, 9 Nov 2003 21:05:04 +0100
  • Xx-reply-to: email@hidden

I'm using sth like:

public void setBothSidesOfAuthor(Writer newAuthor) {
if (newAuthor != author) {
if (author != null)
removeObjectFromBothSidesOfRelationshipWithKey(author, "author");
if (newAuthor != null)
addObjectToBothSidesOfRelationshipWithKey(newAuthor, "author");
}
}


which calls setAuthor() on its own...

Am Sonntag, 09.11.03 um 17:22 Uhr schrieb DevReseune:

Hi,

EOF can manage relationship in both side with:
addObjectToBothSidesOfRelationshipWithKey. But, our interface is more
complicated now. This is another solution to manage relationship. It's
the work of the Eclipse group in the EMF project:

http://dev.eclipse.org/viewcvs/indextools.cgi/~checkout~/emf-home/
docs/overview.html

This the example:

The model is:
Book 0..* (books) -------------- 1 (author) Writer

In Book:
public void setAuthor(Writer newAuthor) {
    if (newAuthor != author) {
      if (author != null)
        msgs = ((InternalEObject)author).eInverseRemove(this, ...);
      if (newAuthor != null)
        msgs = ((InternalEObject)newAuthor).eInverseAdd(this, ...);
      msgs = basicSetAuthor(newAuthor);
    }
}

and
public void basicSetAuthor(Writer newAuthor) {
    Writer oldAuthor = author;
    author = newAuthor;
}

It's simple! You only use:
	aBook.setAuthor(anAuthor);
And all the relationship is managed!

So, my question is: why Apple added this way to manage relationship and
not an EMF solution-like? I find the EMF way simplest. And you?

Fridiric
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.



Cheers, Anjo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >A simplest way to manage relationship? (From: DevReseune <email@hidden>)

  • Prev by Date: index of WODisplayGroup.displayedObjects() array
  • Next by Date: Filtering an array of EO objects (next hurdle)
  • Previous by thread: A simplest way to manage relationship?
  • Next by thread: NSArray is not a NSSet. So why Apple confuse them in EOF?
  • Index(es):
    • Date
    • Thread