dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16477
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6271: Gave some methods better names
------------------------------------------------------------
revno: 6271
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-03-15 13:47:27 +0100
message:
Gave some methods better names
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/CompulsoryDataSetCompletenessService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.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/completeness/DataSetCompletenessStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java 2012-03-15 12:47:27 +0000
@@ -44,7 +44,17 @@
int getCompleteDataSetRegistrations( DataSet dataSet, Period period, Collection<Integer> relevantSources );
int getCompleteDataSetRegistrations( DataSet dataSet, Period period, Collection<Integer> relevantSources, Date deadline );
-
+
+ int getCompulsoryDataElementRegistrations( DataSet dataSet, Collection<Integer> children, Period period );
+
+ int getCompulsoryDataElementRegistrations( DataSet dataSet, Collection<Integer> children, Period period, Date deadline );
+
+ int getNumberOfValues( DataSet dataSet, Collection<Integer> children, Period period, Date deadline );
+
+ Collection<DataSet> getDataSetsWithRegistrations( Collection<DataSet> dataSets );
+
+ Collection<Period> getPeriodsWithRegistrations( Collection<Period> periods );
+
/**
* Gets the percentage value for the datasetcompleteness with the given parameters.
*
@@ -69,16 +79,6 @@
*/
void deleteDataSetCompleteness();
- int getRegistrations( DataSet dataSet, Collection<Integer> children, Period period );
-
- int getRegistrations( DataSet dataSet, Collection<Integer> children, Period period, Date deadline );
-
- int getNumberOfValues( DataSet dataSet, Collection<Integer> children, Period period, Date deadline );
-
- Collection<DataSet> getDataSetsWithRegistrations( Collection<DataSet> dataSets );
-
- Collection<Period> getPeriodsWithRegistrations( Collection<Period> periods );
-
void createIndex();
void dropIndex();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/CompulsoryDataSetCompletenessService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/CompulsoryDataSetCompletenessService.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/CompulsoryDataSetCompletenessService.java 2012-03-15 12:47:27 +0000
@@ -41,12 +41,12 @@
{
public int getRegistrations( DataSet dataSet, Collection<Integer> relevantSources, Period period )
{
- return completenessStore.getRegistrations( dataSet, relevantSources, period );
+ return completenessStore.getCompulsoryDataElementRegistrations( dataSet, relevantSources, period );
}
public int getRegistrationsOnTime( DataSet dataSet, Collection<Integer> relevantSources, Period period, Date deadline )
{
- return completenessStore.getRegistrations( dataSet, relevantSources, period, deadline );
+ return completenessStore.getCompulsoryDataElementRegistrations( dataSet, relevantSources, period, deadline );
}
public int getSources( DataSet dataSet, Collection<Integer> relevantSources )
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java 2012-03-15 12:47:27 +0000
@@ -67,6 +67,10 @@
// DataSetCompletenessStore
// -------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
+ // Based on complete data set registrations
+ // -------------------------------------------------------------------------
+
public int getCompleteDataSetRegistrations( DataSet dataSet, Period period, Collection<Integer> relevantSources )
{
if ( relevantSources == null || relevantSources.size() == 0 )
@@ -102,42 +106,16 @@
return statementManager.getHolder().queryForInteger( sql );
}
- public double getPercentage( int dataSetId, int periodId, int organisationUnitId )
- {
- final String sql =
- "SELECT value " +
- "FROM aggregateddatasetcompleteness " +
- "WHERE datasetid = " + dataSetId + " " +
- "AND periodid = " + periodId + " " +
- "AND organisationunitid = " + organisationUnitId;
-
- return statementManager.getHolder().queryForDouble( sql );
- }
-
- public void deleteDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
- {
- final String sql =
- "DELETE FROM aggregateddatasetcompleteness " +
- "WHERE datasetid IN ( " + getCommaDelimitedString( dataSetIds ) + " ) " +
- "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
- "AND organisationunitid IN ( " + getCommaDelimitedString( organisationUnitIds ) + " )";
-
- statementManager.getHolder().executeUpdate( sql );
- }
-
- public void deleteDataSetCompleteness()
- {
- final String sql = "DELETE FROM aggregateddatasetcompleteness";
-
- statementManager.getHolder().executeUpdate( sql );
- }
+ // -------------------------------------------------------------------------
+ // Based on compulsory data element operands
+ // -------------------------------------------------------------------------
- public int getRegistrations( DataSet dataSet, Collection<Integer> children, Period period )
+ public int getCompulsoryDataElementRegistrations( DataSet dataSet, Collection<Integer> children, Period period )
{
- return getRegistrations( dataSet, children, period, null );
+ return getCompulsoryDataElementRegistrations( dataSet, children, period, null );
}
- public int getRegistrations( DataSet dataSet, Collection<Integer> children, Period period, Date deadline )
+ public int getCompulsoryDataElementRegistrations( DataSet dataSet, Collection<Integer> children, Period period, Date deadline )
{
final int compulsoryElements = dataSet.getCompulsoryDataElementOperands().size();
final String childrenIds = TextUtils.getCommaDelimitedString( children );
@@ -158,7 +136,11 @@
return statementManager.getHolder().queryForInteger( sql );
}
-
+
+ // -------------------------------------------------------------------------
+ // Based on number of data values
+ // -------------------------------------------------------------------------
+
public int getNumberOfValues( DataSet dataSet, Collection<Integer> children, Period period, Date deadline )
{
final String childrenIds = TextUtils.getCommaDelimitedString( children );
@@ -208,7 +190,41 @@
return selection;
}
-
+
+ // -------------------------------------------------------------------------
+ // Aggregated data set completeness methods
+ // -------------------------------------------------------------------------
+
+ public double getPercentage( int dataSetId, int periodId, int organisationUnitId )
+ {
+ final String sql =
+ "SELECT value " +
+ "FROM aggregateddatasetcompleteness " +
+ "WHERE datasetid = " + dataSetId + " " +
+ "AND periodid = " + periodId + " " +
+ "AND organisationunitid = " + organisationUnitId;
+
+ return statementManager.getHolder().queryForDouble( sql );
+ }
+
+ public void deleteDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
+ {
+ final String sql =
+ "DELETE FROM aggregateddatasetcompleteness " +
+ "WHERE datasetid IN ( " + getCommaDelimitedString( dataSetIds ) + " ) " +
+ "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
+ "AND organisationunitid IN ( " + getCommaDelimitedString( organisationUnitIds ) + " )";
+
+ statementManager.getHolder().executeUpdate( sql );
+ }
+
+ public void deleteDataSetCompleteness()
+ {
+ final String sql = "DELETE FROM aggregateddatasetcompleteness";
+
+ statementManager.getHolder().executeUpdate( sql );
+ }
+
public void createIndex()
{
try
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java 2012-02-17 11:21:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java 2012-03-15 12:47:27 +0000
@@ -155,7 +155,8 @@
{
Grid _grid = (Grid) SessionUtils.getSessionVar( KEY_DATA_COMPLETENESS );
- // Uselast grid for any format except html
+ // Use last grid for any format except HTML
+
if ( _grid != null && type != null && !type.equals( DEFAULT_TYPE ) )
{
grid = _grid;
@@ -180,8 +181,7 @@
DataSetCompletenessService completenessService = serviceProvider.provide( criteria );
- if ( dataSetId != null && dataSetId != 0 )
- // One data set for one organisation unit
+ if ( dataSetId != null && dataSetId != 0 ) // One ds for one ou
{
mainResults = new ArrayList<DataSetCompletenessResult>( completenessService.getDataSetCompleteness(
_periodId, getIdentifiers( OrganisationUnit.class, selectedUnit.getChildren() ), dataSetId ) );
@@ -192,8 +192,7 @@
dataSet = dataSetService.getDataSet( dataSetId );
}
- else
- // All data sets for children of one organisation unit
+ else // All ds for children of one ou
{
mainResults = new ArrayList<DataSetCompletenessResult>( completenessService.getDataSetCompleteness(
_periodId, selectedUnit.getId() ) );