← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5881: Fixed the same bug 927095 problem of Indicator Editor.

 

------------------------------------------------------------
revno: 5881
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-02-08 10:37:11 +0700
message:
  Fixed the same bug 927095 problem of Indicator Editor.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RenameIndicatorGroupNameEditorAction.java
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ConstantConverter.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml


--
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-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ConstantConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ConstantConverter.java	2012-02-06 12:09:11 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ConstantConverter.java	2012-02-08 03:37:11 +0000
@@ -56,7 +56,7 @@
     private static final String FIELD_ID = "id";
 
     private static final String FIELD_UID = "uid";
-    
+
     private static final String FIELD_CODE = "code";
 
     private static final String FIELD_NAME = "name";
@@ -98,7 +98,7 @@
     public void write( XMLWriter writer, ExportParams params )
     {
         Collection<Constant> constants = constantService.getAllConstants();
-        
+
         if ( constants != null && constants.size() > 0 )
         {
             writer.openElement( COLLECTION_NAME );
@@ -108,8 +108,8 @@
                 writer.openElement( ELEMENT_NAME );
 
                 writer.writeElement( FIELD_ID, String.valueOf( constant.getId() ) );
-                writer.writeElement( FIELD_UID,  constant.getUid() );
-                writer.writeElement( FIELD_CODE,  constant.getCode() );
+                writer.writeElement( FIELD_UID, constant.getUid() );
+                writer.writeElement( FIELD_CODE, constant.getCode() );
                 writer.writeElement( FIELD_NAME, constant.getName() );
                 writer.writeElement( FIELD_VALUE, String.valueOf( constant.getValue() ) );
 
@@ -129,9 +129,12 @@
             final Constant constant = new Constant();
 
             constant.setId( Integer.parseInt( results.get( FIELD_ID ) ) );
-            if (params.minorVersionGreaterOrEqual( "1.3") ) {
-                constant.setUid( results.get(FIELD_UID) );
-                constant.setCode( results.get(FIELD_CODE) );
+
+            if ( params.minorVersionGreaterOrEqual( "1.3" ) )
+            {
+                constant.setUid( results.get( FIELD_UID ) );
+                constant.setCode( results.get( FIELD_CODE ) );
+
             }
 
             constant.setName( results.get( FIELD_NAME ) );

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RenameIndicatorGroupNameEditorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RenameIndicatorGroupNameEditorAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RenameIndicatorGroupNameEditorAction.java	2012-02-08 03:37:11 +0000
@@ -0,0 +1,92 @@
+package org.hisp.dhis.dd.action.indicatorgroup;
+
+/*
+ * 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 org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class RenameIndicatorGroupNameEditorAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private IndicatorService indicatorService;
+    
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    private IndicatorGroup indicatorGroup;
+
+    public IndicatorGroup getIndicatorGroup()
+    {
+        return indicatorGroup;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        indicatorGroup = indicatorService.getIndicatorGroup( id );
+
+        if ( name != null && name.trim().length() > 0 )
+        {
+            indicatorGroup.setName( name );
+        }
+
+        indicatorService.updateIndicatorGroup( indicatorGroup );
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2012-02-06 03:35:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2012-02-08 03:37:11 +0000
@@ -305,6 +305,9 @@
     </property>
   </bean>
 
+  <bean id="org.hisp.dhis.dd.action.indicatorgroup.RenameIndicatorGroupNameEditorAction" class="org.hisp.dhis.dd.action.indicatorgroup.RenameIndicatorGroupNameEditorAction"
+    scope="prototype"/>
+
   <bean id="org.hisp.dhis.dd.action.indicatorgroup.ValidateIndicatorGroupAction" class="org.hisp.dhis.dd.action.indicatorgroup.ValidateIndicatorGroupAction"
     scope="prototype">
     <property name="indicatorService">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2012-02-06 03:35:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2012-02-08 03:37:11 +0000
@@ -319,7 +319,7 @@
       <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonIndicatorGroup.vm</result>
     </action>
 
-    <action name="renameIndicatorGroupEditor" class="org.hisp.dhis.dd.action.indicatorgroup.UpdateIndicatorGroupAction">
+    <action name="renameIndicatorGroupEditor" class="org.hisp.dhis.dd.action.indicatorgroup.RenameIndicatorGroupNameEditorAction">
       <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonIndicatorGroup.vm</result>
     </action>