[
https://jira.nuxeo.org/browse/NXP-4657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=71925#action_71925
]
Eugen Ionica commented on NXP-4657:
-----------------------------------
we have the following situation:
- a document is removed
- the AuditEventLogger which is a PostCommitEventListener receive the event
bundle AFTER the document is removed
- an events from eventbudle contains as source an ShallowDocumentModel( is
normal since the document doesn't exist anymore )
- trying to log extended informations fails due:
Caused by: java.lang.UnsupportedOperationException
at
org.nuxeo.ecm.core.event.impl.ShallowDocumentModel.getProperty(ShallowDocumentModel.java:225)
at
org.nuxeo.ecm.platform.el.DocumentModelResolver.getValue(DocumentModelResolver.java:97)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
at com.sun.el.parser.AstValue.getValue(AstValue.java:117)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
at
org.nuxeo.ecm.platform.el.ExpressionEvaluator.evaluateExpression(ExpressionEvaluator.java:42)
at
org.nuxeo.ecm.platform.audit.service.NXAuditEventsService.doPutExtendedInfos(NXAuditEventsService.java:244)
at
org.nuxeo.ecm.platform.audit.service.NXAuditEventsService.logDocumentEvent(NXAuditEventsService.java:735)
at
org.nuxeo.ecm.platform.audit.service.NXAuditEventsService.logEvent(NXAuditEventsService.java:688)
at
org.nuxeo.ecm.platform.audit.service.NXAuditEventsService.logEvents(NXAuditEventsService.java:677)
a quick fix for that is :
protected void doPutExtendedInfos(LogEntry entry,
EventContext eventContext, DocumentModel source, Principal
principal) {
if ( source instanceof ShallowDocumentModel) { // nothing to log ; it's
a light doc
return;
}
[...]
http://hg.nuxeo.org/nuxeo/nuxeo-features/rev/87fcb6d510bb
> extends audit service to support adapters in EL expressions
> -----------------------------------------------------------
>
> Key: NXP-4657
> URL: https://jira.nuxeo.org/browse/NXP-4657
> Project: Nuxeo Enterprise Platform
> Issue Type: Improvement
> Reporter: Eugen Ionica
>
> *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>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets