← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14010: Fixed bug - Error when to update a CategoryOptionGroupSet object.

 

------------------------------------------------------------
revno: 14010
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-02-13 19:51:37 +0700
message:
  Fixed bug - Error when to update a CategoryOptionGroupSet object.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/categoryOptionGroup.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.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-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java	2014-02-13 09:51:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java	2014-02-13 12:51:37 +0000
@@ -89,6 +89,35 @@
     // -------------------------------------------------------------------------
     // Logic
     // -------------------------------------------------------------------------
+  
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+            return true;
+        if ( !super.equals( obj ) )
+            return false;
+        if ( getClass() != obj.getClass() )
+            return false;
+        CategoryOptionGroup other = (CategoryOptionGroup) obj;
+        if ( name == null )
+        {
+            if ( other.name != null )
+                return false;
+        }
+        else if ( !name.equals( other.name ) )
+            return false;
+        return true;
+    }
 
     public void addCategoryOption( DataElementCategoryOption categoryOption )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupListAction.java	2014-02-13 09:51:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupListAction.java	2014-02-13 12:51:37 +0000
@@ -30,6 +30,7 @@
 import static org.apache.commons.lang.StringUtils.isNotBlank;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
@@ -88,17 +89,20 @@
         if ( isNotBlank( key ) ) // Filter on key only if set
         {
             this.paging = createPaging( categoryOptionGroupService.getCategoryOptionGroupCountByName( key ) );
-
-            categoryOptionGroups = new ArrayList<CategoryOptionGroup>(
-                categoryOptionGroupService.getCategoryOptionGroupsBetweenByName( key, paging.getStartPos(),
-                    paging.getPageSize() ) );
+           
+            Collection<CategoryOptionGroup> groups = categoryOptionGroupService.getCategoryOptionGroupsBetweenByName(
+                key, paging.getStartPos(), paging.getPageSize() );
+            
+            categoryOptionGroups.addAll( groups );
         }
         else
         {
             this.paging = createPaging( categoryOptionGroupService.getCategoryOptionGroupCount() );
-
-            categoryOptionGroups = new ArrayList<CategoryOptionGroup>( categoryOptionGroupService.getCategoryOptionGroupsBetween(
-                paging.getStartPos(), paging.getPageSize() ) );
+            
+            Collection<CategoryOptionGroup> groups = categoryOptionGroupService.getCategoryOptionGroupsBetween(
+                paging.getStartPos(), paging.getPageSize() );
+            
+            categoryOptionGroups.addAll( groups );
         }
 
         Collections.sort( categoryOptionGroups, IdentifiableObjectNameComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java	2014-02-13 12:09:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java	2014-02-13 12:51:37 +0000
@@ -107,6 +107,7 @@
         categoryOptionGroupSet.setDescription( description );
         categoryOptionGroupSet.setDataDimension( dataDimension );
 
+        categoryOptionGroupSet.getMembers().clear();
         for ( String id : groupMembers )
         {
             categoryOptionGroupSet.addCategoryOptionGroup( categoryOptionGroupService.getCategoryOptionGroup( Integer

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm	2014-02-13 09:51:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm	2014-02-13 12:51:37 +0000
@@ -1,6 +1,6 @@
 <script type="text/javascript">
 	jQuery(function() {
-        validation2('addCategoryOptionGroupForm', function ( form ) {
+        validation('addCategoryOptionGroupForm', function ( form ) {
             form.submit();
         },function(){
 			selectAllById('groupMembers');
@@ -86,7 +86,7 @@
 
 <p>
 	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
-	<input type="button" value="$i18n.getString( 'cancel' )" onclick="dhis2.commons.redirectCurrentPage( 'dataElementGroup.action' )" style="width:10em"/>
+	<input type="button" value="$i18n.getString( 'cancel' )" onclick="dhis2.commons.redirectCurrentPage( 'categoryOptionGroup.action' )" style="width:10em"/>
 </p>
 
 </form>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/categoryOptionGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/categoryOptionGroup.vm	2014-02-13 09:51:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/categoryOptionGroup.vm	2014-02-13 12:51:37 +0000
@@ -1,15 +1,14 @@
-
 <script type="text/javascript">
 	jQuery(document).ready(function(){
 		tableSorter( 'categoryOptionGroupList' );	
 	});
 
-	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_catergory_option_group" ) , "'")';
+	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_category_option_group" ) , "'")';
 	var i18n_adding_catergory_option_group_failed = '$encoder.jsEscape( $i18n.getString( "adding_catergory_option_group_failed" ) , "'")';
 	var	i18n_saving_catergory_option_group_failed = '$encoder.jsEscape( $i18n.getString( "saving_catergory_option_group_failed" ) , "'")';
 </script>
 
-<h3>$i18n.getString( "catergory_option_group_management" )</h3>
+<h3>$i18n.getString( "category_option_group_management" )</h3>
 
 <div id="contextMenu" class="contextMenu">
   <ul id="contextMenuItems" class="contextMenuItems">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm	2014-02-13 09:51:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm	2014-02-13 12:51:37 +0000
@@ -5,8 +5,9 @@
 	#introListImgItem( "dataElementGroup.action" "data_element_group" "dataelement" )
     #introListImgItem( "dataElementGroupEditor.action" "data_element_group_editor" "dataelement" )
     #introListImgItem( "dataElementGroupSet.action" "data_element_group_set" "groupset" )
-    #introListImgItem( "categoryOption.action" "category_option_group" "category" )
-    #introListImgItem( "categoryOptionGroup.action" "ategory_option_group" "category" )
+    #introListImgItem( "categoryOption.action" "data_element_category_option" "category" )
+    #introListImgItem( "categoryOptionGroup.action" "data_element_category_option_group" "category" )
+    #introListImgItem( "categoryOptionGroupSet.action" "data_element_category_option_group_set" "category" )
     #introListImgItem( "category.action" "data_element_category" "category" )
     #introListImgItem( "categoryCombo.action" "data_element_category_combo" "category" )
     #introListImgItem( "dataDictionary.action" "data_dictionary" "datadictionary" )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm	2014-02-13 09:51:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm	2014-02-13 12:51:37 +0000
@@ -7,6 +7,7 @@
 	<li><a href="dataElementGroupSet.action">$i18n.getString( "data_element_group_set" )&nbsp;</a></li>
     <li><a href="categoryOption.action">$i18n.getString( "category_option" )&nbsp;</a></li>
     <li><a href="categoryOptionGroup.action">$i18n.getString( "category_option_group" )&nbsp;</a></li>
+    <li><a href="categoryOptionGroupSet.action">$i18n.getString( "category_option_group_set" )&nbsp;</a></li>
     <li><a href="category.action">$i18n.getString( "category" )&nbsp;</a></li>
     <li><a href="categoryCombo.action">$i18n.getString( "category_combination" )&nbsp;</a></li>
     <li><a href="dataDictionary.action">$i18n.getString( "data_dictionary" )&nbsp;</a></li>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm	2014-02-13 09:51:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm	2014-02-13 12:51:37 +0000
@@ -57,11 +57,11 @@
 	</tr>
 	<tr>
 		<td><label for="shortName">$i18n.getString( "short_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="shortName" name="shortName" value="$!encoder.htmlEncode( $categoryOptionGroup.shortName )"></td>
+		<td><input type="text" id="shortName" name="shortName" class="{validate:{required:true}}"  value="$!encoder.htmlEncode( $categoryOptionGroup.shortName )"></td>
 	</tr>
 	<tr>
 		<td><label for="code">$i18n.getString( "code" )</label></td>
-		<td><input type="text" id="code" name="code" class="{validate:{required:true}}" value="$!encoder.htmlEncode( $categoryOptionGroup.code )"></td>
+		<td><input type="text" id="code" name="code" value="$!encoder.htmlEncode( $categoryOptionGroup.code )"></td>
 	</tr>
 </table>