dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27704
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13793: minor update to DataElementGroupController, get all operands (including generated)
------------------------------------------------------------
revno: 13793
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-21 13:46:30 +0700
message:
minor update to DataElementGroupController, get all operands (including generated)
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.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-18 15:47:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java 2014-01-21 06:46:30 +0000
@@ -38,9 +38,9 @@
import org.hisp.dhis.common.PagerUtils;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataelement.DataElementOperandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -52,7 +52,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -69,10 +68,10 @@
public static final String RESOURCE_PATH = "/dataElementGroups";
@Autowired
- private DataElementOperandService dataElementOperandService;
+ private DataElementCategoryService dataElementCategoryService;
- @RequestMapping( value = "/{uid}/members", method = RequestMethod.GET )
- public String getMembers( @PathVariable( "uid" ) String uid, @RequestParam Map<String, String> parameters,
+ @RequestMapping(value = "/{uid}/members", method = RequestMethod.GET)
+ public String getMembers( @PathVariable("uid") String uid, @RequestParam Map<String, String> parameters,
Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
WebOptions options = new WebOptions( parameters );
@@ -108,8 +107,8 @@
return StringUtils.uncapitalize( getEntitySimpleName() );
}
- @RequestMapping( value = "/{uid}/members/query/{q}", method = RequestMethod.GET )
- public String getMembersByQuery( @PathVariable( "uid" ) String uid, @PathVariable( "q" ) String q,
+ @RequestMapping(value = "/{uid}/members/query/{q}", method = RequestMethod.GET)
+ public String getMembersByQuery( @PathVariable("uid") String uid, @PathVariable("q") String q,
@RequestParam Map<String, String> parameters, Model model, HttpServletRequest request,
HttpServletResponse response ) throws Exception
{
@@ -155,8 +154,8 @@
return StringUtils.uncapitalize( getEntitySimpleName() );
}
- @RequestMapping( value = "/{uid}/operands", method = RequestMethod.GET )
- public String getOperands( @PathVariable( "uid" ) String uid, @RequestParam Map<String, String> parameters,
+ @RequestMapping(value = "/{uid}/operands", method = RequestMethod.GET)
+ public String getOperands( @PathVariable("uid") String uid, @RequestParam Map<String, String> parameters,
Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
WebOptions options = new WebOptions( parameters );
@@ -169,7 +168,7 @@
}
WebMetaData metaData = new WebMetaData();
- List<DataElementOperand> dataElementOperands = Lists.newArrayList( dataElementOperandService.getDataElementOperandByDataElementGroup( dataElementGroup ) );
+ List<DataElementOperand> dataElementOperands = Lists.newArrayList( dataElementCategoryService.getOperands( dataElementGroup.getMembers() ) );
metaData.setDataElementOperands( dataElementOperands );
@@ -193,8 +192,8 @@
return StringUtils.uncapitalize( getEntitySimpleName() );
}
- @RequestMapping( value = "/{uid}/operands/query/{q}", method = RequestMethod.GET )
- public String getOperandsByQuery( @PathVariable( "uid" ) String uid, @PathVariable( "q" ) String q,
+ @RequestMapping(value = "/{uid}/operands/query/{q}", method = RequestMethod.GET)
+ public String getOperandsByQuery( @PathVariable("uid") String uid, @PathVariable("q") String q,
@RequestParam Map<String, String> parameters, Model model, HttpServletRequest request,
HttpServletResponse response ) throws Exception
{
@@ -210,7 +209,7 @@
WebMetaData metaData = new WebMetaData();
List<DataElementOperand> dataElementOperands = Lists.newArrayList();
- for ( DataElementOperand dataElementOperand : dataElementOperandService.getDataElementOperandByDataElementGroup( dataElementGroup ) )
+ for ( DataElementOperand dataElementOperand : dataElementCategoryService.getOperands( dataElementGroup.getMembers() ) )
{
if ( dataElementOperand.getDisplayName().toLowerCase().contains( q.toLowerCase() ) )
{