← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16397: set dataElementCount for programs in FormUtils

 

------------------------------------------------------------
revno: 16397
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-08-13 17:40:43 +0700
message:
  set dataElementCount for programs in FormUtils
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.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/webapi/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java	2014-07-22 17:57:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java	2014-08-13 10:40:43 +0000
@@ -166,6 +166,7 @@
 
                 Group group = new Group();
                 group.setLabel( section.getDisplayName() );
+                group.setDataElementCount( section.getProgramStageDataElements().size() );
                 group.setFields( fields );
                 form.getGroups().add( group );
             }
@@ -173,11 +174,12 @@
         else
         {
             List<Field> fields = inputsFromProgramStageDataElements(
-                new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() ) );
+                new ArrayList<>( programStage.getProgramStageDataElements() ) );
 
             Group group = new Group();
             group.setLabel( "default" );
             group.setFields( fields );
+            group.setDataElementCount( programStage.getProgramStageDataElements().size() );
             form.getGroups().add( group );
         }
 
@@ -186,7 +188,7 @@
 
     private static List<Field> inputsFromProgramStageDataElements( List<ProgramStageDataElement> programStageDataElements )
     {
-        List<DataElement> dataElements = new ArrayList<DataElement>();
+        List<DataElement> dataElements = new ArrayList<>();
 
         for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
         {
@@ -203,7 +205,7 @@
 
     private static List<Field> inputsFromDataElements( List<DataElement> dataElements, final List<DataElementOperand> greyedFields )
     {
-        List<Field> fields = new ArrayList<Field>();
+        List<Field> fields = new ArrayList<>();
 
         for ( DataElement dataElement : dataElements )
         {
@@ -331,7 +333,7 @@
 
     private static Map<String, Field> buildCacheMap( Form form )
     {
-        Map<String, Field> cacheMap = new HashMap<String, Field>();
+        Map<String, Field> cacheMap = new HashMap<>();
 
         for ( Group group : form.getGroups() )
         {