-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 10.3
-
Component/s: Automation
-
Tags:
-
Backlog priority:200
-
Sprint:nxcore 11.1.2
-
Story Points:2
It is sometime very useful to pass properties to the an async. event.
It is hard to do it because the operation just expects the name of the event.
So, please, allow for also passing a property list:
p1=123 p2=toto etc.
So, when handling the event from JS Automation, we can:
var p1 = ctx.Event.context.getProperty("p1"); var p2 = ctx.Event.context.getProperty("p2");
Workaround is cumbersome. Either write a plugin or use Automation Scripting:
1. Add the Allowed Java classes in XML:
<extension target="org.nuxeo.automation.scripting.internals.AutomationScriptingComponent" point="classFilter"> <classFilter> <allow>org.nuxeo.runtime.api.Framework</allow> <allow>org.nuxeo.ecm.core.event.EventProducer</allow> <allow>org.nuxeo.ecm.core.event.impl.EventContextImpl</allow> <allow>org.nuxeo.ecm.core.event.impl.DocumentEventContext</allow> </classFilter> </extension>
2. Use them in script:
. . . var evctx = new org.nuxeo.ecm.core.event.impl.DocumentEventContext(Session, Session.getPrincipal(), domain.doc); evctx.setProperty("createData_start", start); evctx.setProperty("createData_end", end); var service = org.nuxeo.runtime.api.Framework.getService(org.nuxeo.ecm.core.event.EventProducer.class); service.fireEvent( evctx.newEvent("CreateDataAsync") ); . . .