Re: A simplest way to manage relationship?
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.