← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2752: Removed the dataset version handling in SaveSectionSortOrderAction, would have been nice to have ...

 

------------------------------------------------------------
revno: 2752
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-01-25 22:25:39 +0100
message:
  Removed the dataset version handling in SaveSectionSortOrderAction, would have been nice to have a decent implementation of this
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm


--
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-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java	2011-01-25 20:50:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java	2011-01-25 21:25:39 +0000
@@ -43,16 +43,6 @@
     implements Action
 {
     // -------------------------------------------------------------------------
-    // Variables
-    // -------------------------------------------------------------------------
-
-    private Integer dataSetId;
-
-    private String sectionName;
-
-    private List<String> selectedList = new ArrayList<String>();
-
-    // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
@@ -81,16 +71,22 @@
     // Input
     // -------------------------------------------------------------------------
 
+    private Integer dataSetId;
+
     public void setDataSetId( Integer dataSetId )
     {
         this.dataSetId = dataSetId;
     }
 
+    private String sectionName;
+
     public void setSectionName( String sectionName )
     {
         this.sectionName = sectionName;
     }
 
+    private List<String> selectedList = new ArrayList<String>();
+
     public void setSelectedList( List<String> selectedList )
     {
         this.selectedList = selectedList;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java	2010-12-26 15:38:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java	2011-01-25 21:25:39 +0000
@@ -90,71 +90,55 @@
     }
 
     // -------------------------------------------------------------------------
-    // Input & output
+    // Input
     // -------------------------------------------------------------------------
 
     private Integer sectionId;
 
-    private Section section;
-
-    private DataSet dataSet;
-
-    private DataElementCategoryCombo categoryCombo;
-
-    private List<DataElement> dataElementOfDataSet = new ArrayList<DataElement>();
-
-    private List<DataElementGroup> dataElementGroups;
-
     public Integer getSectionId()
     {
         return sectionId;
     }
-
+    
     public void setSectionId( Integer sectionId )
     {
         this.sectionId = sectionId;
     }
 
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private Section section;
+
     public Section getSection()
     {
         return section;
     }
 
-    public void setSection( Section section )
-    {
-        this.section = section;
-    }
-
-    public List<DataElement> getDataElementOfDataSet()
-    {
-        return dataElementOfDataSet;
-    }
-
-    public void setDataElementOfDataSet( List<DataElement> dataElementOfDataSet )
-    {
-        this.dataElementOfDataSet = dataElementOfDataSet;
-    }
+    private DataSet dataSet;
 
     public DataSet getDataSet()
     {
         return dataSet;
     }
 
-    public void setDataSet( DataSet dataSet )
-    {
-        this.dataSet = dataSet;
-    }
-
-    public void setCategoryCombo( DataElementCategoryCombo categoryCombo )
-    {
-        this.categoryCombo = categoryCombo;
-    }
+    private DataElementCategoryCombo categoryCombo;
 
     public DataElementCategoryCombo getCategoryCombo()
     {
         return categoryCombo;
     }
 
+    private List<DataElement> dataElementOfDataSet;
+
+    public List<DataElement> getDataElementOfDataSet()
+    {
+        return dataElementOfDataSet;
+    }
+
+    private List<DataElementGroup> dataElementGroups;
+
     public List<DataElementGroup> getDataElementGroups()
     {
         return dataElementGroups;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java	2010-08-19 07:52:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java	2011-01-25 21:25:39 +0000
@@ -127,14 +127,14 @@
         return orderedCategories;
     }
 
-    Map<Integer, Collection<Integer>> colRepeat = new HashMap<Integer, Collection<Integer>>();
+    private Map<Integer, Collection<Integer>> colRepeat = new HashMap<Integer, Collection<Integer>>();
 
     public Map<Integer, Collection<Integer>> getColRepeat()
     {
         return colRepeat;
     }
 
-    Collection<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>();
+    private Collection<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>();
 
     public Collection<DataElementCategoryOptionCombo> getOptionCombos()
     {
@@ -154,19 +154,19 @@
     {
         return greyedFields;
     }
-    
+
     private Integer defaultOptionComboId;
-    
-    public Integer getDefaultOptionComboId() 
+
+    public Integer getDefaultOptionComboId()
     {
-		return defaultOptionComboId;
-	}	
+        return defaultOptionComboId;
+    }
 
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------    
 
-	public String execute()
+    public String execute()
         throws Exception
     {
         section = sectionService.getSection( sectionId.intValue() );
@@ -230,5 +230,4 @@
 
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java	2010-12-22 04:05:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java	2011-01-25 21:25:39 +0000
@@ -29,8 +29,6 @@
 
 import java.util.List;
 
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.dataset.Section;
 import org.hisp.dhis.dataset.SectionService;
 
@@ -38,7 +36,6 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class SaveSectionSortOrderAction
     implements Action
@@ -57,21 +54,12 @@
         this.sections = sections;
     }
     
-    private DataSetService dataSetService;
-
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-
     @Override
     public String execute()
         throws Exception
     {
         int sortOrder = 1;
         
-        DataSet dataSet = null;
-        
         for ( String id : sections )
         {
             Section section = sectionService.getSection( Integer.parseInt( id ) );
@@ -79,15 +67,7 @@
             section.setSortOrder( sortOrder++ );
             
             sectionService.updateSection( section );
-            
-            if(dataSet == null)
-                dataSet = section.getDataSet();
-        }
-        if(dataSet.getMobile() != null && dataSet.getMobile()){
-            dataSet.setVersion( dataSet.getVersion() + 1 );
-            dataSetService.updateDataSet( dataSet );
-        }
-        dataSet = null;
+        }
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java	2011-01-25 20:50:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java	2011-01-25 21:25:39 +0000
@@ -66,26 +66,27 @@
     {
         this.dataSetService = dataSetService;
     }
+    
     // -------------------------------------------------------------------------
-    // Input & output
+    // Input
     // -------------------------------------------------------------------------
 
     private Integer sectionId;
 
-    private String sectionName;
-
-    private List<String> selectedList;
-
     public void setSectionId( Integer sectionId )
     {
         this.sectionId = sectionId;
     }
 
+    private String sectionName;
+
     public void setSectionName( String sectionName )
     {
         this.sectionName = sectionName;
     }
 
+    private List<String> selectedList = new ArrayList<String>();
+
     public void setSelectedList( List<String> selectedList )
     {
         this.selectedList = selectedList;
@@ -102,17 +103,12 @@
 
         Section section = sectionService.getSection( sectionId.intValue() );
 
-        if ( selectedList == null )
-        {
-            selectedList = new ArrayList<String>();
-        }
-
         for ( String id : selectedList )
         {
             DataElement d = dataElementService.getDataElement( Integer.parseInt( id ) );
             dataElements.add( d );
         }
-
+        
         section.setDataElements( dataElements );
         section.setName( sectionName );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2011-01-20 05:24:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2011-01-25 21:25:39 +0000
@@ -145,9 +145,6 @@
 		<property name="sectionService">
 			<ref bean="org.hisp.dhis.dataset.SectionService"/>
 		</property>
-		<property name="dataSetService">
-			<ref bean="org.hisp.dhis.dataset.DataSetService"/>
-		</property>
 	</bean>
 	
 	<bean id="org.hisp.dhis.dataset.action.section.GetSectionListSortOrderAction"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm	2011-01-25 20:50:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm	2011-01-25 21:25:39 +0000
@@ -86,7 +86,6 @@
 	  
       <tr>
         <td>
-          <!-- List of all available DataElements -->
           <select size="15" id="availableList" name="availableList" multiple="multiple" style="min-width:25em;height:20em" ondblclick="moveSelected( this, byId( 'selectedList' ) )">
             #foreach ( $availableDataElement in $dataElementOfDataSet )
               <option value="$availableDataElement.id"> $availableDataElement.name</option>