use of org.openmrs.module.reporting.report.service.ReportService in project openmrs-module-mirebalais by PIH.
the class MirebalaisHospitalActivator method started.
/**
* @see ModuleActivator#started()
*/
public void started() {
try {
// currently only one of these
Config config = Context.getRegisteredComponents(Config.class).get(0);
AdministrationService administrationService = Context.getAdministrationService();
ReportService reportService = Context.getService(ReportService.class);
ReportDefinitionService reportDefinitionService = Context.getService(ReportDefinitionService.class);
SerializedObjectDAO serializedObjectDAO = Context.getRegisteredComponents(SerializedObjectDAO.class).get(0);
PrinterService printerService = Context.getService(PrinterService.class);
DispositionService dispositionService = Context.getService(DispositionService.class);
removeOldPrivileges();
setDispositionConfig(config, dispositionService);
// register our custom print handlers
PrinterSetup.registerPrintHandlers(printerService);
// set up html forms--this must happen *after* MDS packages are installed, so that forms defined in code/github
// take precedent over any in MDS packages; therefore we still do this in the Mirebalais module, not PIH Core
HtmlFormSetup.setupHtmlForms(config);
// configure default dashboard in coreapps
updateGlobalProperty(CoreAppsConstants.GP_DASHBOARD_URL, config.getDashboardUrl());
// configure default visits page in coreapps
updateGlobalProperty(CoreAppsConstants.GP_VISITS_PAGE_URL, config.getVisitPageUrl());
// configure default specific visit detail page in coreapps
updateGlobalProperty(CoreAppsConstants.GP_VISITS_PAGE_WITH_SPECIFIC_URL, config.getVisitsPageWithSpecificUrl());
if (config.isComponentEnabled(Components.LEGACY_MPI)) {
LegacyMasterPatientIndexSetup.setupConnectionToMasterPatientIndex(customProperties);
}
if (config.isComponentEnabled(Components.ARCHIVES)) {
ArchivesSetup.setupCloseStaleCreateRequestsTask();
ArchivesSetup.setupCloseStalePullRequestsTask();
}
if (config.isComponentEnabled(Components.APPOINTMENT_SCHEDULING)) {
AppointmentSchedulingSetup.setupMarkAppointmentAsMissedOrCompletedTask();
if (config.getCountry().equals(ConfigDescriptor.Country.HAITI)) {
AppointmentSchedulingSetup.customizeDailyAppointmentsDataSet();
}
}
if (config.isComponentEnabled(Components.RADIOLOGY) && config.getSite().equals(ConfigDescriptor.Site.MIREBALAIS)) {
updateGlobalProperty(OpenmrsConstants.GP_ORDER_NUMBER_GENERATOR_BEAN_ID, MirebalaisConstants.RADIOLOGY_ORDER_NUMBER_GENERATOR_BEAN_ID);
}
if (!testMode) {
if (config.isComponentEnabled(Components.OVERVIEW_REPORTS) || config.isComponentEnabled(Components.DATA_EXPORTS)) {
// must happen after location tags have been configured
ReportSetup.setupReports(reportService, reportDefinitionService, administrationService, serializedObjectDAO, config);
}
// do app and extension configuration
Context.getRegisteredComponent("customAppLoaderFactory", CustomAppLoaderFactory.class).setReadyForRefresh(true);
ModuleFactory.getStartedModuleById("appframework").getModuleActivator().contextRefreshed();
// on first startup, these modules may not have been able to configure their global propertes correctly because
// all metadata was not loaded; we call the started method here to complete setup
ModuleFactory.getStartedModuleById("registrationapp").getModuleActivator().started();
}
} catch (Exception e) {
Module mod = ModuleFactory.getModuleById(MirebalaisConstants.MIREBALAIS_MODULE_ID);
ModuleFactory.stopModule(mod);
throw new RuntimeException("failed to setup the required modules", e);
}
log.info("Mirebalais Hospital Module started");
}
Aggregations