ssmusoke
(Stephen Senkomago Musoke)
July 6, 2021, 6:25am
1
I would like to force a reload of all my reports when I release a new version of the module containing them
How can I detect that a new version of a module has been released, I do not see any module versions persisted in the global_property table
Is there any hook available that I can plug into to run commands on a module version change
@mseaton @mogoodrich do you have any such advice especially for reports
ruhanga
(Nathan Ruhanga)
July 6, 2021, 7:50am
2
@ssmusoke I’d track the reporting module version through some custom GP using some/modified version of the code snippet below if the reports are managed by a custom module via it’s Activator.started()
.
String currentReportingModuleVersion = ModuleFactory.getStartedModuleById("org.openmrs.module.reporting").getVersion();
String previousReportingModuleVersion = Context.getAdministrationService().getGlobalProperty("org.openmrs.module.reporting.version");
if (!ModuleUtil.matchRequiredVersions(currentReportingModuleVersion, previousReportingModuleVersion)) {
for (ReportManager reportManager : Context.getRegisteredComponents(ReportManager.class)) {
ReportManagerUtil.setupReport(reportManager);
}
Context.getAdministrationService().saveGlobalProperty(new GlobalProperty("org.openmrs.module.reporting.version", currentReportingModuleVersion));
}
1 Like
ssmusoke
(Stephen Senkomago Musoke)
July 6, 2021, 8:51am
3
@ruhanga Thanks! Seems like that is the way we have to go in order to get this done