Calling an operation from an event listener: how to inject dependencies ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2015 12:24 PM
Hi,
I need to call the "ExportStructureToFS" operation from an event listener in order to trigger a scheduled export mys documents.
I found this explanation about how to call operations from java code, but I can't get the AutomationService and OperationContext injected as suggested in the example.
I use this declarations:
@Context
protected AutomationService service;
@Context
protected OperationContext context;
Both service and context end being set to null using this technique.
What's wrong ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2015 01:09 PM
Hello,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2015 01:50 PM
Hi,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2015 05:06 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2015 11:05 AM
Dependency injection via the @context annotation works calling one operation from another.
In that case using:
AutomationService automationService = Framework.getService(AutomationService.class);
To get the service implementation
And
automationService.run(new OperationContext(), "ExportStructureToFS", parameters);
Solved my problem
