On Sep 17, 2008, at 10:56, Michael Kondratov wrote:
The object is in the EC.
I've tried changing Invoice method from setInvoiceStatusRelationship
(InvoiceStatus value) to setInvoiceStatus(InvoiceStatus value)
Now setInvoiceStatus in Invoice does get exceuted, however I am not
able to call super.setInvoiceStatusRelationship(value) because they
start calling each other!!
That's because setInvoiceStatusRelationship(value) calls
addObjectToBothSidesOfRelationship(...) which in turn calls
setInvoiceStatus(value).
You need to get into how WO's key value coding works. Check out the
documentation for EOCustomObject, specifically these methods:
addObjectToBothSidesOfRelationship
takeValueForKey
takeStoredValueForKey
As for your problem, from what I understand you are trying to
achieve, you should override setInvoiceStatus(value) in your Invoice
class to do the extra work. Your method should look like this:
public void setInvoiceStatus(InvoiceStatus value) {
if(value != invoiceStatus()) {
System.out.println("updating invoice status date");
this.setInvoiceStatusDate(new NSTimestamp());
takeStoredValueForKey(value, INVOICE_STATUS_KEY);
}
}
You calling code should however use setInvoiceStatusRelationship(...)
to reap it's benefits, which will in turn call your setInvoiceStatus
(...) method. Also note that the first line in that method only
applies if the two InvoiceStatus EOs are in the same EC.
F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]