dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02132
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 723: Removed unnecessary dependencies from service-excel-reporting. Replaced String.isEmpty calls with...
------------------------------------------------------------
revno: 723
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-09-15 14:36:41 +0200
message:
Removed unnecessary dependencies from service-excel-reporting. Replaced String.isEmpty calls with length() == 0.
modified:
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserService.java
dhis-2/dhis-services/dhis-service-excel-reporting/pom.xml
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.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-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserService.java 2009-08-24 13:55:25 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserService.java 2009-09-15 12:36:41 +0000
@@ -73,9 +73,9 @@
public DataBrowserTable getDataSetsInPeriod( String startDate, String endDate, PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
@@ -85,9 +85,9 @@
public DataBrowserTable getDataElementGroupsInPeriod( String startDate, String endDate, PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
@@ -97,9 +97,9 @@
public DataBrowserTable getOrgUnitGroupsInPeriod( String startDate, String endDate, PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
@@ -110,9 +110,9 @@
public DataBrowserTable getOrgUnitsInPeriod( Integer orgUnitParent, String startDate, String endDate,
PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
@@ -130,9 +130,9 @@
public DataBrowserTable getCountDataElementsForDataSetInPeriod( Integer dataSetId, String startDate,
String endDate, PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
@@ -148,9 +148,9 @@
public DataBrowserTable getCountDataElementsForDataElementGroupInPeriod( Integer dataElementGroupId,
String startDate, String endDate, PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
@@ -168,9 +168,9 @@
public DataBrowserTable getCountDataElementGroupsForOrgUnitGroupInPeriod( Integer orgUnitGroupId, String startDate,
String endDate, PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
@@ -189,9 +189,9 @@
public DataBrowserTable getCountDataElementsForOrgUnitInPeriod( Integer orgUnitGroupId, String startDate,
String endDate, PeriodType periodType )
{
- if ( startDate == null || startDate.isEmpty() )
+ if ( startDate == null || startDate.length() == 0 )
startDate = STARTDATE;
- if ( endDate == null || endDate.isEmpty() )
+ if ( endDate == null || endDate.length() == 0 )
endDate = ENDDATE;
List<Integer> betweenPeriodIds = getAllPeriodIdsBetweenDatesOnPeriodType( startDate, endDate, periodType );
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/pom.xml'
--- dhis-2/dhis-services/dhis-service-excel-reporting/pom.xml 2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/pom.xml 2009-09-15 12:36:41 +0000
@@ -53,41 +53,6 @@
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-support-hibernate</artifactId>
</dependency>
-
- <!-- Other -->
-
- <dependency>
- <groupId>jfree</groupId>
- <artifactId>jfreechart</artifactId>
- </dependency>
- <dependency>
- <groupId>jfree</groupId>
- <artifactId>jcommon</artifactId>
- </dependency>
- <dependency>
- <groupId>jep</groupId>
- <artifactId>jep</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.jexcelapi</groupId>
- <artifactId>jxl</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-math</groupId>
- <artifactId>commons-math</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-support-external</artifactId>
- </dependency>
- <dependency>
- <groupId>org.amplecode</groupId>
- <artifactId>cave-process</artifactId>
- </dependency>
-
+
</dependencies>
</project>
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java 2009-09-14 15:29:21 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java 2009-09-15 12:36:41 +0000
@@ -44,12 +44,10 @@
* @author Tran Thanh Tri
* @version $Id$
*/
-
@Transactional
public class DefaultReportExcelService
implements ReportExcelService
{
-
// -------------------------------------------------
// Dependency
// -------------------------------------------------
@@ -242,5 +240,4 @@
{
return reportStore.getDataEntryStatusDefaultByDataSets( arg0 );
}
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java 2009-09-14 15:29:21 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java 2009-09-15 12:36:41 +0000
@@ -161,7 +161,6 @@
Session session = sessionFactory.getCurrentSession();
session.save( reportItem );
-
}
public void updateReportExcelItem( ReportExcelItem reportItem )
@@ -169,7 +168,6 @@
Session session = sessionFactory.getCurrentSession();
session.update( reportItem );
-
}
public void deleteReportExcelItem( int id )
@@ -177,7 +175,6 @@
Session session = sessionFactory.getCurrentSession();
session.delete( this.getReportExcelItem( id ) );
-
}
public ReportExcelItem getReportExcelItem( int id )
@@ -237,7 +234,6 @@
{
Session session = sessionFactory.getCurrentSession();
return (DataElementGroupOrder) session.get( DataElementGroupOrder.class, id );
-
}
public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder )
@@ -259,29 +255,37 @@
public int countDataValueOfDataSet( DataSet dataSet, OrganisationUnit organisationUnit, Period period )
{
Session session = sessionFactory.getCurrentSession();
+
String sql = "select count(*) as c from datavalue where sourceid=" + organisationUnit.getId()
+ " and dataelementid in (";
+
int i = 0;
- for ( DataElement de : dataSet.getDataElements() )
+
+ for ( DataElement element : dataSet.getDataElements() )
{
- if ( i < dataSet.getDataElements().size() - 1 )
- sql += de.getId() + ",";
- else
- sql += de.getId();
- i++;
+ sql += element.getId();
+
+ if ( i++ < dataSet.getDataElements().size() - 1 )
+ {
+ sql += ",";
+ }
}
+
sql += ") and periodid=" + period.getId();
+
SQLQuery query = session.createSQLQuery( sql );
+
query.addScalar( "c", Hibernate.INTEGER );
return Integer.valueOf( String.valueOf( query.uniqueResult() ) );
}
- public void deleteDataEntryStatus( int arg0 )
+ public void deleteDataEntryStatus( int id )
{
Session session = sessionFactory.getCurrentSession();
- session.delete( this.getDataEntryStatus( arg0 ) );
+
+ session.delete( getDataEntryStatus( id ) );
}
@SuppressWarnings( "unchecked" )
@@ -294,10 +298,11 @@
return criteria.list();
}
- public DataEntryStatus getDataEntryStatus( int arg0 )
+ public DataEntryStatus getDataEntryStatus( int id )
{
Session session = sessionFactory.getCurrentSession();
- return (DataEntryStatus) session.get( DataEntryStatus.class, arg0 );
+
+ return (DataEntryStatus) session.get( DataEntryStatus.class, id );
}
@SuppressWarnings( "unchecked" )
@@ -332,5 +337,4 @@
return result;
}
-
}