dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38424
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19564: Data export, validation, performance fix
------------------------------------------------------------
revno: 19564
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-07-07 15:16:25 +0200
message:
Data export, validation, performance fix
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataExportParams.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.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/DataExportParams.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataExportParams.java 2015-06-09 19:59:15 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataExportParams.java 2015-07-07 13:16:25 +0000
@@ -63,6 +63,15 @@
private IdSchemes idSchemes;
// -------------------------------------------------------------------------
+ // Transient properties
+ // -------------------------------------------------------------------------
+
+ /**
+ * Organisation units originally part of the request, excluding children.
+ */
+ private transient Set<OrganisationUnit> requestOrganisationUnits = new HashSet<>();
+
+ // -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -105,6 +114,15 @@
}
/**
+ * Sets the request organisation units to the currently selected
+ * organisation units.
+ */
+ public void setRequestOrganisationUnits()
+ {
+ this.requestOrganisationUnits.addAll( organisationUnits );
+ }
+
+ /**
* Indicates whether this parameters represents a single data value set, implying
* that it contains exactly one of data sets, periods and organisation units.
*/
@@ -217,4 +235,14 @@
{
this.idSchemes = idSchemes;
}
+
+ public Set<OrganisationUnit> getRequestOrganisationUnits()
+ {
+ return requestOrganisationUnits;
+ }
+
+ public void setRequestOrganisationUnits( Set<OrganisationUnit> requestOrganisationUnits )
+ {
+ this.requestOrganisationUnits = requestOrganisationUnits;
+ }
}
=== 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 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2015-07-07 13:16:25 +0000
@@ -181,10 +181,11 @@
if ( organisationUnits != null )
{
params.getOrganisationUnits().addAll( identifiableObjectManager.getByUid( OrganisationUnit.class, organisationUnits ) );
+ params.setRequestOrganisationUnits();
if ( includeChildren )
{
- params.setOrganisationUnits( new HashSet<OrganisationUnit>(
+ params.getOrganisationUnits().addAll( new HashSet<OrganisationUnit>(
organisationUnitService.getOrganisationUnitsWithChildren( getUids( params.getOrganisationUnits() ) ) ) );
}
}
@@ -222,12 +223,12 @@
violation = "Start date must be before end date";
}
- if ( params.getOrganisationUnits().isEmpty() )
+ if ( params.getRequestOrganisationUnits().isEmpty() )
{
violation = "At least one valid organisation unit must be specified";
}
- for ( OrganisationUnit unit : params.getOrganisationUnits() )
+ for ( OrganisationUnit unit : params.getRequestOrganisationUnits() )
{
if ( !organisationUnitService.isInUserHierarchy( unit ) )
{