ERCoreBL's ERCAuditTrail - How do I use this?
ERCoreBL's ERCAuditTrail - How do I use this?
- Subject: ERCoreBL's ERCAuditTrail - How do I use this?
- From: Flavio Donadio <email@hidden>
- Date: Wed, 11 Nov 2015 23:11:46 -0200
Hello, list! Hello, Ramsey!
I want to implement ERCAuditTrail from Ponder (ERCoreBL framework, not ERCoreBusinessLogic) in a new app.
Searching through the archives, I’ve found this:
On 29 Jun 2012, at 12:31, Dieter Stollorcz wrote:
> 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.
I have some questions:
1. Is this the way to do it? Has something changed from 2012?
2. Dieter says “[r]un migrations or add the relevant tables to DB”. If my app migrates automatically on startup, do I still need to do this?
3. Does the UserEntity have to be a subclass of ERUser?
Cheers,
Flavio
_______________________________________________
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