<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calling an operation from an event listener: how to inject dependencies ? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314144#M1145</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jun 2015 17:50:47 GMT</pubDate>
    <dc:creator>Antoine_Cordier</dc:creator>
    <dc:date>2015-06-04T17:50:47Z</dc:date>
    <item>
      <title>Calling an operation from an event listener: how to inject dependencies ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314142#M1143</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I need to call the "ExportStructureToFS" operation from an event listener in order to trigger a scheduled export mys documents.&lt;/P&gt;
&lt;P&gt;I found this &lt;A href="https://doc.nuxeo.com/display/NXDOC/Calling+Automation+from+Java"&gt;explanation&lt;/A&gt; about how to call operations from java code, but I can't get the AutomationService and OperationContext injected as suggested in the example.&lt;/P&gt;
&lt;P&gt;I use this declarations:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Context
protected AutomationService service;

@Context
protected OperationContext context;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Both service and context end being set to null using this technique.&lt;/P&gt;
&lt;P&gt;What's wrong ?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 16:24:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314142#M1143</guid>
      <dc:creator>Antoine_Cordier</dc:creator>
      <dc:date>2015-06-04T16:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an operation from an event listener: how to inject dependencies ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314143#M1144</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 17:09:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314143#M1144</guid>
      <dc:creator>Vladimir_Pasqui</dc:creator>
      <dc:date>2015-06-04T17:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an operation from an event listener: how to inject dependencies ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314144#M1145</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 17:50:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314144#M1145</guid>
      <dc:creator>Antoine_Cordier</dc:creator>
      <dc:date>2015-06-04T17:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an operation from an event listener: how to inject dependencies ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314145#M1146</link>
      <description>&lt;P&gt;I've just read about the @context annotation and it seems to precisely be out of context here. If i'm right dependency injection is not available in this case except for unit testing.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 21:06:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314145#M1146</guid>
      <dc:creator>Antoine_Cordier</dc:creator>
      <dc:date>2015-06-04T21:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an operation from an event listener: how to inject dependencies ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314146#M1147</link>
      <description>&lt;P&gt;Dependency injection via the @context annotation works calling one operation from another.&lt;/P&gt;
&lt;P&gt;In that case using:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;AutomationService automationService = Framework.getService(AutomationService.class);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To get the service implementation&lt;/P&gt;
&lt;P&gt;And&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;automationService.run(new OperationContext(), "ExportStructureToFS", parameters);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Solved my problem&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2015 15:05:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/calling-an-operation-from-an-event-listener-how-to-inject/m-p/314146#M1147</guid>
      <dc:creator>Antoine_Cordier</dc:creator>
      <dc:date>2015-06-05T15:05:45Z</dc:date>
    </item>
  </channel>
</rss>

