Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-4657

extends audit service to support adapters in EL expressions

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      *issue : with current audit service can NOT log values resulted from customized method calls

      Audit Service use EL expression to add extra information to be logged.
      For now there are 3 objects available in the context to be used in EL
      expressions:

      message - Document message describing the event
      source - Document from which the event is from
      principal - Identity of the event owner

      <extension point="extendedInfo" target="org.nuxeo.ecm.platform.audit.service.NXAuditEventsService">
      <extendedInfo expression="${source.myschema.myproperty}" key="extraInfo" />
      </extension>

      But sometimes we need to implement some logic to produce the value that we want to record
      in our case
      [...]
      if (doc.isProxy()) {
      CoreSession session = CoreInstance.getInstance().getSession(sessionId);
      DocumentModel tmp = session.getSourceDocument(doc.getRef());
      originalDocUUID = session.getSourceDocument(tmp.getRef()).getId();
      }
      else {
      originalDocUUID = doc.getId();
      }
      [...]

      • posbile solution
        added a new extension point to org.nuxeo.ecm.platform.audit.service.NXAuditEventsService called "docAdapter"

      using this point will register an adapter for DocuementModel
      <extension point="doc" target="org.nuxeo.ecm.platform.audit.service.NXAuditEventsService">
      <adapter class="org.nuxeo.myadapter" name="myadapter" />
      </extension>

      class - is the qualified name of the class that will wrap the document model specified by "source"
      name - is the name that will be used in EL

      then win "extendedInfo" will add
      <extension point="extendedInfo" target="org.nuxeo.ecm.platform.audit.service.NXAuditEventsService">
      <extendedInfo expression="${myadapter.originalDocUUID}" key="original_doc_uuid" />
      </extension>

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                eionica Eugen Ionica
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: