dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28708
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14362: TEI query, setting org unit level later in the process
------------------------------------------------------------
revno: 14362
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-24 14:53:21 +0100
message:
TEI query, setting org unit level later in the process
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.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/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2014-03-24 13:53:21 +0000
@@ -698,16 +698,21 @@
return map;
}
+ public boolean hasLevel()
+ {
+ return level > 0;
+ }
+
+ @Override
+ public boolean haveUniqueNames()
+ {
+ return false;
+ }
+
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
- @Override
- public boolean haveUniqueNames()
- {
- return false;
- }
-
@JsonProperty
@JsonView( UuidView.class )
@JacksonXmlProperty( isAttribute = true, namespace = DxfNamespaces.DXF_2_0 )
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-03-20 18:48:06 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-03-24 13:53:21 +0000
@@ -147,6 +147,18 @@
public Grid getTrackedEntityInstances( TrackedEntityInstanceQueryParams params )
{
validate( params );
+
+ // ---------------------------------------------------------------------
+ // Verify params
+ // ---------------------------------------------------------------------
+
+ for ( OrganisationUnit organisationUnit : params.getOrganisationUnits() )
+ {
+ if ( !organisationUnit.hasLevel() )
+ {
+ organisationUnit.setLevel( organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() ) );
+ }
+ }
// ---------------------------------------------------------------------
// If params of type query and no attributes or filters defined, use
@@ -276,8 +288,6 @@
throw new IllegalQueryException( "Organisation unit does not exist: " + orgUnit );
}
- organisationUnit.setLevel( organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() ) );
-
params.getOrganisationUnits().add( organisationUnit );
}
}