Forcing a Reload of Reports on Module Verison Change

I would like to force a reload of all my reports when I release a new version of the module containing them

  1. 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

  2. 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

@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)) {
			Context.getAdministrationService().saveGlobalProperty(new GlobalProperty("org.openmrs.module.reporting.version", currentReportingModuleVersion));
1 Like

@ruhanga Thanks! Seems like that is the way we have to go in order to get this done