cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically add entries to a document's History tab

mark_
Champ on-the-rise
Champ on-the-rise

Is there a way to programatically add entries to a document's History tab, in a similar fashion to putting text into the Comment field at the bottom of the document's edit tab?

I can see that these records end up in the nxp_logs table. Is there an proper way to interact with this data?

1 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

We can first say, the Nuxeo audit system is simply implemented into database as a simple table that manage main fields audit entries (nxp_logs) and a second table that stores extended infos (nxp_logs_extinfo). Entries are simply manage by Hibernate framework.

There is two ways to add an audit entry:

  • throw custom event and ask to audit it. With this approach you can also attach listeners to your event.
  • directly add the audit entry into the audit tables using hibernate.

For the first point, Nuxeo source code give examples of audit management. You can find these examples into unit tests here. You will find how to create events. To audit them (add a line into the audit table), you will just need to create a contribution that will ask to audit your type of events. see here. If you need to add extended information you will find example, here.

For the second point, you will find example here

View answer in original post

2 REPLIES 2

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

We can first say, the Nuxeo audit system is simply implemented into database as a simple table that manage main fields audit entries (nxp_logs) and a second table that stores extended infos (nxp_logs_extinfo). Entries are simply manage by Hibernate framework.

There is two ways to add an audit entry:

  • throw custom event and ask to audit it. With this approach you can also attach listeners to your event.
  • directly add the audit entry into the audit tables using hibernate.

For the first point, Nuxeo source code give examples of audit management. You can find these examples into unit tests here. You will find how to create events. To audit them (add a line into the audit table), you will just need to create a contribution that will ask to audit your type of events. see here. If you need to add extended information you will find example, here.

For the second point, you will find example here

Alain_ESCAFFRE
Star Contributor
Star Contributor

You can also use the operation http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewOperation/Audit.Log

You can use it from Studio, in an automation chain, or programmatically (calling the chain in java).

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.