← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8453: renamed some fields on the Form class

 

------------------------------------------------------------
revno: 8453
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-09 16:07:37 +0200
message:
  renamed some fields on the Form class
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java
added:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Group.java
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.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/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java	2012-10-08 19:51:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java	2012-10-09 14:07:37 +0000
@@ -30,10 +30,11 @@
 import org.hisp.dhis.api.webdomain.form.Field;
 import org.hisp.dhis.api.webdomain.form.Form;
 import org.hisp.dhis.api.webdomain.form.InputType;
-import org.hisp.dhis.api.webdomain.form.Section;
+import org.hisp.dhis.api.webdomain.form.Group;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.Section;
 import org.hisp.dhis.datavalue.DataValue;
 
 import java.util.*;
@@ -46,26 +47,26 @@
     public static Form fromDataSet( DataSet dataSet )
     {
         Form form = new Form();
-        form.setName( dataSet.getName() );
+        form.setLabel( dataSet.getName() );
         form.setPeriod( dataSet.getPeriodType().getIsoFormat() );
 
         if ( dataSet.getSections().size() > 0 )
         {
-            for ( org.hisp.dhis.dataset.Section section : dataSet.getSections() )
+            for ( Section section : dataSet.getSections() )
             {
-                Section s = new Section();
-                s.setName( section.getName() );
+                Group s = new Group();
+                s.setLabel( section.getName() );
                 s.setFields( inputsFromDataElements( section.getDataElements() ) );
-                form.getSections().add( s );
+                form.getGroups().add( s );
             }
         }
         else
         {
-            Section s = new Section();
-            s.setName( "default" );
+            Group s = new Group();
+            s.setLabel( "default" );
             s.setFields( inputsFromDataElements( dataSet.getDataElements() ) );
 
-            form.getSections().add( s );
+            form.getGroups().add( s );
         }
 
         return form;
@@ -81,7 +82,7 @@
             {
                 Field field = new Field();
 
-                field.setName( dataElement.getName() );
+                field.setLabel( dataElement.getName() );
                 field.setDataElement( dataElement.getUid() );
                 field.setCategoryOptionCombo( dataElement.getCategoryCombo().getSortedOptionCombos().get( 0 ).getUid() );
                 field.setType( inputTypeFromDataElement( dataElement ) );
@@ -94,7 +95,7 @@
                 {
                     Field field = new Field();
 
-                    field.setName( dataElement.getName() + " " + categoryOptionCombo.getName() );
+                    field.setLabel( dataElement.getName() + " " + categoryOptionCombo.getName() );
                     field.setDataElement( dataElement.getUid() );
                     field.setCategoryOptionCombo( categoryOptionCombo.getUid() );
                     field.setType( inputTypeFromDataElement( dataElement ) );
@@ -176,9 +177,9 @@
     {
         Map<String, Field> cacheMap = new HashMap<String, Field>();
 
-        for ( Section section : form.getSections() )
+        for ( Group group : form.getGroups() )
         {
-            for ( Field field : section.getFields() )
+            for ( Field field : group.getFields() )
             {
                 cacheMap.put( field.getDataElement() + "-" + field.getCategoryOptionCombo(), field );
             }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java	2012-10-08 17:42:51 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java	2012-10-09 14:07:37 +0000
@@ -38,7 +38,7 @@
 @JacksonXmlRootElement( localName = "field", namespace = Dxf2Namespace.NAMESPACE )
 public class Field
 {
-    private String name;
+    private String label;
 
     private String dataElement;
 
@@ -54,14 +54,14 @@
 
     @JsonProperty
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
-    public String getName()
+    public String getLabel()
     {
-        return name;
+        return label;
     }
 
-    public void setName( String name )
+    public void setLabel( String label )
     {
-        this.name = name;
+        this.label = label;
     }
 
     @JsonProperty

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.java	2012-10-08 19:51:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.java	2012-10-09 14:07:37 +0000
@@ -42,11 +42,11 @@
 @JacksonXmlRootElement( localName = "form", namespace = Dxf2Namespace.NAMESPACE )
 public class Form
 {
-    private String name;
+    private String label;
 
     private String period;
 
-    private List<Section> sections = new ArrayList<Section>();
+    private List<Group> groups = new ArrayList<Group>();
 
     public Form()
     {
@@ -54,14 +54,14 @@
 
     @JsonProperty
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
-    public String getName()
+    public String getLabel()
     {
-        return name;
+        return label;
     }
 
-    public void setName( String name )
+    public void setLabel( String label )
     {
-        this.name = name;
+        this.label = label;
     }
 
     @JsonProperty
@@ -77,25 +77,25 @@
     }
 
     @JsonProperty
-    @JacksonXmlElementWrapper( localName = "sections", namespace = Dxf2Namespace.NAMESPACE )
-    @JacksonXmlProperty( localName = "section", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Section> getSections()
+    @JacksonXmlElementWrapper( localName = "groups", namespace = Dxf2Namespace.NAMESPACE )
+    @JacksonXmlProperty( localName = "group", namespace = Dxf2Namespace.NAMESPACE )
+    public List<Group> getGroups()
     {
-        return sections;
+        return groups;
     }
 
-    public void setSections( List<Section> sections )
+    public void setGroups( List<Group> groups )
     {
-        this.sections = sections;
+        this.groups = groups;
     }
 
     @Override
     public String toString()
     {
         return "Form{" +
-            "name='" + name + '\'' +
+            "name='" + label + '\'' +
             ", period='" + period + '\'' +
-            ", sections=" + sections +
+            ", groups=" + groups +
             '}';
     }
 }

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Group.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Group.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Group.java	2012-10-09 14:07:37 +0000
@@ -0,0 +1,77 @@
+package org.hisp.dhis.api.webdomain.form;
+
+/*
+* Copyright (c) 2004-2012, University of Oslo
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright notice, this
+*   list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright notice,
+*   this list of conditions and the following disclaimer in the documentation
+*   and/or other materials provided with the distribution.
+* * Neither the name of the HISP project nor the names of its contributors may
+*   be used to endorse or promote products derived from this software without
+*   specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.Dxf2Namespace;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JacksonXmlRootElement( localName = "section", namespace = Dxf2Namespace.NAMESPACE )
+public class Group
+{
+    private String label;
+
+    private List<Field> fields = new ArrayList<Field>();
+
+    public Group()
+    {
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public void setLabel( String label )
+    {
+        this.label = label;
+    }
+
+    @JsonProperty
+    @JacksonXmlElementWrapper( localName = "fields", namespace = Dxf2Namespace.NAMESPACE )
+    @JacksonXmlProperty( localName = "field", namespace = Dxf2Namespace.NAMESPACE )
+    public List<Field> getFields()
+    {
+        return fields;
+    }
+
+    public void setFields( List<Field> fields )
+    {
+        this.fields = fields;
+    }
+}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java	2012-10-08 17:42:51 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java	1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
-package org.hisp.dhis.api.webdomain.form;
-
-/*
-* Copyright (c) 2004-2012, University of Oslo
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright notice, this
-*   list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright notice,
-*   this list of conditions and the following disclaimer in the documentation
-*   and/or other materials provided with the distribution.
-* * Neither the name of the HISP project nor the names of its contributors may
-*   be used to endorse or promote products derived from this software without
-*   specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import org.hisp.dhis.common.Dxf2Namespace;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@JacksonXmlRootElement( localName = "section", namespace = Dxf2Namespace.NAMESPACE )
-public class Section
-{
-    private String name;
-
-    private List<Field> fields = new ArrayList<Field>();
-
-    public Section()
-    {
-    }
-
-    @JsonProperty
-    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    @JsonProperty
-    @JacksonXmlElementWrapper( localName = "fields", namespace = Dxf2Namespace.NAMESPACE )
-    @JacksonXmlProperty( localName = "field", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Field> getFields()
-    {
-        return fields;
-    }
-
-    public void setFields( List<Field> fields )
-    {
-        this.fields = fields;
-    }
-}