dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26631
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13173: Data import, validation for missing periods
------------------------------------------------------------
revno: 13173
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-12-08 22:46:50 +0100
message:
Data import, validation for missing periods
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.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-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2013-10-22 14:32:09 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2013-12-08 21:46:50 +0000
@@ -168,6 +168,11 @@
{
Set<Period> periods = new HashSet<Period>( periodService.getPeriodsBetweenDates( startDate, endDate ) );
+ if ( periods.isEmpty() )
+ {
+ throw new IllegalArgumentException( "At least one period must be specified" );
+ }
+
dataValueSetStore.writeDataValueSetXml( null, null, null, null, getDataElements( dataSets ), periods, getOrgUnits( orgUnits ), out );
}
@@ -175,6 +180,11 @@
{
Set<Period> periods = new HashSet<Period>( periodService.getPeriodsBetweenDates( startDate, endDate ) );
+ if ( periods.isEmpty() )
+ {
+ throw new IllegalArgumentException( "At least one period must be specified" );
+ }
+
dataValueSetStore.writeDataValueSetCsv( getDataElements( dataSets ), periods, getOrgUnits( orgUnits ), writer );
}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java 2013-12-08 21:46:50 +0000
@@ -114,6 +114,8 @@
public String execute()
throws Exception
{
+ //TODO reimplement to use web api
+
Set<String> orgUnits = new HashSet<String>();
for ( OrganisationUnit unit : selectionTreeManager.getReloadedSelectedOrganisationUnits() )