dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27662
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13771: Web API, sorting of members in data element, indicator and org unit group
------------------------------------------------------------
revno: 13771
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-01-18 16:47:24 +0100
message:
Web API, sorting of members in data element, indicator and org unit group
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java 2014-01-09 16:15:50 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java 2014-01-18 15:47:24 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.api.utils.WebUtils;
import org.hisp.dhis.common.Pager;
import org.hisp.dhis.common.PagerUtils;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementOperand;
@@ -51,6 +52,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -81,7 +85,8 @@
}
WebMetaData metaData = new WebMetaData();
- List<DataElement> dataElements = Lists.newArrayList( dataElementGroup.getMembers() );
+ List<DataElement> dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
+ Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE );
if ( options.hasPaging() )
{
@@ -118,9 +123,11 @@
}
WebMetaData metaData = new WebMetaData();
- List<DataElement> dataElements = Lists.newArrayList();
+ List<DataElement> dataElements = new ArrayList<DataElement>();
+ List<DataElement> members = new ArrayList<DataElement>( dataElementGroup.getMembers() );
+ Collections.sort( members, IdentifiableObjectNameComparator.INSTANCE );
- for ( DataElement dataElement : dataElementGroup.getMembers() )
+ for ( DataElement dataElement : members )
{
if ( dataElement.getDisplayName().toLowerCase().contains( q.toLowerCase() ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java 2014-01-09 15:03:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java 2014-01-18 15:47:24 +0000
@@ -28,7 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.api.controller.AbstractCrudController;
import org.hisp.dhis.api.controller.WebMetaData;
import org.hisp.dhis.api.controller.WebOptions;
@@ -36,6 +43,7 @@
import org.hisp.dhis.api.utils.WebUtils;
import org.hisp.dhis.common.Pager;
import org.hisp.dhis.common.PagerUtils;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.springframework.stereotype.Controller;
@@ -46,11 +54,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.Map;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -75,8 +78,9 @@
}
WebMetaData metaData = new WebMetaData();
- List<Indicator> indicators = Lists.newArrayList( indicatorGroup.getMembers() );
-
+ List<Indicator> indicators = new ArrayList<Indicator>( indicatorGroup.getMembers() );
+ Collections.sort( indicators, IdentifiableObjectNameComparator.INSTANCE );
+
if ( options.hasPaging() )
{
Pager pager = new Pager( options.getPage(), indicators.size(), options.getPageSize() );
@@ -112,9 +116,11 @@
}
WebMetaData metaData = new WebMetaData();
- List<Indicator> indicators = Lists.newArrayList();
+ List<Indicator> indicators = new ArrayList<Indicator>();
+ List<Indicator> members = new ArrayList<Indicator>( indicatorGroup.getMembers() );
+ Collections.sort( members, IdentifiableObjectNameComparator.INSTANCE );
- for ( Indicator indicator : indicatorGroup.getMembers() )
+ for ( Indicator indicator : members )
{
if ( indicator.getDisplayName().toLowerCase().contains( q.toLowerCase() ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.java 2014-01-09 15:03:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.java 2014-01-18 15:47:24 +0000
@@ -28,7 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.api.controller.AbstractCrudController;
import org.hisp.dhis.api.controller.WebMetaData;
import org.hisp.dhis.api.controller.WebOptions;
@@ -36,6 +43,7 @@
import org.hisp.dhis.api.utils.WebUtils;
import org.hisp.dhis.common.Pager;
import org.hisp.dhis.common.PagerUtils;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -52,11 +60,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.Map;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -95,7 +98,8 @@
}
WebMetaData metaData = new WebMetaData();
- List<OrganisationUnit> organisationUnits = Lists.newArrayList( organisationUnitGroup.getMembers() );
+ List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( organisationUnitGroup.getMembers() );
+ Collections.sort( organisationUnits, IdentifiableObjectNameComparator.INSTANCE );
if ( options.hasPaging() )
{
@@ -132,9 +136,11 @@
}
WebMetaData metaData = new WebMetaData();
- List<OrganisationUnit> organisationUnits = Lists.newArrayList();
+ List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
+ List<OrganisationUnit> members = new ArrayList<OrganisationUnit>();
+ Collections.sort( members, IdentifiableObjectNameComparator.INSTANCE );
- for ( OrganisationUnit organisationUnit : organisationUnitGroup.getMembers() )
+ for ( OrganisationUnit organisationUnit : members )
{
if ( organisationUnit.getDisplayName().toLowerCase().contains( q.toLowerCase() ) )
{