dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31696
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16194: Web api, forms, allowing for empty sections
------------------------------------------------------------
revno: 16194
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-07-21 10:59:35 +0200
message:
Web api, forms, allowing for empty sections
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-07 02:11:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java 2014-07-21 08:59:35 +0000
@@ -33,6 +33,7 @@
import org.hisp.dhis.webapi.webdomain.form.Group;
import org.hisp.dhis.webapi.webdomain.form.InputType;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataset.DataSet;
@@ -76,26 +77,20 @@
{
List<Field> fields = inputsFromDataElements( new ArrayList<DataElement>( section.getDataElements() ), new ArrayList<DataElementOperand>( section.getGreyedFields() ) );
- if ( !fields.isEmpty() )
- {
- Group s = new Group();
- s.setLabel( section.getDisplayName() );
- s.setFields( fields );
- form.getGroups().add( s );
- }
+ Group s = new Group();
+ s.setLabel( section.getDisplayName() );
+ s.setFields( fields );
+ form.getGroups().add( s );
}
}
else
{
List<Field> fields = inputsFromDataElements( new ArrayList<DataElement>( dataSet.getDataElements() ) );
- if ( !fields.isEmpty() )
- {
- Group s = new Group();
- s.setLabel( "default" );
- s.setFields( fields );
- form.getGroups().add( s );
- }
+ Group s = new Group();
+ s.setLabel( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
+ s.setFields( fields );
+ form.getGroups().add( s );
}
return form;
@@ -149,13 +144,10 @@
{
List<Field> fields = inputsFromProgramStageDataElements( section.getProgramStageDataElements() );
- if ( !fields.isEmpty() )
- {
- Group s = new Group();
- s.setLabel( section.getDisplayName() );
- s.setFields( fields );
- form.getGroups().add( s );
- }
+ Group s = new Group();
+ s.setLabel( section.getDisplayName() );
+ s.setFields( fields );
+ form.getGroups().add( s );
}
}
else
@@ -163,13 +155,10 @@
List<Field> fields = inputsFromProgramStageDataElements(
new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() ) );
- if ( !fields.isEmpty() )
- {
- Group s = new Group();
- s.setLabel( "default" );
- s.setFields( fields );
- form.getGroups().add( s );
- }
+ Group s = new Group();
+ s.setLabel( "default" );
+ s.setFields( fields );
+ form.getGroups().add( s );
}
return form;