← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13649: switched to using meta-data class for dataElementGroup/indicatorGroup members, this changes the f...

 

------------------------------------------------------------
revno: 13649
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-08 12:05:36 +0100
message:
  switched to using meta-data class for dataElementGroup/indicatorGroup members, this changes the format, and anyone using it must change their code
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


--
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	2013-08-23 16:00:30 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java	2014-01-08 11:05:36 +0000
@@ -28,12 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.google.common.collect.Lists;
 import org.hisp.dhis.api.controller.AbstractCrudController;
 import org.hisp.dhis.api.controller.WebOptions;
 import org.hisp.dhis.api.utils.ContextUtils;
 import org.hisp.dhis.api.utils.WebUtils;
-import org.hisp.dhis.api.webdomain.DataElementList;
 import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dxf2.metadata.MetaData;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.util.StringUtils;
@@ -56,8 +57,8 @@
 {
     public static final String RESOURCE_PATH = "/dataElementGroups";
 
-    @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 );
@@ -69,16 +70,15 @@
             return null;
         }
 
-        DataElementList dataElementList = new DataElementList();
-        dataElementList.setMembers( dataElementGroup.getMembers() );
+        MetaData metaData = new MetaData();
+        metaData.setDataElements( Lists.newArrayList( dataElementGroup.getMembers() ) );
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( dataElementGroup );
-            WebUtils.generateLinks( dataElementList );
+            WebUtils.generateLinks( metaData );
         }
 
-        model.addAttribute( "model", dataElementList );
+        model.addAttribute( "model", metaData );
         model.addAttribute( "viewClass", options.getViewClass( "detailed" ) );
 
         return StringUtils.uncapitalize( getEntitySimpleName() );

=== 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	2013-08-23 16:00:30 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java	2014-01-08 11:05:36 +0000
@@ -28,11 +28,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.google.common.collect.Lists;
 import org.hisp.dhis.api.controller.AbstractCrudController;
 import org.hisp.dhis.api.controller.WebOptions;
 import org.hisp.dhis.api.utils.ContextUtils;
 import org.hisp.dhis.api.utils.WebUtils;
-import org.hisp.dhis.api.webdomain.IndicatorList;
+import org.hisp.dhis.dxf2.metadata.MetaData;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -50,7 +51,7 @@
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Controller
-@RequestMapping(value = IndicatorGroupController.RESOURCE_PATH)
+@RequestMapping( value = IndicatorGroupController.RESOURCE_PATH )
 public class IndicatorGroupController
     extends AbstractCrudController<IndicatorGroup>
 {
@@ -69,16 +70,15 @@
             return null;
         }
 
-        IndicatorList indicatorList = new IndicatorList();
-        indicatorList.setMembers( indicatorGroup.getMembers() );
+        MetaData metaData = new MetaData();
+        metaData.setIndicators( Lists.newArrayList( indicatorGroup.getMembers() ) );
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( indicatorGroup );
-            WebUtils.generateLinks( indicatorList );
+            WebUtils.generateLinks( metaData );
         }
 
-        model.addAttribute( "model", indicatorList );
+        model.addAttribute( "model", metaData );
         model.addAttribute( "viewClass", options.getViewClass( "detailed" ) );
 
         return StringUtils.uncapitalize( getEntitySimpleName() );