Re: [Wonder-disc] sample code of ERCAuditTrail
Re: [Wonder-disc] sample code of ERCAuditTrail
- Subject: Re: [Wonder-disc] sample code of ERCAuditTrail
- From: Ramsey Gurley <email@hidden>
- Date: Mon, 30 Jul 2012 08:22:14 -0700
On Jul 29, 2012, at 6:30 PM, Theodore Petrosky wrote:
> So if I want to track another EO I need to set up that object as an actor and add the ERXAuditKeys? Or am I missing something.
No, you just add ERXAuditKeys to the user info dictionary. The framework detects that key at startup and sets up the EO for auditing when it does. If you only want to audit certain keys, then you add them in the value part of the ERXAuditKeys. By default, it audits all the attributes.
> I did have a problem with the table ERCAuditTrail it created a column is_deleted as a integer column but it needs to be a boolean. I fixed it manually.
There are a lot of things about that framework that I don't like, but can't fix. People are using it already. I've started a replacement (ERCoreBL in my ponder repo) that does the parts I like and makes room for some things I feel are missing. It's not done yet, but feel free to use what you like from it.
Ramsey
>
> Ted
>
> --- On Sun, 7/29/12, Ramsey Gurley <email@hidden> wrote:
>
>> From: Ramsey Gurley <email@hidden>
>> Subject: Fwd: [Wonder-disc] sample code of ERCAuditTrail
>> To: "WebObjects-Dev Mailing List List" <email@hidden>
>> Cc: "Theodore Petrosky" <email@hidden>
>> Date: Sunday, July 29, 2012, 8:51 PM
>> If you already have
>> user preference working, then all you need is step 7.
>>
>> Begin forwarded message:
>> From:
>> Dieter
>> Stollorcz <email@hidden>
>> Subject:
>> Re:
>> [Wonder-disc] sample code of ERCAuditTrail
>> Date:
>> June 29,
>> 2012 4:31:35 AM MST
>> To:
>> Duc Thanh
>> Nguyen <email@hidden>
>> Cc:
>> wonder
>> Project <email@hidden>
>>
>> Hi Duc,
>>
>> here is how i set up ERCAuditTrails
>> and ERCPreference:
>> 1. Add the ERCoreBusinessLogic to build
>> path
>> 2. Create the ERCoreBusinessLogic Tables in
>> DB
>> Run migrations or add the relevant tables to DB
>>
>> 3. Implement ERCoreUserInterface on user entity ( my
>> UserEntity is ECOM_Actor)public class ECOM_Actor
>> extends _ECOM_Actor implements ERCoreUserInterface
>> { ... public static final
>> String PreferencesKey =
>> "preferences";
>> @Override
>> public NSArray
>> preferences() {
>> return
>> (NSArray)storedValueForKey(PreferencesKey);
>> }
>>
>> @Override
>> public void
>> setPreferences(NSArray array) {
>> takeStoredValueForKey(array.mutableClone(),
>> PreferencesKey);
>>
>> }
>>
>> @Override
>> public void
>> newPreference(EOEnterpriseObject pref) {
>> addObjectToBothSidesOfRelationshipWithKey(pref,
>> PreferencesKey);
>> }
>>
>>
>> 4. In Application.java add
>> @Override
>> public void finishInitialization()
>> {
>> super.finishInitialization();
>> ERCoreBusinessLogic.sharedInstance().addPreferenceRelationshipToActorEntity("ECOM_Actor");
>> }
>>
>> 5. Set the user as the actor at login
>> (DirectAction.java)public WOActionResults
>> loginAction() {
>> ...
>> ((Session)session()).setCurrentUser(user);
>> ....
>> }
>> 6. Set the Actor in
>> session.java public void
>> setCurrentUser(ECOM_Actor user) { ERCoreBusinessLogic.setActor(user);
>> _currentUser = user;
>> }
>>
>> public void awake() {
>> super.awake();
>> if (currentUser() != null) {
>>
>> ERCoreBusinessLogic.setActor(currentUser());
>> }
>> }
>>
>> public void sleep() {
>>
>> ERCoreBusinessLogic.setActor(null);
>> super.sleep();
>> }
>> 7. In EntityModeler add
>> the ERXAuditKeys Include your list of
>> ERXAuditKeys in the userInfo dictionary for the
>> Entity.If you include the ERXAuditKeys key with
>> an empty value, it will log all your attributes by
>> default.
>>
>> Dieter
>>
>>
>>
>>
>> Am 29.06.2012 um 08:00 schrieb Duc Thanh Nguyen:
>>
>> Hi everyone,
>> Could you pls share with me some sample code of
>> ERCAuditTrail? I'd love to see examples on how to use
>> ERCAuditTrail. Thanks so much.
>> Bin
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's
>> security and
>> threat landscape has changed and how IT managers can
>> respond. Discussions
>> will include endpoint security, mobile security and the
>> latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
>> Wonder-disc mailing list
>> email@hidden
>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's
>> security and
>> threat landscape has changed and how IT managers can
>> respond. Discussions
>> will include endpoint security, mobile security and the
>> latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
>> Wonder-disc mailing list
>> email@hidden
>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>>
>>
_______________________________________________
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