diff --git a/api/src/main/java/org/openmrs/module/reporting/report/renderer/IndicatorReportRenderer.java b/api/src/main/java/org/openmrs/module/reporting/report/renderer/IndicatorReportRenderer.java index 756531d990..e69de29bb2 100644 --- a/api/src/main/java/org/openmrs/module/reporting/report/renderer/IndicatorReportRenderer.java +++ b/api/src/main/java/org/openmrs/module/reporting/report/renderer/IndicatorReportRenderer.java @@ -1,109 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.reporting.report.renderer; - -import org.openmrs.api.context.Context; -import org.openmrs.module.reporting.common.Localized; -import org.openmrs.module.reporting.dataset.DataSet; -import org.openmrs.module.reporting.dataset.DataSetColumn; -import org.openmrs.module.reporting.dataset.DataSetRow; -import org.openmrs.module.reporting.indicator.dimension.CohortIndicatorAndDimensionResult; -import org.openmrs.module.reporting.report.ReportData; -import org.openmrs.module.reporting.report.ReportRequest; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - * A Default Renderer Implementation that aims to support all ReportDefinitions - */ -//@Handler -@Localized("reporting.IndicatorReportRenderer") -public class IndicatorReportRenderer extends ReportDesignRenderer { - - /** - * @see ReportRenderer#getRenderedContentType(org.openmrs.module.reporting.report.ReportRequest) - * @param request - */ - public String getRenderedContentType(ReportRequest request) { - return "text/html"; - } - - /** - * @see ReportRenderer#getFilename(org.openmrs.module.reporting.report.ReportRequest) - */ - @Override - public String getFilename(ReportRequest request) { - return getFilenameBase(request) + ".html"; - } - - /** - * @see ReportRenderer#render(ReportData, String, OutputStream) - */ - public void render(ReportData results, String argument, OutputStream out) throws IOException, RenderingException { - - Writer w = new OutputStreamWriter(out,"UTF-8"); - - Map parameterValues = results.getContext().getParameterValues(); - - - // For each dataset in the report - for (String dataSetKey : results.getDataSets().keySet()) { - DataSet dataset = results.getDataSets().get(dataSetKey); - - - //MapDataSet mapDataSet = (MapDataSet) dataset; - List columns = dataset.getMetaData().getColumns(); - w.write("

" + results.getDefinition().getName() + "

"); - w.write("" + results.getDefinition().getDescription() + ""); - w.write(""); - w.write(""); - for (DataSetColumn column : columns) { - w.write(""); - w.write(""); - w.write(""); - - // Wondering if you can even do this ... iterate over a dataset multiple times (once for each column?) - // If not, then we need to get the actual dataset data (i.e. MapDataSet). - for (DataSetRow row : dataset) { - Object cellValue = row.getColumnValue(column.getName()); - if (cellValue instanceof CohortIndicatorAndDimensionResult) { - CohortIndicatorAndDimensionResult result = (CohortIndicatorAndDimensionResult) cellValue; - w.write(""); - } - else { - w.write(""); - } - } - w.write(""); - } - w.write("
"+column.getName()+""+column.getLabel()+"" + ((cellValue != null) ? result.getValue() : "n/a") + "" + ((cellValue != null) ? cellValue : "n/a") + "
"); - } - w.flush(); - } - -} diff --git a/omod/src/main/java/org/openmrs/module/reporting/web/controller/mapping/renderers/IndicatorReportRendererMappingHandler.java b/omod/src/main/java/org/openmrs/module/reporting/web/controller/mapping/renderers/IndicatorReportRendererMappingHandler.java index 1c96e2992b..8b13789179 100644 --- a/omod/src/main/java/org/openmrs/module/reporting/web/controller/mapping/renderers/IndicatorReportRendererMappingHandler.java +++ b/omod/src/main/java/org/openmrs/module/reporting/web/controller/mapping/renderers/IndicatorReportRendererMappingHandler.java @@ -1,30 +1 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.reporting.web.controller.mapping.renderers; -import org.openmrs.annotation.Handler; -import org.openmrs.module.reporting.report.renderer.ReportRenderer; -import org.openmrs.module.reporting.report.renderer.IndicatorReportRenderer; - -/** - * Handler that determines what page is used to edit/create a new IndicatorReportRenderer - */ - -@Handler(supports=IndicatorReportRenderer.class, order=50) -public class IndicatorReportRendererMappingHandler extends RendererMappingHandler { - - /** - * @see RendererMappingHandler#getCreateUrl(Class) - */ - public String getCreateUrl( Class rendererType ) { - return "/module/reporting/reports/renderers/nonConfigurableReportRenderer.form?type=" + rendererType.getName(); - } - -}