I'm trying to setup a periodic report job. The report shall be created without user interaction and the job shall be scheduled when the application starts.
I have the background service and scheduler working. If I expose the createReport action as a button in the UI, a report is created when the job is triggered the next time. However, I need this report to be created repeatedly and without user interaction.
I guess the question is how to programmatically invoke an action? Moving createReport() to a domain service and calling it in a @PostConstruct annotated method yields an exception (trying to persist the command to IsisCommand). I'm guessing that I have to have some sort of context for the action invocation? Or am I approaching this the wrong way? Thanks!
@Action(command = CommandReification.ENABLED,
commandExecuteIn=CommandExecuteIn.BACKGROUND)
public Command createReport() {
backgroundService.execute(this).generateReport();
return commandContext.getCommand();
}
@Programmatic
public void generateReport() {
....
}