dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09330
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2443: Removed some dead code, duplicated logic and cleaned up a bit
------------------------------------------------------------
revno: 2443
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-12-29 21:47:28 +0530
message:
Removed some dead code, duplicated logic and cleaned up a bit
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java
dhis-2/dhis-web/dhis-web-portal/india-pom.xml
local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/llaggregation/DefaultLinelistAggMapService.java
local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/mchart/action/MotionChartResultAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/nr/action/GenerateNullReporterResultAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java
local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-dataentry-linelisting/src/main/java/org/hisp/dhis/den/comments/DefaultStandardCommentsManager.java
local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/action/ExcelImportResultAction.java
local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/util/ReportService.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/TwentyPoint/action/GenerateTwentyPointReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/auto/action/GenerateAutoReportAnalyserResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GenerateSelChildGradingReportAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GradingAbstractionResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/orgunitgroupsetreport/action/GenerateOrgunitGroupsetReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ReportService.java
local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java 2010-12-02 22:05:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java 2010-12-29 16:17:28 +0000
@@ -39,6 +39,18 @@
* @author Kristian Nordal
* @version $Id: PeriodService.java 5983 2008-10-17 17:42:44Z larshelg $
*/
+/**
+ * @author storset
+ *
+ */
+/**
+ * @author storset
+ *
+ */
+/**
+ * @author storset
+ *
+ */
public interface PeriodService
{
String ID = PeriodService.class.getName();
@@ -291,6 +303,7 @@
*/
PeriodType getPeriodTypeByName( String name );
+
/**
* Returns a PeriodType represented by the given Class.
*
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java 2010-12-20 12:43:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java 2010-12-29 16:17:28 +0000
@@ -96,6 +96,21 @@
{
return periodTypeMap.get( name );
}
+
+ public static PeriodType getByNameIgnoreCase( String name )
+ {
+ for ( PeriodType periodType : getAvailablePeriodTypes() )
+ {
+ if ( periodType.getName().toLowerCase().trim().equals( name ) )
+ {
+ return periodType;
+ }
+ }
+
+ return null;
+ }
+
+
// -------------------------------------------------------------------------
// Persistable
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2010-12-27 03:17:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2010-12-29 16:17:28 +0000
@@ -38,7 +38,6 @@
/**
* @author Abyot Asalefew
- * @version $Id$
*/
public class Program
implements Serializable
@@ -271,7 +270,7 @@
return null;
}
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings( { "unchecked", "rawtypes" } )
public ValidationCriteria isValid( Patient patient )
{
try
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java 2010-11-29 17:28:55 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java 2010-12-29 16:17:28 +0000
@@ -124,11 +124,6 @@
xmlDataStream = new BufferedInputStream( ZipAnalyzer.getTransformableStream( zipFile ) );
- if ( xmlDataStream == null )
- {
- state.setMessage( "Unknown file type" );
- throw new ImportException( "Unknown file type" );
- }
}
else
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java 2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java 2010-12-29 16:17:28 +0000
@@ -284,7 +284,6 @@
}
// Returns the OrgUnitTree for which Root is the orgUnit
- @SuppressWarnings( "unchecked" )
public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
{
List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
@@ -293,14 +292,11 @@
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
Collections.sort( children, new OrganisationUnitNameComparator() );
- Iterator childIterator = children.iterator();
- OrganisationUnit child;
- while ( childIterator.hasNext() )
+ for ( OrganisationUnit child : children )
{
- child = (OrganisationUnit) childIterator.next();
orgUnitTree.addAll( getChildOrgUnitTree( child ) );
}
return orgUnitTree;
- }// getChildOrgUnitTree end
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-portal/india-pom.xml'
--- dhis-2/dhis-web/dhis-web-portal/india-pom.xml 2010-12-29 07:57:25 +0000
+++ dhis-2/dhis-web/dhis-web-portal/india-pom.xml 2010-12-29 16:17:28 +0000
@@ -36,44 +36,44 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-datadictionary</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-dataset</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-organisationunit</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-user</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-dataadmin</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-settings</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-patient</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
@@ -82,26 +82,26 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-importexport</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-datamart</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-validationrule</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-dataentry</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
@@ -109,14 +109,14 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-reporting</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>-->
<!--
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-dashboard-integration</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
-->
@@ -124,7 +124,7 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-mapping</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
-->
@@ -132,7 +132,7 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-excel-reporting</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
-->
@@ -140,7 +140,7 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-caseentry</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
@@ -156,34 +156,34 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-dashboard</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-reports-national</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-dataentry-national</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-excelimport</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-maintenance-in</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
@@ -192,7 +192,7 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-mobile</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency>
@@ -201,7 +201,7 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-validationrule-local-in</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>war</type>
</dependency> -->
=== modified file 'local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/llaggregation/DefaultLinelistAggMapService.java'
--- local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/llaggregation/DefaultLinelistAggMapService.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/llaggregation/DefaultLinelistAggMapService.java 2010-12-29 16:17:28 +0000
@@ -1,7 +1,6 @@
package org.hisp.dhis.linelisting.llaggregation;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -423,7 +422,7 @@
tableName = group.getShortName();
// tableName="livebirth";
String columnName = "";
- List<LineListElement> listDe = new ArrayList(group.getLineListElements());
+ List<LineListElement> listDe = new ArrayList<LineListElement>(group.getLineListElements());
if( listDe == null || listDe.size() == 0 )
{
throw new Exception("Line listing group does not have any Line listing data element");
=== 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 2010-12-29 12:19:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java 2010-12-29 16:17:28 +0000
@@ -283,11 +283,6 @@
String path = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+ report.getXmlTemplateName();
- if ( path == null )
- {
- System.out.println( "DHIS2_HOME is not set" );
- }
-
try
{
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java 2010-12-29 07:47:36 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/aa/action/GenerateAnnualAnalysisDataAction.java 2010-12-29 16:17:28 +0000
@@ -352,7 +352,7 @@
}
// Period Related Info
- monthlyPeriodType = dashBoardService.getPeriodTypeObject("monthly");
+ monthlyPeriodType = PeriodType.getByNameIgnoreCase( "monthly" );
data1 = getServiceValuesByPeriod();
xAxis_Title = "Month";
@@ -385,13 +385,12 @@
return SUCCESS;
}// execute end
- /*
+ /**
* Returns the values for selected years by month wise for ex:- the months
* are jan,feb,mar and the years are 2006 and 2007 then it returns the
* values for 2006 - jan, feb, mar and 2007 - jan, feb, mar for the selected
* orgunit and selected service
*/
- @SuppressWarnings("unchecked")
public Double[][] getServiceValuesByPeriod()
{
// DecimalFormat decFormat = new DecimalFormat("0.0");
@@ -413,25 +412,26 @@
series2 = new String[annualPeriodsListCB.size()];
categories1 = new String[monthlyPeriodsListCB.size()];
categories2 = new String[monthlyPeriodsListCB.size()];
- Iterator iterator1 = annualPeriodsListCB.iterator();
- while (iterator1.hasNext())
+
+ for ( String tmp : annualPeriodsListCB )
{
+ int tempYear = Integer.parseInt(tmp);
+
List<Double> dataValues = new ArrayList<Double>();
//List<Double> numDataValue = new ArrayList<Double>();
//List<Double> denumDataValue = new ArrayList<Double>();
- int tempYear = Integer.parseInt((String) iterator1.next());
//series1[count1] = "" + tempYear + "-" + (tempYear + 1);
series1[count1] = "" + tempYear;
series2[count1] = " ";
//yseriesList.add("" + tempYear + "-" + (tempYear + 1));
yseriesList.add("" + tempYear );
- Iterator iterator2 = monthlyPeriodsListCB.iterator();
count2 = 0;
- while ( iterator2.hasNext() )
+ for ( String s : monthlyPeriodsListCB )
{
- int tempMonth = Integer.parseInt((String) iterator2.next());
+ int tempMonth = Integer.parseInt(s);
+
p = dashBoardService.getPeriodByMonth(tempMonth, tempYear, monthlyPeriodType);
if (p == null)
{
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.java 2010-12-29 16:17:28 +0000
@@ -115,13 +115,6 @@
this.dataElementService = dataElementService;
}
- private DashBoardService dashBoardService;
-
- public void setDashBoardService( DashBoardService dashBoardService )
- {
- this.dashBoardService = dashBoardService;
- }
-
private AggregationService aggregationService;
public void setAggregationService( AggregationService aggregationService )
@@ -1131,18 +1124,17 @@
{
if ( ougSetCB == null )
{
- childOrgUnitList = new ArrayList<Object>( dashBoardService.getAllChildren( selectedOrgUnit ) );
+ childOrgUnitList = new ArrayList<Object>( selectedOrgUnit.getChildren() );
}
else
{
// childOrgUnitList = new ArrayList<Object>(
// selectedOrgUnitGroup.getMembers() );
- childOrgUnitList = new ArrayList<Object>();
- Iterator<String> orgUnitGroupIte = orgUnitListCB.iterator();
- while ( orgUnitGroupIte.hasNext() )
+
+ for ( String tmp : orgUnitListCB )
{
OrganisationUnitGroup oug = organisationUnitGroupService.getOrganisationUnitGroup( Integer
- .parseInt( (String) orgUnitGroupIte.next() ) );
+ .parseInt( tmp ) );
List<OrganisationUnit> tempOUList = new ArrayList<OrganisationUnit>( oug.getMembers() );
Collections.sort( tempOUList, new OrganisationUnitShortNameComparator() );
childOrgUnitList.addAll( tempOUList );
@@ -1428,8 +1420,7 @@
{
if ( ougSetCB == null )
{
- noOfChildren = dashBoardService.getAllChildren( (OrganisationUnit) childOrgUnit )
- .size();
+ noOfChildren = childOrgUnit.getChildren().size();
}
else
{
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/mchart/action/MotionChartResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/mchart/action/MotionChartResultAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/mchart/action/MotionChartResultAction.java 2010-12-29 16:17:28 +0000
@@ -85,7 +85,7 @@
}
private DataSetService dataSetService;
-
+
public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
@@ -103,56 +103,56 @@
// -------------------------------------------------------------------------
private String xaxisIndicator;
-
+
public void setXaxisIndicator( String xaxisIndicator )
{
this.xaxisIndicator = xaxisIndicator;
}
private String yaxisIndicator;
-
+
public void setYaxisIndicator( String yaxisIndicator )
{
this.yaxisIndicator = yaxisIndicator;
}
private String zaxisDataelements;
-
+
public void setZaxisDataelements( String zaxisDataelements )
{
this.zaxisDataelements = zaxisDataelements;
}
private String ougSetCB;
-
+
public void setOugSetCB( String ougSetCB )
{
this.ougSetCB = ougSetCB;
}
private List<String> orgUnitListCB;
-
+
public void setOrgUnitListCB( List<String> orgUnitListCB )
{
this.orgUnitListCB = orgUnitListCB;
}
private String periodTypeLB;
-
+
public void setPeriodTypeLB( String periodTypeLB )
{
this.periodTypeLB = periodTypeLB;
}
private String facilityLB;
-
+
public void setFacilityLB( String facilityLB )
{
this.facilityLB = facilityLB;
}
private String startDate;
-
+
public void setStartDate( String startDate )
{
this.startDate = startDate;
@@ -164,10 +164,9 @@
{
this.endDate = endDate;
}
-
-
+
private Indicator xAxisInd;
-
+
public Indicator getXAxisInd()
{
return xAxisInd;
@@ -179,21 +178,21 @@
{
return yAxisInd;
}
-
+
private DataElement zaxisDE;
-
+
public DataElement getZaxisDE()
{
return zaxisDE;
}
private List<MotionChart> mcList;
-
+
public List<MotionChart> getMcList()
{
return mcList;
}
-
+
private Date sDate;
private Date eDate;
@@ -201,7 +200,6 @@
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
public String execute()
throws Exception
{
@@ -223,11 +221,10 @@
else
{
orgUnitList = new ArrayList<Object>();
- Iterator orgUnitGroupIte = orgUnitListCB.iterator();
- while ( orgUnitGroupIte.hasNext() )
+ for ( String tmp : orgUnitListCB )
{
OrganisationUnitGroup oug = organisationUnitGroupService.getOrganisationUnitGroup( Integer
- .parseInt( (String) orgUnitGroupIte.next() ) );
+ .parseInt( tmp ) );
List<OrganisationUnit> tempOUList = new ArrayList<OrganisationUnit>( oug.getMembers() );
Collections.sort( tempOUList, new OrganisationUnitShortNameComparator() );
orgUnitList.addAll( tempOUList );
@@ -236,24 +233,17 @@
}
else
{
- if ( ougSetCB == null )
+ for ( String tmp : orgUnitListCB )
{
- Iterator orgUnitIterator = orgUnitListCB.iterator();
- while ( orgUnitIterator.hasNext() )
+ int id = Integer.parseInt( tmp );
+
+ if ( ougSetCB == null )
{
- OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
- .parseInt( (String) orgUnitIterator.next() ) );
- orgUnitList.add( o );
+ orgUnitList.add( organisationUnitService.getOrganisationUnit( id ) );
}
- }
- else
- {
- Iterator orgUnitGroupIte = orgUnitListCB.iterator();
- while ( orgUnitGroupIte.hasNext() )
+ else
{
- OrganisationUnitGroup oug = organisationUnitGroupService.getOrganisationUnitGroup( Integer
- .parseInt( (String) orgUnitGroupIte.next() ) );
- orgUnitList.add( oug );
+ orgUnitList.add( organisationUnitGroupService.getOrganisationUnitGroup( id ) );
}
}
}
@@ -262,7 +252,8 @@
sDate = format.parseDate( startDate );
eDate = format.parseDate( endDate );
PeriodType selPeriodType = periodService.getPeriodTypeByName( periodTypeLB );
- List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( selPeriodType, sDate, eDate ));
+ List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( selPeriodType, sDate,
+ eDate ) );
// Axis Info
xAxisInd = indicatorService.getIndicator( Integer.parseInt( xaxisIndicator ) );
@@ -390,7 +381,7 @@
return SUCCESS;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public PeriodType getDataElementPeriodType( DataElement de )
{
List<DataSet> dataSetList = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
@@ -409,6 +400,4 @@
} // getDataElementPeriodType end
-
-
}
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/nr/action/GenerateNullReporterResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/nr/action/GenerateNullReporterResultAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/nr/action/GenerateNullReporterResultAction.java 2010-12-29 16:17:28 +0000
@@ -600,14 +600,7 @@
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
- if ( children != null )
- {
- ouChildCountMap.put( orgUnit, children.size() );
- }
- else
- {
- ouChildCountMap.put( orgUnit, 0 );
- }
+ ouChildCountMap.put( orgUnit, children.size() );
Collections.sort( children, new OrganisationUnitNameComparator() );
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java 2010-12-29 16:17:28 +0000
@@ -1610,14 +1610,7 @@
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
- if ( children != null )
- {
- ouChildCountMap.put( orgUnit, children.size() );
- }
- else
- {
- ouChildCountMap.put( orgUnit, 0 );
- }
+ ouChildCountMap.put( orgUnit, children.size() );
Collections.sort( children, new OrganisationUnitNameComparator() );
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java 2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java 2010-12-29 16:17:28 +0000
@@ -34,12 +34,11 @@
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.UUID;
+import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
@@ -73,17 +72,14 @@
this.dbConnection = dbConnection;
}
*/
- @SuppressWarnings( "unchecked" )
+
public List<Period> getMonthlyPeriods( Date start, Date end )
{
- List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( start, end ) );
- PeriodType monthlyPeriodType = getPeriodTypeObject( "monthly" );
+ PeriodType monthlyPeriodType = PeriodType.getByNameIgnoreCase( "monthly" );
List<Period> monthlyPeriodList = new ArrayList<Period>();
- Iterator it = periodList.iterator();
- while ( it.hasNext() )
+ for ( Period period : monthlyPeriodList )
{
- Period period = (Period) it.next();
if ( period.getPeriodType().getId() == monthlyPeriodType.getId() )
{
monthlyPeriodList.add( period );
@@ -146,51 +142,6 @@
}
/*
- * Returns the PeriodType Object based on the Period Type Name For ex:- if
- * we pass name as Monthly then it returns the PeriodType Object for Monthly
- * PeriodType If there is no such PeriodType returns null
- */
- @SuppressWarnings( "unchecked" )
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
- break;
- }
- }
- if ( periodType == null )
- {
- System.out.println( "No Such PeriodType" );
- return null;
- }
- return periodType;
- }
-
- /*
- * Returns the child tree of the selected Orgunit
- */
- @SuppressWarnings( "unchecked" )
- public List<OrganisationUnit> getAllChildren( OrganisationUnit selecteOU )
- {
- List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>();
-
- Iterator it = selecteOU.getChildren().iterator();
- while ( it.hasNext() )
- {
- OrganisationUnit orgU = (OrganisationUnit) it.next();
- ouList.add( orgU );
- }
- return ouList;
- }
-
- /*
public String getRootDataPath()
{
// Connection con = (new DBConnection()).openConnection();
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2010-12-29 07:47:36 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2010-12-29 16:17:28 +0000
@@ -175,39 +175,18 @@
<bean id="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateChartDataAction"
class="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateChartDataAction"
scope="prototype">
- <property name="dataElementCategoryService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
- </property>
- <property name="organisationUnitService">
- <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
- </property>
- <property name="periodService">
- <ref bean="org.hisp.dhis.period.PeriodService"/>
- </property>
- <property name="indicatorService">
- <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
- </property>
- <property name="dataElementService">
- <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
- </property>
- <property name="dashBoardService">
- <ref bean="org.hisp.dhis.dataanalyser.util.DashBoardService"/>
- </property>
+ <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService"/>
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService"/>
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService"/>
- <property name="aggregationService">
- <ref bean="org.hisp.dhis.aggregation.AggregationService"/>
- </property>
+ <property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService"/>
<property name="statementManager" ref="statementManager"/>
- <property name="organisationUnitGroupService">
- <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
- </property>
- <property name="dataValueService">
- <ref bean="org.hisp.dhis.datavalue.DataValueService"/>
- </property>
- <property name="caseAggregationConditionService">
- <ref bean="org.hisp.dhis.caseaggregation.CaseAggregationConditionService"/>
- </property>
+ <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+ <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService"/>
+ <property name="caseAggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService"/>
</bean>
<bean id="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateChartAction"
=== modified file 'local/in/dhis-web-dataentry-linelisting/src/main/java/org/hisp/dhis/den/comments/DefaultStandardCommentsManager.java'
--- local/in/dhis-web-dataentry-linelisting/src/main/java/org/hisp/dhis/den/comments/DefaultStandardCommentsManager.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dataentry-linelisting/src/main/java/org/hisp/dhis/den/comments/DefaultStandardCommentsManager.java 2010-12-29 16:17:28 +0000
@@ -76,15 +76,8 @@
throw new StandardCommentsManagerException( "Unsupported encoding", e );
}
- if ( reader != null )
- {
- XStream xStream = new XStream();
- standardComments = (List<String>) xStream.fromXML( reader );
- }
- else
- {
- standardComments = new ArrayList<String>();
- }
+ XStream xStream = new XStream();
+ standardComments = (List<String>) xStream.fromXML( reader );
}
return standardComments;
=== modified file 'local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/action/ExcelImportResultAction.java'
--- local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/action/ExcelImportResultAction.java 2010-09-15 13:23:57 +0000
+++ local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/action/ExcelImportResultAction.java 2010-12-29 16:17:28 +0000
@@ -10,7 +10,6 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
@@ -831,7 +830,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -873,29 +872,6 @@
return newPeriod;
}
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
-
- break;
- }
- }
- if ( periodType == null )
- {
- System.out.println( "No Such PeriodType" );
- return null;
- }
- return periodType;
- }
-
public List<String> getDECodes( String fileName )
{
=== modified file 'local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/util/ReportService.java'
--- local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/util/ReportService.java 2010-07-16 10:26:55 +0000
+++ local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/util/ReportService.java 2010-12-29 16:17:28 +0000
@@ -50,20 +50,20 @@
this.periodService = periodService;
}
- /*private DBConnection dbConnection;
-
- public void setDbConnection( DBConnection dbConnection )
- {
- this.dbConnection = dbConnection;
- }*/
+ /*
+ * private DBConnection dbConnection;
+ *
+ * public void setDbConnection( DBConnection dbConnection ) {
+ * this.dbConnection = dbConnection; }
+ */
private JdbcTemplate jdbcTemplate;
public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
{
this.jdbcTemplate = jdbcTemplate;
- }
-
+ }
+
private DataElementService dataElementService;
public void setDataElementService( DataElementService dataElementService )
@@ -105,9 +105,9 @@
{
this.indicatorService = indicatorService;
}
-
+
private ConfigurationService configurationService;
-
+
public void setConfigurationService( ConfigurationService configurationService )
{
this.configurationService = configurationService;
@@ -120,13 +120,12 @@
public List<Period> getMonthlyPeriods( Date start, Date end )
{
List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( start, end ) );
- PeriodType monthlyPeriodType = getPeriodTypeObject( "monthly" );
+ PeriodType monthlyPeriodType = PeriodType.getByNameIgnoreCase( "monthly" );
List<Period> monthlyPeriodList = new ArrayList<Period>();
- Iterator it = periodList.iterator();
- while ( it.hasNext() )
+
+ for ( Period period : periodList )
{
- Period period = (Period) it.next();
if ( period.getPeriodType().getId() == monthlyPeriodType.getId() )
{
monthlyPeriodList.add( period );
@@ -171,57 +170,15 @@
return newPeriod;
}
- /*
- * Returns the PeriodType Object based on the Period Type Name For ex:- if
- * we pass name as Monthly then it returns the PeriodType Object for Monthly
- * PeriodType If there is no such PeriodType returns null
- */
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
- break;
- }
- }
- if ( periodType == null )
- {
- System.out.println( "No Such PeriodType" );
- return null;
- }
- return periodType;
- }
-
- /*
- * Returns the child tree of the selected Orgunit
- */
- public List<OrganisationUnit> getAllChildren( OrganisationUnit selecteOU )
- {
- List<OrganisationUnit> ouList = new ArrayList<OrganisationUnit>();
- Iterator it = selecteOU.getChildren().iterator();
- while ( it.hasNext() )
- {
- OrganisationUnit orgU = (OrganisationUnit) it.next();
- ouList.add( orgU );
- }
- return ouList;
- }
-
public List<Integer> getLinelistingRecordNos( OrganisationUnit organisationUnit, Period period, String lltype )
{
List<Integer> recordNosList = new ArrayList<Integer>();
- //Connection con = dbConnection.openConnection();
+ // Connection con = dbConnection.openConnection();
Statement st = null;
- //ResultSet rs1 = null;
+ // ResultSet rs1 = null;
String query = "";
@@ -247,12 +204,12 @@
try
{
- //st = con.createStatement();
+ // st = con.createStatement();
query = "SELECT recordno FROM lldatavalue WHERE dataelementid = " + dataElementid + " AND periodid = "
+ period.getId() + " AND sourceid = " + organisationUnit.getId();
- //rs1 = st.executeQuery( query );
-
+ // rs1 = st.executeQuery( query );
+
SqlRowSet rs1 = jdbcTemplate.queryForRowSet( query );
while ( rs1.next() )
@@ -267,64 +224,51 @@
System.out.println( "SQL Exception : " + e.getMessage() );
return null;
}
- /*finally
- {
- try
- {
- SqlRowSet rs1;
-
- if ( st != null )
- st.close();
- if ( rs1 != null )
- rs1.close();
-
- if ( con != null )
- con.close();
- }
- catch ( Exception e )
- {
- System.out.println( "SQL Exception : " + e.getMessage() );
- return null;
- }
- }*/ // finally block end
+ /*
+ * finally { try { SqlRowSet rs1;
+ *
+ * if ( st != null ) st.close(); if ( rs1 != null ) rs1.close();
+ *
+ * if ( con != null ) con.close(); } catch ( Exception e ) {
+ * System.out.println( "SQL Exception : " + e.getMessage() ); return
+ * null; } }
+ */// finally block end
return recordNosList;
}
public String getRAFolderName()
{
- //Connection con = dbConnection.openConnection();
-
- //Statement st = null;
-
- //ResultSet rs1 = null;
+ // Connection con = dbConnection.openConnection();
+
+ // Statement st = null;
+
+ // ResultSet rs1 = null;
String raFolderName = "ra_national";
try
{
- //st = con.createStatement();
-
- /* query = "SELECT mvalue FROM maintenancein WHERE mkey LIKE '" + KEY_RAFOLDER + "'";
- //rs1 = st.executeQuery( query );
-
- SqlRowSet rs1 = jdbcTemplate.queryForRowSet( query );
-
- if ( rs1.next() )
- {
- raFolderName = rs1.getString( 1 );
- }*/
-
- raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue();
+ // st = con.createStatement();
+
+ /*
+ * query = "SELECT mvalue FROM maintenancein WHERE mkey LIKE '" +
+ * KEY_RAFOLDER + "'"; //rs1 = st.executeQuery( query );
+ *
+ * SqlRowSet rs1 = jdbcTemplate.queryForRowSet( query );
+ *
+ * if ( rs1.next() ) { raFolderName = rs1.getString( 1 ); }
+ */
+
+ raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue();
}
catch ( Exception e )
{
System.out.println( "Exception : " + e.getMessage() );
return null;
- }
-
-
+ }
+
return raFolderName;
}
@@ -373,8 +317,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
@@ -533,8 +477,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
@@ -711,8 +655,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/TwentyPoint/action/GenerateTwentyPointReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/TwentyPoint/action/GenerateTwentyPointReportsResultAction.java 2010-07-13 09:28:43 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/TwentyPoint/action/GenerateTwentyPointReportsResultAction.java 2010-12-29 16:17:28 +0000
@@ -1039,7 +1039,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = reportService.getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = reportService.getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ),
periodType );
@@ -1060,7 +1060,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = reportService.getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = reportService.getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ),
periodType );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java 2010-10-21 07:23:13 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java 2010-12-29 16:17:28 +0000
@@ -1,7 +1,32 @@
package org.hisp.dhis.reports.activeplan.action;
-//@23-06-2010 - Date from and to is solved.
-//Todo merging of cells for same village
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -13,6 +38,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -27,6 +53,8 @@
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.VerticalAlignment;
+import jxl.write.Label;
+import jxl.write.WritableCell;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
@@ -34,6 +62,7 @@
import org.amplecode.quick.StatementManager;
import org.apache.velocity.tools.generic.MathTool;
import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.i18n.I18nFormat;
@@ -43,9 +72,14 @@
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifier;
import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
@@ -55,10 +89,13 @@
import org.hisp.dhis.program.ProgramInstanceService;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.program.ProgramStageService;
-import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.relationship.Relationship;
+import org.hisp.dhis.relationship.RelationshipService;
+import org.hisp.dhis.relationship.RelationshipTypeService;
import org.hisp.dhis.reports.ReportService;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -68,25 +105,16 @@
import org.xml.sax.SAXParseException;
import com.opensymphony.xwork2.Action;
-import java.util.HashSet;
-import jxl.write.Label;
-import jxl.write.WritableCell;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.patient.PatientIdentifier;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.patient.PatientIdentifierTypeService;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.relationship.Relationship;
-import org.hisp.dhis.relationship.RelationshipService;
-import org.hisp.dhis.relationship.RelationshipTypeService;
+/**
+ * @23-06-2010 - Date from and to is solved.
+ * TODO: merging of cells for same village
+ *
+ */
public class ActivePlanReportsResultAction
implements Action
{
- private static final String NULL_REPLACEMENT = "0";
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -681,7 +709,7 @@
Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
Collection<ProgramStageInstance> completedProgramStageInstances = new ArrayList<ProgramStageInstance>();
- Iterator itr1 = programStagesList.iterator();
+ Iterator<ProgramStage> itr1 = programStagesList.iterator();
while ( itr1.hasNext() )
{
ProgramStage PSName = (ProgramStage) itr1.next();
@@ -1238,7 +1266,7 @@
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -1259,7 +1287,7 @@
tempDate.roll( Calendar.MONTH, +1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -1295,36 +1323,8 @@
}
Date lastDay = new Date( cal.getTimeInMillis() );
- // System.out.println( lastDay.toString() );
- Period newPeriod = new Period();
- newPeriod = periodService.getPeriod( firstDay, lastDay, periodType );
- return newPeriod;
- }
-
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
-
- break;
-
- }
-
- }
- if ( periodType == null )
- {
- System.out.println( "No Such PeriodType" );
- return null;
- }
-
- return periodType;
+
+ return periodService.getPeriod( firstDay, lastDay, periodType );
}
public List<Calendar> getStartingEndingPeriods( String deType, Date sDate, Date eDate )
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/auto/action/GenerateAutoReportAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/auto/action/GenerateAutoReportAnalyserResultAction.java 2010-07-13 09:28:43 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/auto/action/GenerateAutoReportAnalyserResultAction.java 2010-12-29 16:17:28 +0000
@@ -31,7 +31,6 @@
* @version $Id$
*/
-
import java.io.File;
import java.io.InputStream;
import java.text.SimpleDateFormat;
@@ -93,12 +92,12 @@
import com.opensymphony.xwork2.ActionSupport;
-
/**
* @author Brajesh Murari
* @version $Id$
*/
-public class GenerateAutoReportAnalyserResultAction extends ActionSupport
+public class GenerateAutoReportAnalyserResultAction
+ extends ActionSupport
{
private static final String NULL_REPLACEMENT = "0";
@@ -190,7 +189,7 @@
// -------------------------------------------------------------------------
// Properties
// -------------------------------------------------------------------------
-
+
private InputStream inputStream;
public InputStream getInputStream()
@@ -199,13 +198,10 @@
}
/*
- private String contentType;
-
- public String getContentType()
- {
- return contentType;
- }
- */
+ * private String contentType;
+ *
+ * public String getContentType() { return contentType; }
+ */
private String fileName;
@@ -215,13 +211,10 @@
}
/*
- private int bufferSize;
-
- public int getBufferSize()
- {
- return bufferSize;
- }
- */
+ * private int bufferSize;
+ *
+ * public int getBufferSize() { return bufferSize; }
+ */
private MathTool mathTool;
@@ -357,7 +350,7 @@
{
return availablePeriods;
}
-
+
private String aggCB;
public void setAggCB( String aggCB )
@@ -385,12 +378,12 @@
{
return periodType;
}
-
+
private String periodTypeId;
- public void setPeriodTypeId(String periodTypeId)
+ public void setPeriodTypeId( String periodTypeId )
{
- this.periodTypeId=periodTypeId;
+ this.periodTypeId = periodTypeId;
}
private int Id;
@@ -399,7 +392,7 @@
{
return Id;
}
-
+
private List<Period> periods;
public List<Period> getPeriods()
@@ -415,21 +408,21 @@
{
return childOrgUnits;
}
-
+
private List<String> periodNameList;
-
- public List<String> getPeriodNameList()
+
+ public List<String> getPeriodNameList()
{
- return periodNameList;
+ return periodNameList;
}
-
+
private String statusMessage;
-
+
public String getStatusMessage()
{
return statusMessage;
}
-
+
public void setStatusMessage( String statusMessage )
{
this.statusMessage = statusMessage;
@@ -460,16 +453,15 @@
yearFormat = new SimpleDateFormat( "yyyy" );
simpleYearFormat = new SimpleDateFormat( "yy" );
deCodesXMLFileName = reportList + "DECodes.xml";
-
- System.out.println("Report Generation Start Time is : \t" + new Date());
- statusMessage = "Report Generation is Started.";
+
+ System.out.println( "Report Generation Start Time is : \t" + new Date() );
+ statusMessage = "Report Generation is Started.";
String parentUnit = "";
sheetList = new ArrayList<Integer>();
rowList = new ArrayList<Integer>();
colList = new ArrayList<Integer>();
-
if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
{
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
@@ -481,7 +473,7 @@
{
orgUnitList = new ArrayList<OrganisationUnit>();
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+ orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
parentUnit = orgUnit.getName();
}
@@ -497,23 +489,23 @@
if ( reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" ) )
{
orgUnitList = new ArrayList<OrganisationUnit>();
- OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
- parentUnit = orgUnit.getName();
+ OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+ orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+ parentUnit = orgUnit.getName();
}
if ( reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
{
orgUnitList = new ArrayList<OrganisationUnit>();
- OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+ OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+ orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
parentUnit = orgUnit.getName();
}
if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
{
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- //OrganisationUnit parent = orgUnit.getParent();
+ // OrganisationUnit parent = orgUnit.getParent();
orgUnitList = new ArrayList<OrganisationUnit>();
Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
orgUnitList.add( orgUnit );
@@ -540,7 +532,7 @@
// Getting DataValues
dataValueList = new ArrayList<String>();
List<String> deCodesList = getDECodes( deCodesXMLFileName );
-
+
int orgUnitCount = 0;
int orgUnitGroupCount = 0;
int rowCounter = 0;
@@ -567,1087 +559,1090 @@
// ---------------------------------------------------------------------------------------------------
// All other reports START
// ---------------------------------------------------------------------------------------------------
-
+
String inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
- + "template" + File.separator + reportFileNameTB;
-
+ + "template" + File.separator + reportFileNameTB;
+
Iterator<OrganisationUnit> it = orgUnitList.iterator();
-
+
while ( it.hasNext() && children != 0 )
{
simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
PeriodType periodType = periodService.getPeriodTypeByName( periodTypeId );
- Collection <Period> reportingPeriod = new ArrayList <Period>();
- reportingPeriod = periodService.getPeriodsBetweenDates(periodType, format.parseDate( startDate ), format.parseDate( endDate ) );
-
+ Collection<Period> reportingPeriod = new ArrayList<Period>();
+ reportingPeriod = periodService.getPeriodsBetweenDates( periodType, format.parseDate( startDate ),
+ format.parseDate( endDate ) );
+
Iterator<Period> itr = reportingPeriod.iterator();
-
+
OrganisationUnit currentOrgUnit = it.next();
-
+
while ( itr.hasNext() )
{
- Period dateItrVal = itr.next();
- sDate = dateItrVal.getStartDate();
- eDate = dateItrVal.getEndDate();
-
- fileName = reportFileNameTB.replace( ".xls", "" );
- fileName += "_" + currentOrgUnit.getShortName() + "_";
-
- fileName += "_" + simpleDateFormat.format( sDate ) + "_";
- fileName += "_" + simpleDateFormat.format( eDate ) + ".xls";
-
- String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
- + "output" + File.separator + fileName;
-
- Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
-
- WritableWorkbook outputReportWorkbook = Workbook
- .createWorkbook( new File( outputReportPath ), templateWorkbook );
-
- int quarterPeriod = 0;
-
- //OrganisationUnit currentOrgUnit = it.next();
-
- Iterator<String> it1 = deCodesList.iterator();
- int count1 = 0;
- while ( it1.hasNext() )
- {
- String deCodeString = it1.next();
-
- String deType = deCodeType.get( count1 );
- String sType = serviceType.get( count1 );
-
- String tempStr = "";
-
- Calendar tempStartDate = Calendar.getInstance();
- Calendar tempEndDate = Calendar.getInstance();
- List<Calendar> calendarList = new ArrayList<Calendar>( getStartingEndingPeriods( deType ) );
- if ( calendarList == null || calendarList.isEmpty() )
- {
- tempStartDate.setTime( sDate );
- tempEndDate.setTime( eDate );
- return SUCCESS;
- }
- else
- {
- tempStartDate = calendarList.get( 0 );
- tempEndDate = calendarList.get( 1 );
- }
-
- if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
- {
- tempStr = currentOrgUnit.getName();
-
- }
- else if ( deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
- {
- tempStr = parentUnit;
- }
- else if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
- tempStr = currentOrgUnit.getParent().getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- tempStr = orgUnitP.getParent().getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- orgUnitPP = orgUnitP.getParent();
-
- tempStr = orgUnitPP.getParent().getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
- OrganisationUnit orgUnitP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPP = new OrganisationUnit();
-
- OrganisationUnit orgUnitPPP = new OrganisationUnit();
-
- orgUnitP = currentOrgUnit.getParent();
-
- orgUnitPP = orgUnitP.getParent();
-
- orgUnitPPP = orgUnitPP.getParent();
-
- tempStr = orgUnitPPP.getParent().getName();
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) )
- {
- tempStr = simpleDateFormat.format( sDate );
-
- }
- else if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
- {
- tempStr = monthFormat.format( sDate );
-
- }
- else if ( deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" ) )
- {
- tempStr = simpleMonthFormat.format( sDate );
-
- }
- else if ( deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" ) )
- {
- tempStr = simpleMonthFormat.format( eDate );
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "MONTH-START" ) )
- {
- tempStr = monthFormat.format( sDate );
-
- }
- else if ( deCodeString.equalsIgnoreCase( "MONTH-END" ) )
- {
- tempStr = monthFormat.format( eDate );
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD-WEEK" ) )
- {
- tempStr = String.valueOf( tempStartDate.get( Calendar.WEEK_OF_MONTH ) );
-
- }
- else if ( deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" ) )
- {
- String startMonth = "";
-
- startMonth = monthFormat.format( sDate );
-
- if ( startMonth.equalsIgnoreCase( "April" ) )
- {
- tempStr = "Quarter I";
- }
-
- else if ( startMonth.equalsIgnoreCase( "July" ) )
- {
- tempStr = "Quarter II";
- }
- else if ( startMonth.equalsIgnoreCase( "October" ) )
- {
- tempStr = "Quarter III";
- }
-
- else
- {
- tempStr = "Quarter IV";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" ) )
- {
- String startMonth = "";
-
- startMonth = monthFormat.format( sDate );
-
- if ( startMonth.equalsIgnoreCase( "April" ) )
- {
- tempStr = "Q1";
- }
-
- else if ( startMonth.equalsIgnoreCase( "July" ) )
- {
- tempStr = "Q2";
- }
- else if ( startMonth.equalsIgnoreCase( "October" ) )
- {
- tempStr = "Q3";
- }
-
- else
- {
- tempStr = "Q4";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" ) )
- {
- String startMonth = "";
-
- startMonth = monthFormat.format( sDate );
-
- if ( startMonth.equalsIgnoreCase( "April" ) )
- {
- tempStr = "Apr - Jun";
- }
-
- else if ( startMonth.equalsIgnoreCase( "July" ) )
- {
- tempStr = "Jul - Sep";
- }
- else if ( startMonth.equalsIgnoreCase( "October" ) )
- {
- tempStr = "Oct - Dec";
- }
-
- else
- {
- tempStr = "Jan - Mar";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" ) )
- {
- String startMonth = "";
-
- startMonth = monthFormat.format( sDate );
-
- if ( startMonth.equalsIgnoreCase( "April" ) )
- {
- tempStr = "April - June";
- }
-
- else if ( startMonth.equalsIgnoreCase( "July" ) )
- {
- tempStr = "July - September";
- }
- else if ( startMonth.equalsIgnoreCase( "October" ) )
- {
- tempStr = "October - December";
- }
-
- else
- {
- tempStr = "January - March";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" ) )
- {
- String startMonth = "";
-
- startMonth = monthFormat.format( sDate );
-
- if ( startMonth.equalsIgnoreCase( "April" ) )
- {
- tempStr = "Apr";
- }
-
- else if ( startMonth.equalsIgnoreCase( "July" ) )
- {
- tempStr = "Jul";
- }
- else if ( startMonth.equalsIgnoreCase( "October" ) )
- {
- tempStr = "Oct";
- }
-
- else
- {
- tempStr = "Jan";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "QUARTER-START" ) )
- {
- String startMonth = "";
-
- startMonth = monthFormat.format( sDate );
-
- if ( startMonth.equalsIgnoreCase( "April" ) )
- {
- tempStr = "April";
- }
-
- else if ( startMonth.equalsIgnoreCase( "July" ) )
- {
- tempStr = "July";
- }
- else if ( startMonth.equalsIgnoreCase( "October" ) )
- {
- tempStr = "October";
- }
-
- else
- {
- tempStr = "January";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" ) )
- {
- String endMonth = "";
-
- endMonth = monthFormat.format( eDate );
-
- if ( endMonth.equalsIgnoreCase( "June" ) )
- {
- tempStr = "Jun";
- }
-
- else if ( endMonth.equalsIgnoreCase( "September" ) )
- {
- tempStr = "Sep";
- }
- else if ( endMonth.equalsIgnoreCase( "December" ) )
- {
- tempStr = "Dec";
- }
-
- else
- {
- tempStr = "Mar";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "QUARTER-END" ) )
- {
- String endMonth = "";
-
- endMonth = monthFormat.format( eDate );
-
- if ( endMonth.equalsIgnoreCase( "June" ) )
- {
- tempStr = "June";
- }
-
- else if ( endMonth.equalsIgnoreCase( "September" ) )
- {
- tempStr = "September";
- }
- else if ( endMonth.equalsIgnoreCase( "December" ) )
- {
- tempStr = "December";
- }
-
- else
- {
- tempStr = "March";
-
- quarterPeriod = 1;
-
- }
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD-YEAR" ) )
- {
- sDateTemp = sDate;
-
- Calendar tempQuarterYear = Calendar.getInstance();
-
- tempQuarterYear.setTime( sDateTemp );
-
- String startMonth = "";
-
- startMonth = monthFormat.format( sDateTemp );
-
- //periodType = periodService.getPeriodType(periodTypeIdTB);
-
- if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
- {
- sDateTemp = sDate;
- }
-
- else
- {
- if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
- .equalsIgnoreCase( "March" ))
- && periodType.getName().equalsIgnoreCase( "Quarterly" ) )
- {
- tempQuarterYear.roll( Calendar.YEAR, -1 );
-
- sDateTemp = tempQuarterYear.getTime();
-
- }
- }
-
- tempStr = yearFormat.format( sDateTemp );
- }
-
- else if ( deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" ) )
- {
- sDateTemp = sDate;
-
- Calendar tempQuarterYear = Calendar.getInstance();
-
- tempQuarterYear.setTime( sDateTemp );
-
- String startMonth = "";
-
- startMonth = monthFormat.format( sDateTemp );
-
- // periodType = periodService.getPeriodType(periodTypeIdTB);
-
- if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
- {
- sDateTemp = sDate;
- }
-
- else
- {
- if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
- .equalsIgnoreCase( "March" ))
- && periodType.getName().equalsIgnoreCase( "Quarterly" ) )
- {
- tempQuarterYear.roll( Calendar.YEAR, -1 );
-
- sDateTemp = tempQuarterYear.getTime();
-
- }
- }
-
- tempStr = simpleYearFormat.format( sDateTemp );
- }
-
- else if ( deCodeString.equalsIgnoreCase( "YEAR-END" ) )
- {
-
- sDateTemp = sDate;
-
- Calendar tempQuarterYear = Calendar.getInstance();
-
- tempQuarterYear.setTime( sDate );
-
- sDate = tempQuarterYear.getTime();
-
- String startMonth = "";
-
- startMonth = monthFormat.format( sDateTemp );
-
- // periodType = periodService.getPeriodType(periodTypeIdTB);
-
- if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
- {
- tempQuarterYear.roll( Calendar.YEAR, 1 );
-
- sDateTemp = tempQuarterYear.getTime();
-
- }
-
- if ( !(startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
- .equalsIgnoreCase( "March" )) )
- {
- tempQuarterYear.roll( Calendar.YEAR, 1 );
-
- sDateTemp = tempQuarterYear.getTime();
-
- }
-
- tempStr = yearFormat.format( sDateTemp );
- }
-
- else if ( deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- sDateTemp = sDate;
-
- eDateTemp = eDate;
-
- Calendar tempQuarterYear = Calendar.getInstance();
-
- String startYear = "";
-
- String endYear = "";
-
- String startMonth = "";
-
- startMonth = monthFormat.format( sDateTemp );
-
- // periodType = periodService.getPeriodType(periodTypeIdTB);
-
- tempQuarterYear.setTime( sDateTemp );
-
- if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
- {
- sDateTemp = sDate;
- }
-
- else
- {
- if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
- .equalsIgnoreCase( "March" )) )
- {
- tempQuarterYear.roll( Calendar.YEAR, -1 );
-
- sDateTemp = tempQuarterYear.getTime();
-
- }
- }
-
- startYear = yearFormat.format( sDateTemp );
-
- tempQuarterYear.setTime( eDateTemp );
-
- if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
- {
- tempQuarterYear.roll( Calendar.YEAR, 1 );
-
- eDateTemp = tempQuarterYear.getTime();
- }
-
- if ( !(startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
- .equalsIgnoreCase( "March" )) )
- {
- tempQuarterYear.roll( Calendar.YEAR, 1 );
-
- eDateTemp = tempQuarterYear.getTime();
-
- }
- endYear = yearFormat.format( eDateTemp );
-
- tempStr = startYear + " - " + endYear;
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "SLNO" ) )
- {
- tempStr = "" + (orgUnitCount + 1);
- }
- else if ( deCodeString.equalsIgnoreCase( "NA" ) )
- {
- tempStr = " ";
- }
- else
- {
- rowCounter += 1;
-
- if ( sType.equalsIgnoreCase( "dataelement" ) )
- {
- if ( aggCB == null )
- {
- tempStr = getIndividualResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate
- .getTime(), currentOrgUnit );
- }
- else
- {
- tempStr = getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(),
- currentOrgUnit );
- }
- }
- else if ( sType.equalsIgnoreCase( "indicator-parent" ) )
- {
- if ( aggCB == null )
- {
- tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit.getParent() );
- }
- else
- {
- tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate
- .getTime(), currentOrgUnit.getParent() );
- }
- }
- else if ( sType.equalsIgnoreCase( "dataelement-boolean" ) )
- {
- if ( aggCB == null )
- {
- tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit );
- }
- else
- {
- tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit );
- }
- }
- else
- {
- if ( aggCB == null )
- {
- tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(),
- tempEndDate.getTime(), currentOrgUnit );
- }
- else
- {
- tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate
- .getTime(), currentOrgUnit );
- }
- }
- }
- int tempRowNo = rowList.get( count1 );
- int tempColNo = colList.get( count1 );
- int sheetNo = sheetList.get( count1 ) + orgUnitGroupCount;
- WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
- if ( tempStr == null || tempStr.equals( " " ) )
- {
- tempColNo += orgUnitCount;
-
- WritableCellFormat wCellformat = new WritableCellFormat();
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setWrap( true );
- wCellformat.setAlignment( Alignment.CENTRE );
-
- sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
- }
- else
- {
-
- if ( reportModelTB.equalsIgnoreCase( "STATIC" ) )
- {
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
- else
- {
- // tempColNo +=
- // orgUnitCount;
- }
-
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
- CellFormat cellFormat = cell.getCellFormat();
- WritableCellFormat wCellformat = new WritableCellFormat();
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setWrap( true );
- wCellformat.setAlignment( Alignment.CENTRE );
-
- if ( cell.getType() == CellType.LABEL )
- {
- Label l = (Label) cell;
- l.setString( tempStr );
- l.setCellFormat( cellFormat );
- }
- else
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
-
- if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
- {
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" )
- || deCodeString.equalsIgnoreCase( "FACILITYPP" )
- || deCodeString.equalsIgnoreCase( "FACILITYPPP" )
- || deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
-
- else
- {
- tempColNo += orgUnitCount;
- }
-
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
- CellFormat cellFormat = cell.getCellFormat();
- WritableCellFormat wCellformat = new WritableCellFormat();
-
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setAlignment( Alignment.CENTRE );
- wCellformat.setWrap( true );
-
- if ( cell.getType() == CellType.LABEL )
- {
- Label l = (Label) cell;
- l.setString( tempStr );
- l.setCellFormat( cellFormat );
- }
- else
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
-
- if ( reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" )
- || reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
- {
- if ( deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "FACILITY" ) )
- {
-
- }
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
-
- }
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
-
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
- CellFormat cellFormat = cell.getCellFormat();
- WritableCellFormat wCellformat = new WritableCellFormat();
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setWrap( true );
- wCellformat.setAlignment( Alignment.CENTRE );
-
- if ( cell.getType() == CellType.LABEL )
- {
- Label l = (Label) cell;
- l.setString( tempStr );
- l.setCellFormat( cellFormat );
- }
- else
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
-
- if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
- {
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
- else
- {
- // tempColNo +=
- // (orgUnitCount * 2);
- }
-
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
- CellFormat cellFormat = cell.getCellFormat();
- WritableCellFormat wCellformat = new WritableCellFormat();
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setAlignment( Alignment.CENTRE );
-
- if ( cell.getType() == CellType.LABEL )
- {
- Label l = (Label) cell;
- l.setString( tempStr );
- l.setCellFormat( cellFormat );
- }
- else
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
-
- if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-SIBLINGS" )
- || reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" ) )
- {
-
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
- else
- {
- tempColNo += orgUnitCount;
- }
-
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
- CellFormat cellFormat = cell.getCellFormat();
- WritableCellFormat wCellformat = new WritableCellFormat();
-
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setWrap( true );
- wCellformat.setAlignment( Alignment.CENTRE );
- wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
-
- if ( cell.getType() == CellType.LABEL )
- {
- Label l = (Label) cell;
- l.setString( tempStr );
- l.setCellFormat( cellFormat );
- }
- else
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
- if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
- {
- if ( deCodeString.equalsIgnoreCase( "FACILITYP" )
- || deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
- {
-
- }
-
- else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
- || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
- || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
- || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
- || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
- || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
- || deCodeString.equalsIgnoreCase( "MONTH-START" )
- || deCodeString.equalsIgnoreCase( "MONTH-END" )
- || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
- || deCodeString.equalsIgnoreCase( "QUARTER-START" )
- || deCodeString.equalsIgnoreCase( "QUARTER-END" )
- || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
- || deCodeString.equalsIgnoreCase( "YEAR-END" )
- || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
- {
-
- }
- else
- {
- tempRowNo += orgUnitCount;
- }
-
- WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
- CellFormat cellFormat = cell.getCellFormat();
- WritableCellFormat wCellformat = new WritableCellFormat();
-
- wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
- wCellformat.setWrap( true );
- wCellformat.setAlignment( Alignment.CENTRE );
- wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
-
- if ( cell.getType() == CellType.LABEL )
- {
- Label l = (Label) cell;
- l.setString( tempStr );
- l.setCellFormat( cellFormat );
- }
- else
- {
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
- }
- }
- }
- count1++;
- }// inner while loop end
-
- outputReportWorkbook.write();
- outputReportWorkbook.close();
-
- }//intermediate while loop end
+ Period dateItrVal = itr.next();
+ sDate = dateItrVal.getStartDate();
+ eDate = dateItrVal.getEndDate();
+
+ fileName = reportFileNameTB.replace( ".xls", "" );
+ fileName += "_" + currentOrgUnit.getShortName() + "_";
+
+ fileName += "_" + simpleDateFormat.format( sDate ) + "_";
+ fileName += "_" + simpleDateFormat.format( eDate ) + ".xls";
+
+ String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName
+ + File.separator + "output" + File.separator + fileName;
+
+ Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
+
+ WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ),
+ templateWorkbook );
+
+ int quarterPeriod = 0;
+
+ // OrganisationUnit currentOrgUnit = it.next();
+
+ Iterator<String> it1 = deCodesList.iterator();
+ int count1 = 0;
+ while ( it1.hasNext() )
+ {
+ String deCodeString = it1.next();
+
+ String deType = deCodeType.get( count1 );
+ String sType = serviceType.get( count1 );
+
+ String tempStr = "";
+
+ Calendar tempStartDate = Calendar.getInstance();
+ Calendar tempEndDate = Calendar.getInstance();
+ List<Calendar> calendarList = new ArrayList<Calendar>( getStartingEndingPeriods( deType ) );
+ if ( calendarList == null || calendarList.isEmpty() )
+ {
+ tempStartDate.setTime( sDate );
+ tempEndDate.setTime( eDate );
+ return SUCCESS;
+ }
+ else
+ {
+ tempStartDate = calendarList.get( 0 );
+ tempEndDate = calendarList.get( 1 );
+ }
+
+ if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
+ {
+ tempStr = currentOrgUnit.getName();
+
+ }
+ else if ( deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
+ {
+ tempStr = parentUnit;
+ }
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+ {
+ tempStr = currentOrgUnit.getParent().getName();
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+ OrganisationUnit orgUnitP = new OrganisationUnit();
+
+ orgUnitP = currentOrgUnit.getParent();
+
+ tempStr = orgUnitP.getParent().getName();
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+ {
+ OrganisationUnit orgUnitP = new OrganisationUnit();
+
+ OrganisationUnit orgUnitPP = new OrganisationUnit();
+
+ orgUnitP = currentOrgUnit.getParent();
+
+ orgUnitPP = orgUnitP.getParent();
+
+ tempStr = orgUnitPP.getParent().getName();
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+ OrganisationUnit orgUnitP = new OrganisationUnit();
+
+ OrganisationUnit orgUnitPP = new OrganisationUnit();
+
+ OrganisationUnit orgUnitPPP = new OrganisationUnit();
+
+ orgUnitP = currentOrgUnit.getParent();
+
+ orgUnitPP = orgUnitP.getParent();
+
+ orgUnitPPP = orgUnitPP.getParent();
+
+ tempStr = orgUnitPPP.getParent().getName();
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) )
+ {
+ tempStr = simpleDateFormat.format( sDate );
+
+ }
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
+ {
+ tempStr = monthFormat.format( sDate );
+
+ }
+ else if ( deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" ) )
+ {
+ tempStr = simpleMonthFormat.format( sDate );
+
+ }
+ else if ( deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" ) )
+ {
+ tempStr = simpleMonthFormat.format( eDate );
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "MONTH-START" ) )
+ {
+ tempStr = monthFormat.format( sDate );
+
+ }
+ else if ( deCodeString.equalsIgnoreCase( "MONTH-END" ) )
+ {
+ tempStr = monthFormat.format( eDate );
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD-WEEK" ) )
+ {
+ tempStr = String.valueOf( tempStartDate.get( Calendar.WEEK_OF_MONTH ) );
+
+ }
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" ) )
+ {
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDate );
+
+ if ( startMonth.equalsIgnoreCase( "April" ) )
+ {
+ tempStr = "Quarter I";
+ }
+
+ else if ( startMonth.equalsIgnoreCase( "July" ) )
+ {
+ tempStr = "Quarter II";
+ }
+ else if ( startMonth.equalsIgnoreCase( "October" ) )
+ {
+ tempStr = "Quarter III";
+ }
+
+ else
+ {
+ tempStr = "Quarter IV";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" ) )
+ {
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDate );
+
+ if ( startMonth.equalsIgnoreCase( "April" ) )
+ {
+ tempStr = "Q1";
+ }
+
+ else if ( startMonth.equalsIgnoreCase( "July" ) )
+ {
+ tempStr = "Q2";
+ }
+ else if ( startMonth.equalsIgnoreCase( "October" ) )
+ {
+ tempStr = "Q3";
+ }
+
+ else
+ {
+ tempStr = "Q4";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" ) )
+ {
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDate );
+
+ if ( startMonth.equalsIgnoreCase( "April" ) )
+ {
+ tempStr = "Apr - Jun";
+ }
+
+ else if ( startMonth.equalsIgnoreCase( "July" ) )
+ {
+ tempStr = "Jul - Sep";
+ }
+ else if ( startMonth.equalsIgnoreCase( "October" ) )
+ {
+ tempStr = "Oct - Dec";
+ }
+
+ else
+ {
+ tempStr = "Jan - Mar";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" ) )
+ {
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDate );
+
+ if ( startMonth.equalsIgnoreCase( "April" ) )
+ {
+ tempStr = "April - June";
+ }
+
+ else if ( startMonth.equalsIgnoreCase( "July" ) )
+ {
+ tempStr = "July - September";
+ }
+ else if ( startMonth.equalsIgnoreCase( "October" ) )
+ {
+ tempStr = "October - December";
+ }
+
+ else
+ {
+ tempStr = "January - March";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" ) )
+ {
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDate );
+
+ if ( startMonth.equalsIgnoreCase( "April" ) )
+ {
+ tempStr = "Apr";
+ }
+
+ else if ( startMonth.equalsIgnoreCase( "July" ) )
+ {
+ tempStr = "Jul";
+ }
+ else if ( startMonth.equalsIgnoreCase( "October" ) )
+ {
+ tempStr = "Oct";
+ }
+
+ else
+ {
+ tempStr = "Jan";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "QUARTER-START" ) )
+ {
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDate );
+
+ if ( startMonth.equalsIgnoreCase( "April" ) )
+ {
+ tempStr = "April";
+ }
+
+ else if ( startMonth.equalsIgnoreCase( "July" ) )
+ {
+ tempStr = "July";
+ }
+ else if ( startMonth.equalsIgnoreCase( "October" ) )
+ {
+ tempStr = "October";
+ }
+
+ else
+ {
+ tempStr = "January";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" ) )
+ {
+ String endMonth = "";
+
+ endMonth = monthFormat.format( eDate );
+
+ if ( endMonth.equalsIgnoreCase( "June" ) )
+ {
+ tempStr = "Jun";
+ }
+
+ else if ( endMonth.equalsIgnoreCase( "September" ) )
+ {
+ tempStr = "Sep";
+ }
+ else if ( endMonth.equalsIgnoreCase( "December" ) )
+ {
+ tempStr = "Dec";
+ }
+
+ else
+ {
+ tempStr = "Mar";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "QUARTER-END" ) )
+ {
+ String endMonth = "";
+
+ endMonth = monthFormat.format( eDate );
+
+ if ( endMonth.equalsIgnoreCase( "June" ) )
+ {
+ tempStr = "June";
+ }
+
+ else if ( endMonth.equalsIgnoreCase( "September" ) )
+ {
+ tempStr = "September";
+ }
+ else if ( endMonth.equalsIgnoreCase( "December" ) )
+ {
+ tempStr = "December";
+ }
+
+ else
+ {
+ tempStr = "March";
+
+ quarterPeriod = 1;
+
+ }
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD-YEAR" ) )
+ {
+ sDateTemp = sDate;
+
+ Calendar tempQuarterYear = Calendar.getInstance();
+
+ tempQuarterYear.setTime( sDateTemp );
+
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDateTemp );
+
+ // periodType =
+ // periodService.getPeriodType(periodTypeIdTB);
+
+ if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
+ {
+ sDateTemp = sDate;
+ }
+
+ else
+ {
+ if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
+ .equalsIgnoreCase( "March" )) && periodType.getName().equalsIgnoreCase( "Quarterly" ) )
+ {
+ tempQuarterYear.roll( Calendar.YEAR, -1 );
+
+ sDateTemp = tempQuarterYear.getTime();
+
+ }
+ }
+
+ tempStr = yearFormat.format( sDateTemp );
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" ) )
+ {
+ sDateTemp = sDate;
+
+ Calendar tempQuarterYear = Calendar.getInstance();
+
+ tempQuarterYear.setTime( sDateTemp );
+
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDateTemp );
+
+ // periodType =
+ // periodService.getPeriodType(periodTypeIdTB);
+
+ if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
+ {
+ sDateTemp = sDate;
+ }
+
+ else
+ {
+ if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
+ .equalsIgnoreCase( "March" )) && periodType.getName().equalsIgnoreCase( "Quarterly" ) )
+ {
+ tempQuarterYear.roll( Calendar.YEAR, -1 );
+
+ sDateTemp = tempQuarterYear.getTime();
+
+ }
+ }
+
+ tempStr = simpleYearFormat.format( sDateTemp );
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "YEAR-END" ) )
+ {
+
+ sDateTemp = sDate;
+
+ Calendar tempQuarterYear = Calendar.getInstance();
+
+ tempQuarterYear.setTime( sDate );
+
+ sDate = tempQuarterYear.getTime();
+
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDateTemp );
+
+ // periodType =
+ // periodService.getPeriodType(periodTypeIdTB);
+
+ if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
+ {
+ tempQuarterYear.roll( Calendar.YEAR, 1 );
+
+ sDateTemp = tempQuarterYear.getTime();
+
+ }
+
+ if ( !(startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
+ .equalsIgnoreCase( "March" )) )
+ {
+ tempQuarterYear.roll( Calendar.YEAR, 1 );
+
+ sDateTemp = tempQuarterYear.getTime();
+
+ }
+
+ tempStr = yearFormat.format( sDateTemp );
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+ {
+
+ sDateTemp = sDate;
+
+ eDateTemp = eDate;
+
+ Calendar tempQuarterYear = Calendar.getInstance();
+
+ String startYear = "";
+
+ String endYear = "";
+
+ String startMonth = "";
+
+ startMonth = monthFormat.format( sDateTemp );
+
+ // periodType =
+ // periodService.getPeriodType(periodTypeIdTB);
+
+ tempQuarterYear.setTime( sDateTemp );
+
+ if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
+ {
+ sDateTemp = sDate;
+ }
+
+ else
+ {
+ if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
+ .equalsIgnoreCase( "March" )) )
+ {
+ tempQuarterYear.roll( Calendar.YEAR, -1 );
+
+ sDateTemp = tempQuarterYear.getTime();
+
+ }
+ }
+
+ startYear = yearFormat.format( sDateTemp );
+
+ tempQuarterYear.setTime( eDateTemp );
+
+ if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
+ {
+ tempQuarterYear.roll( Calendar.YEAR, 1 );
+
+ eDateTemp = tempQuarterYear.getTime();
+ }
+
+ if ( !(startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
+ .equalsIgnoreCase( "March" )) )
+ {
+ tempQuarterYear.roll( Calendar.YEAR, 1 );
+
+ eDateTemp = tempQuarterYear.getTime();
+
+ }
+ endYear = yearFormat.format( eDateTemp );
+
+ tempStr = startYear + " - " + endYear;
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "SLNO" ) )
+ {
+ tempStr = "" + (orgUnitCount + 1);
+ }
+ else if ( deCodeString.equalsIgnoreCase( "NA" ) )
+ {
+ tempStr = " ";
+ }
+ else
+ {
+ rowCounter += 1;
+
+ if ( sType.equalsIgnoreCase( "dataelement" ) )
+ {
+ if ( aggCB == null )
+ {
+ tempStr = getIndividualResultDataValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit );
+ }
+ else
+ {
+ tempStr = getResultDataValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit );
+ }
+ }
+ else if ( sType.equalsIgnoreCase( "indicator-parent" ) )
+ {
+ if ( aggCB == null )
+ {
+ tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit.getParent() );
+ }
+ else
+ {
+ tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit.getParent() );
+ }
+ }
+ else if ( sType.equalsIgnoreCase( "dataelement-boolean" ) )
+ {
+ if ( aggCB == null )
+ {
+ tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit );
+ }
+ else
+ {
+ tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit );
+ }
+ }
+ else
+ {
+ if ( aggCB == null )
+ {
+ tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit );
+ }
+ else
+ {
+ tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(),
+ tempEndDate.getTime(), currentOrgUnit );
+ }
+ }
+ }
+ int tempRowNo = rowList.get( count1 );
+ int tempColNo = colList.get( count1 );
+ int sheetNo = sheetList.get( count1 ) + orgUnitGroupCount;
+ WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
+ if ( tempStr == null || tempStr.equals( " " ) )
+ {
+ tempColNo += orgUnitCount;
+
+ WritableCellFormat wCellformat = new WritableCellFormat();
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setWrap( true );
+ wCellformat.setAlignment( Alignment.CENTRE );
+
+ sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
+ }
+ else
+ {
+
+ if ( reportModelTB.equalsIgnoreCase( "STATIC" ) )
+ {
+ if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
+ || deCodeString.equalsIgnoreCase( "YEAR-END" )
+ || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+ {
+
+ }
+ else
+ {
+ // tempColNo +=
+ // orgUnitCount;
+ }
+
+ WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
+
+ CellFormat cellFormat = cell.getCellFormat();
+ WritableCellFormat wCellformat = new WritableCellFormat();
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setWrap( true );
+ wCellformat.setAlignment( Alignment.CENTRE );
+
+ if ( cell.getType() == CellType.LABEL )
+ {
+ Label l = (Label) cell;
+ l.setString( tempStr );
+ l.setCellFormat( cellFormat );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
+ }
+
+ if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
+ {
+ if ( deCodeString.equalsIgnoreCase( "FACILITYP" )
+ || deCodeString.equalsIgnoreCase( "FACILITYPP" )
+ || deCodeString.equalsIgnoreCase( "FACILITYPPP" )
+ || deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
+ || deCodeString.equalsIgnoreCase( "YEAR-END" )
+ || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+ {
+
+ }
+
+ else
+ {
+ tempColNo += orgUnitCount;
+ }
+
+ WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
+
+ CellFormat cellFormat = cell.getCellFormat();
+ WritableCellFormat wCellformat = new WritableCellFormat();
+
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setAlignment( Alignment.CENTRE );
+ wCellformat.setWrap( true );
+
+ if ( cell.getType() == CellType.LABEL )
+ {
+ Label l = (Label) cell;
+ l.setString( tempStr );
+ l.setCellFormat( cellFormat );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
+ }
+
+ if ( reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" )
+ || reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
+ {
+ if ( deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+ || deCodeString.equalsIgnoreCase( "FACILITY" ) )
+ {
+
+ }
+ if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+ {
+
+ }
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
+ || deCodeString.equalsIgnoreCase( "YEAR-END" )
+ || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+ {
+
+ }
+
+ WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
+
+ CellFormat cellFormat = cell.getCellFormat();
+ WritableCellFormat wCellformat = new WritableCellFormat();
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setWrap( true );
+ wCellformat.setAlignment( Alignment.CENTRE );
+
+ if ( cell.getType() == CellType.LABEL )
+ {
+ Label l = (Label) cell;
+ l.setString( tempStr );
+ l.setCellFormat( cellFormat );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
+ }
+
+ if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
+ {
+ if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
+ || deCodeString.equalsIgnoreCase( "YEAR-END" )
+ || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+ {
+
+ }
+ else
+ {
+ // tempColNo +=
+ // (orgUnitCount * 2);
+ }
+
+ WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
+
+ CellFormat cellFormat = cell.getCellFormat();
+ WritableCellFormat wCellformat = new WritableCellFormat();
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setAlignment( Alignment.CENTRE );
+
+ if ( cell.getType() == CellType.LABEL )
+ {
+ Label l = (Label) cell;
+ l.setString( tempStr );
+ l.setCellFormat( cellFormat );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
+ }
+
+ if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-SIBLINGS" )
+ || reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" ) )
+ {
+
+ if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
+ || deCodeString.equalsIgnoreCase( "YEAR-END" )
+ || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+ {
+
+ }
+ else
+ {
+ tempColNo += orgUnitCount;
+ }
+
+ WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
+
+ CellFormat cellFormat = cell.getCellFormat();
+ WritableCellFormat wCellformat = new WritableCellFormat();
+
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setWrap( true );
+ wCellformat.setAlignment( Alignment.CENTRE );
+ wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+
+ if ( cell.getType() == CellType.LABEL )
+ {
+ Label l = (Label) cell;
+ l.setString( tempStr );
+ l.setCellFormat( cellFormat );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
+ }
+ if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
+ {
+ if ( deCodeString.equalsIgnoreCase( "FACILITYP" )
+ || deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+ {
+
+ }
+
+ else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END" )
+ || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-START" )
+ || deCodeString.equalsIgnoreCase( "QUARTER-END" )
+ || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
+ || deCodeString.equalsIgnoreCase( "YEAR-END" )
+ || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+ {
+
+ }
+ else
+ {
+ tempRowNo += orgUnitCount;
+ }
+
+ WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
+
+ CellFormat cellFormat = cell.getCellFormat();
+ WritableCellFormat wCellformat = new WritableCellFormat();
+
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setWrap( true );
+ wCellformat.setAlignment( Alignment.CENTRE );
+ wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+
+ if ( cell.getType() == CellType.LABEL )
+ {
+ Label l = (Label) cell;
+ l.setString( tempStr );
+ l.setCellFormat( cellFormat );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
+ }
+ }
+ count1++;
+ }// inner while loop end
+
+ outputReportWorkbook.write();
+ outputReportWorkbook.close();
+
+ }// intermediate while loop end
orgUnitCount++;
-
- System.out.println(currentOrgUnit.getName() + " is Completed ");
-
+
+ System.out.println( currentOrgUnit.getName() + " is Completed " );
+
statusMessage = "Report Generation is complited. Please collect your reports from OutPut folder.";
}// outer while loop end
- System.out.println("Report Generation End Time is : \t" + new Date());
+ System.out.println( "Report Generation End Time is : \t" + new Date() );
statementManager.destroy();
return SUCCESS;
}
@@ -1745,7 +1740,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -1787,29 +1782,6 @@
return newPeriod;
}
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
-
- break;
- }
- }
- if ( periodType == null )
- {
- System.out.println( "No Such PeriodType" );
- return null;
- }
- return periodType;
- }
-
public List<String> getDECodes( String fileName )
{
List<String> deCodes = new ArrayList<String>();
@@ -1895,7 +1867,7 @@
return null;
} // getDataElementPeriodType end
-
+
/**
* Converts an expression on the form<br>
* [34] + [23], where the numbers are IDs of DataElements, to the form<br>
@@ -1926,8 +1898,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
@@ -2078,16 +2050,15 @@
String resultValue = "";
boolean valueDoesNotExist = true;
-
+
while ( matcher.find() )
{
-
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
@@ -2232,10 +2203,10 @@
{
resultValue = buffer.toString();
}
-
- if(valueDoesNotExist)
+
+ if ( valueDoesNotExist )
resultValue = " ";
-
+
if ( resultValue.equalsIgnoreCase( "" ) )
resultValue = " ";
@@ -2263,8 +2234,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2010-10-21 07:23:13 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2010-12-29 16:17:28 +0000
@@ -702,7 +702,6 @@
*/
// <editor-fold defaultstate="collapsed" desc="getChildOrgUnitTree method">
- @SuppressWarnings( "unchecked" )
public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
{
List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
@@ -711,11 +710,8 @@
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
Collections.sort( children, new OrganisationUnitNameComparator() );
- Iterator childIterator = children.iterator();
- OrganisationUnit child;
- while ( childIterator.hasNext() )
+ for ( OrganisationUnit child : children )
{
- child = (OrganisationUnit) childIterator.next();
orgUnitTree.addAll( getChildOrgUnitTree( child ) );
}
return orgUnitTree;
@@ -804,7 +800,7 @@
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -828,7 +824,7 @@
tempDate.roll( Calendar.MONTH, +1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -873,33 +869,6 @@
// </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="getPeriodTypeObject method">
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
-
- break;
-
- }
- }
- if ( periodType == null )
- {
- return null;
- }
-
- return periodType;
- }
-
- // </editor-fold>
-
// <editor-fold defaultstate="collapsed"
// desc="getStartingEndingPeriods method">
public List<Calendar> getStartingEndingPeriods( String deType, Date sDate, Date eDate )
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GenerateSelChildGradingReportAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GenerateSelChildGradingReportAction.java 2010-07-13 09:28:43 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GenerateSelChildGradingReportAction.java 2010-12-29 16:17:28 +0000
@@ -856,7 +856,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = reportService.getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = reportService.getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ),
periodType );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GradingAbstractionResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GradingAbstractionResultAction.java 2010-07-13 09:28:43 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/grading/action/GradingAbstractionResultAction.java 2010-12-29 16:17:28 +0000
@@ -949,7 +949,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = reportService.getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = reportService.getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ),
periodType );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/orgunitgroupsetreport/action/GenerateOrgunitGroupsetReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/orgunitgroupsetreport/action/GenerateOrgunitGroupsetReportsResultAction.java 2010-07-13 09:28:43 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/orgunitgroupsetreport/action/GenerateOrgunitGroupsetReportsResultAction.java 2010-12-29 16:17:28 +0000
@@ -835,7 +835,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = reportService.getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = reportService.getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ),
periodType );
@@ -856,7 +856,7 @@
{
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = reportService.getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = reportService.getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ),
periodType );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2010-10-21 07:23:13 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2010-12-29 16:17:28 +0000
@@ -1165,7 +1165,7 @@
tempDate.roll( Calendar.MONTH, -1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -1188,7 +1188,7 @@
tempDate.roll( Calendar.MONTH, +1 );
}
- PeriodType periodType = getPeriodTypeObject( "monthly" );
+ PeriodType periodType = PeriodType.getByNameIgnoreCase( "monthly" );
period = getPeriodByMonth( tempDate.get( Calendar.MONTH ), tempDate.get( Calendar.YEAR ), periodType );
return period;
@@ -1232,31 +1232,6 @@
}
// </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="getPeriodTypeObject method">
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = ( PeriodType ) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
-
- break;
-
- }
- }
- if ( periodType == null )
- {
- return null;
- }
-
- return periodType;
- }
- // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="getStartingEndingPeriods method">
public List<Calendar> getStartingEndingPeriods( String deType, Date sDate, Date eDate )
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ReportService.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ReportService.java 2010-07-13 09:28:43 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ReportService.java 2010-12-29 16:17:28 +0000
@@ -2,7 +2,6 @@
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
@@ -83,7 +82,7 @@
{
this.dataElementCategoryService = dataElementCategoryService;
}
-
+
private DataValueService dataValueService;
public void setDataValueService( DataValueService dataValueService )
@@ -93,7 +92,7 @@
private DataSetService dataSetService;
- public void setDataSetService( DataSetService dataSetStore )
+ public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
}
@@ -119,13 +118,11 @@
public List<Period> getMonthlyPeriods( Date start, Date end )
{
List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( start, end ) );
- PeriodType monthlyPeriodType = getPeriodTypeObject( "monthly" );
+ PeriodType monthlyPeriodType = PeriodType.getByNameIgnoreCase( "monthly" );
List<Period> monthlyPeriodList = new ArrayList<Period>();
- Iterator it = periodList.iterator();
- while ( it.hasNext() )
+ for ( Period period : periodList )
{
- Period period = (Period) it.next();
if ( period.getPeriodType().getId() == monthlyPeriodType.getId() )
{
monthlyPeriodList.add( period );
@@ -171,33 +168,6 @@
}
/*
- * Returns the PeriodType Object based on the Period Type Name For ex:- if
- * we pass name as Monthly then it returns the PeriodType Object for Monthly
- * PeriodType If there is no such PeriodType returns null
- */
- public PeriodType getPeriodTypeObject( String periodTypeName )
- {
- Collection periodTypes = periodService.getAllPeriodTypes();
- PeriodType periodType = null;
- Iterator iter = periodTypes.iterator();
- while ( iter.hasNext() )
- {
- PeriodType tempPeriodType = (PeriodType) iter.next();
- if ( tempPeriodType.getName().toLowerCase().trim().equals( periodTypeName ) )
- {
- periodType = tempPeriodType;
- break;
- }
- }
- if ( periodType == null )
- {
- System.out.println( "No Such PeriodType" );
- return null;
- }
- return periodType;
- }
-
- /*
* Returns the child tree of the selected Orgunit
*/
public List<OrganisationUnit> getAllChildren( OrganisationUnit selecteOU )
@@ -319,18 +289,16 @@
}
/*
+ * Only report period type if element is in a data set?
+ *
* Returns the PeriodType Object for selected DataElement, If no PeriodType
* is found then by default returns Monthly Period type
*/
public PeriodType getDataElementPeriodType( DataElement de )
{
- List<DataSet> dataSetList = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
- Iterator it = dataSetList.iterator();
- while ( it.hasNext() )
+ for ( DataSet ds : dataSetService.getAllDataSets() )
{
- DataSet ds = (DataSet) it.next();
- List<DataElement> dataElementList = new ArrayList<DataElement>( ds.getDataElements() );
- if ( dataElementList.contains( de ) )
+ if ( ds.getDataElements().contains( de ) )
{
return ds.getPeriodType();
}
@@ -338,7 +306,7 @@
return null;
- } // getDataElementPeriodType end
+ }
private String getResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit )
{
@@ -362,8 +330,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
@@ -522,8 +490,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
@@ -700,8 +668,8 @@
String replaceString = matcher.group();
replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
- String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1, replaceString
- .length() );
+ String optionComboIdStr = replaceString.substring( replaceString.indexOf( '.' ) + 1,
+ replaceString.length() );
replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java 2010-06-16 11:17:12 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java 2010-12-29 16:17:28 +0000
@@ -186,8 +186,6 @@
{
deTargetMapping = new DeTargetMapping( dataElement, deoptioncombo, target, detargetoptioncombo );
- System.out.println( deTargetMapping.getDataelement().getName() );
-
deTargetMappingService.addDeTargetMapping( deTargetMapping );
}
else
@@ -198,18 +196,9 @@
}
dename = dataElement.getName() + ":" + deoptioncombo.getName();
- if ( deTargetMapping == null )
- {
-
- targetname = "None";
- targetid = "-1";
- }
- else
- {
- targetname = deTargetMapping.getTargetDataelement().getName();
- targetid = "" + deTargetMapping.getTargetDataelement().getId() + ":"
- + deTargetMapping.getTargetoptioncombo().getId();
- }
+ targetname = deTargetMapping.getTargetDataelement().getName();
+ targetid = "" + deTargetMapping.getTargetDataelement().getId() + ":"
+ + deTargetMapping.getTargetoptioncombo().getId();
// dataElementCategoryOptionComboService.getDefaultDataElementCategoryOptionCombo();
return SUCCESS;