Hi,

After my previous posts concerning the Documentum audit trail entries (dm_audittrail) http://www.javablog.fr/documentum-creation-of-audit-trail-entries-dm_audittrail.html and http://www.javablog.fr/deleting-of-audit-trail-entries-dm_audittrail.html, here, I would like to expose a solution in order to force content server to store some extra information in dm_audittrail.application_code. This information stored in the SessionConfig allows the identification of dm_audittrail / dm_audittrail_acl created through the current session.

Here, DQL example:

begintran,c
#
set,c,sessionconfig,application_code
my_value_of_app_code
#.... actions generating dm_audittrail  entries
#....
save,c,l
#
commit,c

Here, JAVA DFC example:

@Override
public void onSessionCreate(IDfSession session) throws DfException {
    setApplicationCode(session, "my_value");

    //.... actions generating dm_audittrail  entries

}
         
private void setApplicationCode(IDfSession session, String value) throws DfException {
    IDfTypedObject sessionConfig = session.getSessionConfig();
 
    if (StringUtils.isBlank(value)) {
        return;
    }
 
    boolean needAdd = true;
    for (int n = sessionConfig.getValueCount("application_code"), i = n; i > 0; i--) {
        if (value.equals(sessionConfig.getRepeatingString("application_code", i - 1))) {
            needAdd = false;
        }
    }
    if (needAdd) {
        sessionConfig.appendString("application_code", value);
    }
}

Best regards,

Huseyin OZVEREN