dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28712
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14366: TEI query, using enum for org unit selection mode
------------------------------------------------------------
revno: 14366
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-24 15:16:32 +0100
message:
TEI query, using enum for org unit selection mode
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java
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/hibernate/HibernateTrackedEntityInstanceStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/TrackedEntityInstanceController.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/common/DimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2014-03-24 14:16:32 +0000
@@ -49,7 +49,7 @@
final String ORGUNIT_GROUP_DIM_ID = "oug"; // Used for org unit target
final String ITEM_DIM_ID = "item";
- final String OU_MODE_SELECTED = "selected";
+ final String OU_MODE_SELECTED = "selected"; //TODO replace with OrganisationUnitSelectionMode
final String OU_MODE_CHILDREN = "children";
final String OU_MODE_DESCENDANTS = "descendants";
final String OU_MODE_ALL = "all";
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java 2014-03-24 14:03:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java 2014-03-24 14:16:32 +0000
@@ -33,6 +33,7 @@
import java.util.List;
import java.util.Set;
+import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.common.QueryItem;
import org.hisp.dhis.common.SetMap;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -85,7 +86,7 @@
/**
* Selection mode for the specified organisation units.
*/
- private String organisationUnitMode;
+ private OrganisationUnitSelectionMode organisationUnitMode;
/**
* Page number.
@@ -205,9 +206,9 @@
/**
* Indicates whethert this params is of the given organisation unit mode.
*/
- public boolean isOrganisationUnitMode( String mode )
+ public boolean isOrganisationUnitMode( OrganisationUnitSelectionMode mode )
{
- return organisationUnitMode != null && organisationUnitMode.equalsIgnoreCase( mode );
+ return organisationUnitMode != null && organisationUnitMode.equals( mode );
}
/**
@@ -276,12 +277,12 @@
this.filters = filters;
}
- public String getOrganisationUnitMode()
+ public OrganisationUnitSelectionMode getOrganisationUnitMode()
{
return organisationUnitMode;
}
- public void setOrganisationUnitMode( String organisationUnitMode )
+ public void setOrganisationUnitMode( OrganisationUnitSelectionMode organisationUnitMode )
{
this.organisationUnitMode = organisationUnitMode;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-03-18 16:11:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-03-24 14:16:32 +0000
@@ -33,6 +33,7 @@
import java.util.Set;
import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -56,7 +57,7 @@
Grid getTrackedEntityInstances( TrackedEntityInstanceQueryParams params );
TrackedEntityInstanceQueryParams getFromUrl( String query, Set<String> attribute, Set<String> filter,
- Set<String> ou, String ouMode, String program, String trackedEntity, Integer page, Integer pageSize );
+ Set<String> ou, OrganisationUnitSelectionMode ouMode, String program, String trackedEntity, Integer page, Integer pageSize );
/**
* Adds an {@link TrackedEntityInstance}
=== 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-24 13:53:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-03-24 14:16:32 +0000
@@ -50,6 +50,7 @@
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.GridHeader;
import org.hisp.dhis.common.IllegalQueryException;
+import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.common.QueryItem;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
@@ -252,8 +253,8 @@
}
@Override
- public TrackedEntityInstanceQueryParams getFromUrl( String query, Set<String> attribute, Set<String> filter, Set<String> ou, String ouMode,
- String program, String trackedEntity, Integer page, Integer pageSize )
+ public TrackedEntityInstanceQueryParams getFromUrl( String query, Set<String> attribute, Set<String> filter, Set<String> ou,
+ OrganisationUnitSelectionMode ouMode, String program, String trackedEntity, Integer page, Integer pageSize )
{
TrackedEntityInstanceQueryParams params = new TrackedEntityInstanceQueryParams();
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-03-24 14:03:51 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-03-24 14:16:32 +0000
@@ -60,8 +60,8 @@
import org.hibernate.criterion.Disjunction;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
-import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.common.QueryItem;
import org.hisp.dhis.common.SetMap;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
@@ -175,7 +175,7 @@
}
}
- if ( params.isOrganisationUnitMode( DimensionalObject.OU_MODE_DESCENDANTS ) )
+ if ( params.isOrganisationUnitMode( OrganisationUnitSelectionMode.DESCENDANTS ) )
{
sql += "left join _orgunitstructure ous on tei.organisationunitid = ous.organisationunitid ";
}
@@ -185,7 +185,7 @@
sql += hlp.whereAnd() + " tei.trackedentityid = " + params.getTrackedEntity().getId() + " ";
}
- if ( params.isOrganisationUnitMode( DimensionalObject.OU_MODE_DESCENDANTS ) )
+ if ( params.isOrganisationUnitMode( OrganisationUnitSelectionMode.DESCENDANTS ) )
{
SetMap<Integer, OrganisationUnit> levelOuMap = params.getLevelOrgUnitMap();
@@ -196,7 +196,7 @@
sql = sql.substring( 0, sql.length() - 3 ); // Remove last or
}
- else // OU_MODE_SELECTED
+ else // SELECTED
{
sql += hlp.whereAnd() + " tei.organisationunitid in (" + getCommaDelimitedString( getIdentifiers( params.getOrganisationUnits() ) ) + ") ";
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/TrackedEntityInstanceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/TrackedEntityInstanceController.java 2014-03-18 16:11:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/TrackedEntityInstanceController.java 2014-03-24 14:16:32 +0000
@@ -41,10 +41,10 @@
import org.hisp.dhis.api.controller.exception.NotFoundException;
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
-import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.IllegalQueryException;
+import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.dxf2.events.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.dxf2.events.trackedentity.TrackedEntityInstanceService;
import org.hisp.dhis.dxf2.importsummary.ImportStatus;
@@ -101,7 +101,7 @@
@RequestParam(required=false) Set<String> attribute,
@RequestParam(required=false) Set<String> filter,
@RequestParam String ou,
- @RequestParam(required=false, defaultValue=DimensionalObject.OU_MODE_SELECTED) String ouMode,
+ @RequestParam(required=false) OrganisationUnitSelectionMode ouMode,
@RequestParam(required=false) String program,
@RequestParam(required=false) String trackedEntity,
@RequestParam(required=false) Integer page,
@@ -126,7 +126,7 @@
@RequestParam(required=false) Set<String> attribute,
@RequestParam(required=false) Set<String> filter,
@RequestParam String ou,
- @RequestParam(required=false, defaultValue=DimensionalObject.OU_MODE_SELECTED) String ouMode,
+ @RequestParam(required=false) OrganisationUnitSelectionMode ouMode,
@RequestParam(required=false) String program,
@RequestParam(required=false) String trackedEntity,
@RequestParam(required=false) Integer page,
@@ -148,7 +148,7 @@
@RequestParam(required=false) Set<String> attribute,
@RequestParam(required=false) Set<String> filter,
@RequestParam String ou,
- @RequestParam(required=false, defaultValue=DimensionalObject.OU_MODE_SELECTED) String ouMode,
+ @RequestParam(required=false) OrganisationUnitSelectionMode ouMode,
@RequestParam(required=false) String program,
@RequestParam(required=false) String trackedEntity,
@RequestParam(required=false) Integer page,