How can I setup report objects not to be cached during development, as I am continuously changing the definitions. Currently I am using the following code:
AdministrationService as = Context.getAdministrationService(); log.warn("Removing all reports"); as.executeSQL("delete from reporting_report_design_resource;", false); as.executeSQL("delete from reporting_report_design;", false); as.executeSQL("delete from reporting_report_request;", false); as.executeSQL("delete from global_property WHERE property LIKE 'reporting.reportManager%';", false); as.executeSQL("delete from serialized_object WHERE type LIKE 'org.openmrs.module.reporting.report%'", false);
However when deploying my reports to a running instance, I am also not able to maintain changes, just in case I forget to change the report version numbers.
@ssmusoke, not sure I understand the question. Where is the code, can I see the repository?
If you are setting reports up using ReportManagerUtil.setupReport, then you can see from this method that a report will always be updated to the latest code you have written if you add “-SNAPSHOT” to the version. While you are developing, you should always do this.
What determines whether a given report updates is the version number in the report manager class. If it is a higher version than previous or if it ends in -SNAPSHOT then it will update.
You should not need the removeOldReports method unless you are trying to do a one-time cleanup or something ( I assume this was pulled from my code which was serving a discreet purpose, but is not generally needed).