=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java' --- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java 2011-05-27 11:25:15 +0000 +++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java 2011-10-13 07:01:58 +0000 @@ -156,5 +156,7 @@ Map getDataFromDataValueTable( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodIdsByComma ); Map getDataFromDataValueTableByPeriodAgg( String orgUnitIdsByComma, String dataElmentIdsByComma, String periodIdsByComma ); + + List getReportDesignWithMergeCells( String fileName ); } === modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportType.java' --- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportType.java 2011-06-27 07:27:58 +0000 +++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportType.java 2011-10-13 07:01:58 +0000 @@ -55,6 +55,11 @@ public final static String RT_ADVANCED_REPORT = "Advanced Reports"; public final static String RT_BULK_REPORT = "Bulk Reports"; + + public final static String RT_IDSP_REPORT = "IDSP Reports"; + + public final static String RT_LINELIST_BULK_REPORT = "Linelisting Bulk Reports"; + public static List getReportTypes() { @@ -84,6 +89,10 @@ reportTypes.add( RT_LINELIST_WEB_PORTAL ); + reportTypes.add( RT_IDSP_REPORT ); + + reportTypes.add( RT_LINELIST_BULK_REPORT ); + return reportTypes; } } === modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java' --- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2011-09-03 05:48:23 +0000 +++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2011-10-13 07:01:58 +0000 @@ -1448,6 +1448,81 @@ } + +// ------------------------------------------------------------------------- +// Get ReportDesign (decode tags) from corresponding xml file +// ------------------------------------------------------------------------- + +public List getReportDesignWithMergeCells( String fileName ) +{ + List reportDesignList = new ArrayList(); + + String path = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue() + + File.separator + fileName; + try + { + String newpath = System.getenv( "DHIS2_HOME" ); + if ( newpath != null ) + { + path = newpath + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue() + File.separator + fileName; + } + } + catch ( NullPointerException npe ) + { + System.out.println("DHIS2_HOME not set"); + } + + try + { + DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); + Document doc = docBuilder.parse( new File( path ) ); + if ( doc == null ) + { + System.out.println( "There is no DECodes related XML file in the ra folder" ); + return null; + } + + NodeList listOfDECodes = doc.getElementsByTagName( "de-code" ); + int totalDEcodes = listOfDECodes.getLength(); + + for ( int s = 0; s < totalDEcodes; s++ ) + { + Element deCodeElement = (Element) listOfDECodes.item( s ); + NodeList textDECodeList = deCodeElement.getChildNodes(); + + String expression = ((Node) textDECodeList.item( 0 )).getNodeValue().trim(); + String stype = deCodeElement.getAttribute( "stype" ); + String ptype = deCodeElement.getAttribute( "type" ); + int sheetno = new Integer( deCodeElement.getAttribute( "sheetno" ) ); + int rowno = new Integer( deCodeElement.getAttribute( "rowno" ) ); + int colno = new Integer( deCodeElement.getAttribute( "colno" ) ); + int rowMerge = new Integer( deCodeElement.getAttribute( "rowmerge" ) ); + int colMerge = new Integer( deCodeElement.getAttribute( "colmerge" ) ); + + Report_inDesign report_inDesign = new Report_inDesign( stype, ptype, sheetno, rowno, colno, rowMerge, colMerge, expression ); + reportDesignList.add( report_inDesign ); + }// end of for loop with s var + }// try block end + catch ( SAXParseException err ) + { + System.out.println( "** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId() ); + System.out.println( " " + err.getMessage() ); + } + catch ( SAXException e ) + { + Exception x = e.getException(); + ((x == null) ? e : x).printStackTrace(); + } + catch ( Throwable t ) + { + t.printStackTrace(); + } + return reportDesignList; +} + + + // ------------------------------------------------------------------------- // Get Aggregated Result for dataelement expression // -------------------------------------------------------------------------