dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24951
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12282: Data entry, went from using home-grown period format to iso format. First step in using web api.
------------------------------------------------------------
revno: 12282
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-27 14:55:38 +0200
message:
Data entry, went from using home-grown period format to iso format. First step in using web api.
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-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MarkForFollowupAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.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 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java 2013-09-27 12:55:38 +0000
@@ -121,18 +121,10 @@
* @param externalId the external identifier.
* @return a Period.
*/
+ @Deprecated
Period getPeriodByExternalId( String externalId );
/**
- * Generates all Periods with the corresponding external identifiers in the
- * given Collection. The Periods which don't exist are created and persisted.
- *
- * @param externalIds the external identifiers.
- * @return a Collection of Periods.
- */
- Collection<Period> getPeriodsByExternalIds( Collection<String> externalIds );
-
- /**
* Returns all Periods with start date after or equal the specified start
* date and end date before or equal the specified end date.
*
=== 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 2013-09-24 07:05:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java 2013-09-27 12:55:38 +0000
@@ -355,6 +355,7 @@
* @param externalId the external identifier.
* @return the period.
*/
+ @Deprecated
public static Period createPeriodExternalId( String externalId )
{
if ( externalId == null || externalId.split( "_" ).length <= 1 )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java 2013-09-27 12:55:38 +0000
@@ -120,22 +120,11 @@
} );
}
+ @Deprecated
public Period getPeriodByExternalId( String externalId )
{
return periodStore.reloadForceAddPeriod( new Period( externalId ) );
}
-
- public Collection<Period> getPeriodsByExternalIds( Collection<String> externalIds )
- {
- Collection<Period> periods = new ArrayList<Period>();
-
- for ( String id : externalIds )
- {
- periods.add( getPeriodByExternalId( id ) );
- }
-
- return periods;
- }
public Collection<Period> getPeriodsByPeriodType( PeriodType periodType )
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm 2013-08-25 20:46:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm 2013-09-27 12:55:38 +0000
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# 2.13-SNAPSHOT V11
+# 2.13-SNAPSHOT V12
NETWORK:
*
CACHE:
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-09-27 12:55:38 +0000
@@ -185,7 +185,8 @@
Set<OrganisationUnit> children = organisationUnit.getChildren();
DataSet dataSet = dataSetService.getDataSet( dataSetId );
- Period period = PeriodType.createPeriodExternalId( periodId );
+
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
// TODO null-checks
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java 2013-09-27 12:55:38 +0000
@@ -154,7 +154,7 @@
DataElement dataElement = dataElementService.getDataElement( dataElementId );
DataElementCategoryOptionCombo categoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( categoryOptionComboId );
- Period period = PeriodType.createPeriodExternalId( periodId );
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java 2013-09-27 12:55:38 +0000
@@ -231,7 +231,7 @@
throw new IllegalArgumentException( "DataElement doesn't exist: " + dataElementId );
}
- Period period = PeriodType.createPeriodExternalId( periodId );
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MarkForFollowupAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MarkForFollowupAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MarkForFollowupAction.java 2013-09-27 12:55:38 +0000
@@ -133,7 +133,7 @@
{
DataElement dataElement = dataElementService.getDataElement( dataElementId );
DataElementCategoryOptionCombo categoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( categoryOptionComboId );
- Period period = PeriodType.createPeriodExternalId( periodId );
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
OrganisationUnit source = organisationUnitService.getOrganisationUnit( organisationUnitId );
DataValue dataValue = dataValueService.getDataValue( source, dataElement, period, categoryOptionCombo );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/RegisterCompleteDataSetAction.java 2013-09-27 12:55:38 +0000
@@ -138,7 +138,7 @@
public String execute()
{
DataSet dataSet = dataSetService.getDataSet( dataSetId );
- Period period = PeriodType.createPeriodExternalId( periodId );
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
Set<OrganisationUnit> children = organisationUnit.getChildren();
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java 2013-09-27 12:55:38 +0000
@@ -142,7 +142,7 @@
{
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
- Period period = PeriodType.createPeriodExternalId( periodId );
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
DataElement dataElement = dataElementService.getDataElement( dataElementId );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 2013-09-17 18:23:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 2013-09-27 12:55:38 +0000
@@ -141,7 +141,7 @@
{
this.periodId = periodId;
}
-
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -159,7 +159,7 @@
public String execute()
{
- Period period = PeriodType.createPeriodExternalId( periodId );
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
if ( period == null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/UndoCompleteDataSetAction.java 2013-09-27 12:55:38 +0000
@@ -121,7 +121,7 @@
public String execute()
{
DataSet dataSet = dataSetService.getDataSet( dataSetId );
- Period period = PeriodType.createPeriodExternalId( periodId );
+ Period period = PeriodType.getPeriodFromIsoString( periodId );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
Set<OrganisationUnit> children = organisationUnit.getChildren();
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java 2013-08-25 20:46:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java 2013-09-27 12:55:38 +0000
@@ -186,14 +186,13 @@
public String execute()
throws Exception
{
- System.out.println("ou " + organisationUnitId);
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
DataSet dataSet = dataSetService.getDataSet( dataSetId );
- Period selectedPeriod = PeriodType.createPeriodExternalId( periodId );
+ Period selectedPeriod = PeriodType.getPeriodFromIsoString( periodId );
- if ( selectedPeriod == null || orgUnit == null || (multiOrganisationUnit && !orgUnit.hasChild()) )
+ if ( selectedPeriod == null || orgUnit == null || ( multiOrganisationUnit && !orgUnit.hasChild() ) )
{
return SUCCESS;
}
@@ -234,9 +233,10 @@
return dataValues.size() == 0 && validationResults.size() == 0 ? SUCCESS : INPUT;
}
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// Min-max and outlier analysis
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
+
private List<DeflatedDataValue> outlierAnalysis( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
{
List<DeflatedDataValue> deflatedDataValues = new ArrayList<DeflatedDataValue>( minMaxOutlierAnalysisService.analyse( getCollection( organisationUnit ),
@@ -247,9 +247,10 @@
return deflatedDataValues;
}
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// Validation rule analysis
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
+
private List<ValidationResult> validationRuleAnalysis( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
{
List<ValidationResult> validationResults = new ArrayList<ValidationResult>( validationRuleService.validate( dataSet, period, organisationUnit ) );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-09-23 09:57:48 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-09-27 12:55:38 +0000
@@ -928,7 +928,7 @@
$.safeEach( periods, function( idx, item )
{
- addOptionById( 'selectedPeriodId', item.id, item.name );
+ addOptionById( 'selectedPeriodId', item.iso, item.name );
} );
}
@@ -970,7 +970,7 @@
$.safeEach( periods, function( idx, item )
{
- addOptionById( 'selectedPeriodId', item.id, item.name );
+ addOptionById( 'selectedPeriodId', item.iso, item.name );
} );
var previousPeriodType = currentDataSetId ? dataSets[currentDataSetId].periodType : null;
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2013-09-16 13:46:22 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2013-09-27 12:55:38 +0000
@@ -34,11 +34,8 @@
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.configuration.ConfigurationService;
-import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;