Re: didUpdate?
Re: didUpdate?
- Subject: Re: didUpdate?
- From: Ramsey Gurley <email@hidden>
- Date: Sun, 29 Jul 2012 10:54:45 -0700
I agree with David,
You can do this based off of didInsert in the ERCore audit trail entry. The audit trail entry will already have all your before and after values, and didInsert will only be fired after a successful save. It seems the only thing lacking is a didInsert method that posts a notification on ERCAuditTrailEntry. [Patches welcome :-)] Plus, ERCore already has email queuing and processing built in too.
Compared to the trivial implementation, this is better. All your code is contained in one observer class that watches for notifications. While it might be trivial to add this sort of thing to view components, control code doesn't belong in the view. Ultimately, you would end up with hooks and conditional code to trigger this behavior all over your view classes.
By sticking with D2W, you just helped yourself maintain clean MVC :-)
Ramsey
On Jul 29, 2012, at 7:46 AM, David Holt wrote:
> You could use the AuditTrail and email the update entry to your users.
>
> David
>
>
> On 2012-07-29, at 7:28 AM, Theodore Petrosky <email@hidden> wrote:
>
>>
>> I found a solution but I want to know how bad it is?
>>
>> in my Session's awake, I am creating an EC and doing a fetch of all my Projects:
>>
>> EOEditingContext theComparisonEC = ERXEC.newEditingContext();
>> NSArray<Project> compArray = Project.fetchAllProjects(theComparisonEC);
>> ERXThreadStorage.takeValueForKey(compArray, "theCompArray");
>>
>>
>> then in the willUpdate() method, I iterate over the array and find the primaryKey of the current Project.
>>
>> Now I have my before and after.
>>
>> the question is, how bad is this. I can not imaging that this database will ever get over a few thousand rows. Meaning if it is still in use in 10 years, there will be 5k rows.
>>
>>
>>
>>
>> --- On Sat, 7/28/12, Tim Worman <email@hidden> wrote:
>>
>>> From: Tim Worman <email@hidden>
>>> Subject: Re: didUpdate?
>>> To: "Theodore Petrosky" <email@hidden>
>>> Cc: "Paul Yu" <email@hidden>, "email@hidden" <email@hidden>
>>> Date: Saturday, July 28, 2012, 11:49 PM
>>> This is in the
>>> API for ERXGenericRecord. Have you tried it?
>>> changesFromCommittedSnapshotpublic
>>> NSDictionary<String,Object>
>>> changesFromCommittedSnapshot()Description copied from
>>> interface: ERXEnterpriseObjectComputes
>>> the current set of changes that this object has from the
>>> currently committed snapshot.
>>> Specified
>>> by:changesFromCommittedSnapshot in
>>> interface ERXEnterpriseObjectReturns:a
>>> dictionary holding the changed values from the currently
>>> committed snapshot.
>>> TimUCLA GSE&IS
>>> On Jul 28, 2012, at 7:36 PM, Theodore Petrosky
>>> <email@hidden>
>>> wrote:
>>> Are you thinking that in the willUpdate() method
>>> I should have access to the attributes before they are
>>> changed?
>>>
>>> or that I should do something in this method because I just
>>> tested it with a log statement and the attributes are
>>> already changed.
>>>
>>> this would have been trivial in a regular wonder app. but I
>>> am forcing myself to stay in D2W.
>>>
>>> --- On Sat, 7/28/12, Paul Yu <email@hidden>
>>> wrote:
>>>
>>> From: Paul Yu <email@hidden>
>>> Subject: Re: didUpdate?
>>> To: "Theodore Petrosky" <email@hidden>
>>> Cc: "email@hidden"
>>> <email@hidden>
>>> Date: Saturday, July 28, 2012, 10:06 PM
>>> willUpdate()?
>>>
>>> Sent from my iPad
>>>
>>> On Jul 28, 2012, at 9:03 PM, Theodore Petrosky <email@hidden>
>>> wrote:
>>>
>>> So, I got my D2W app sending email
>>> when I update or
>>> create a new object by overriding didUpdate in
>>> the EO.
>>>
>>> basically, my email says "This record has been
>>> updated"
>>> and here are the attributes.
>>>
>>> How can I get a copy of the original. I mean, I want
>>> the email to say:
>>>
>>> here is the old title: Big title.
>>> Here is the new title: New title.
>>>
>>> Where can I get a copy of the EO before it gets
>>> updated?
>>>
>>> Ted
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be
>>> ignored.
>>> Webobjects-dev mailing list
>>> (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be
>>> ignored.
>>> Webobjects-dev mailing list
>>> (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden