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
<ERXAuditKeys.png>