← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18626: wip, PS, TE, TEA metadata attributes, updates struts actions

 

------------------------------------------------------------
revno: 18626
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-19 12:16:59 +0700
message:
  wip, PS,TE,TEA metadata attributes, updates struts actions
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.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-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java	2015-03-16 08:43:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java	2015-03-19 05:16:59 +0000
@@ -28,12 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
 import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.period.PeriodService;
@@ -46,12 +43,16 @@
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
  * @author Abyot Asalefew Gizaw
@@ -105,10 +106,13 @@
     {
         this.periodService = periodService;
     }
-    
+
     @Autowired
     private ProgramIndicatorService programIndicatorService;
 
+    @Autowired
+    private AttributeService attributeService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -327,7 +331,7 @@
     {
         this.selectedIndicators = selectedIndicators;
     }
-    
+
     private Boolean preGenerateUID;
 
     public void setPreGenerateUID( Boolean preGenerateUID )
@@ -341,7 +345,14 @@
     {
         this.periodTypeName = periodTypeName;
     }
-    
+
+    private List<String> jsonAttributeValues;
+
+    public void setJsonAttributeValues( List<String> jsonAttributeValues )
+    {
+        this.jsonAttributeValues = jsonAttributeValues;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -376,7 +387,7 @@
         programStage.setMinDaysFromStart( minDaysFromStart );
         programStage.setDisplayGenerateEventBox( displayGenerateEventBox );
         programStage.setValidCompleteOnly( validCompleteOnly );
-        
+
         periodTypeName = StringUtils.trimToNull( periodTypeName );
 
         if ( periodTypeName != null )
@@ -388,7 +399,7 @@
         {
             programStage.setPeriodType( null );
         }
-        
+
         if ( program.isSingleEvent() )
         {
             programStage.setAutoGenerateEvent( true );
@@ -397,7 +408,7 @@
         {
             programStage.setAutoGenerateEvent( autoGenerateEvent );
         }
-        
+
         programStage.setCaptureCoordinates( captureCoordinates );
         programStage.setBlockEntryForm( blockEntryForm );
         programStage.setRemindCompleted( remindCompleted );
@@ -407,7 +418,7 @@
         programStage.setReportDateToUse( reportDateToUse );
         programStage.setPreGenerateUID( preGenerateUID );
         programStage.setSortOrder( program.getProgramStages().size() + 1 );
-        
+
         // Program indicators
 
         List<ProgramIndicator> programIndicators = new ArrayList<>();
@@ -416,9 +427,9 @@
             ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id );
             programIndicators.add( indicator );
         }
-        
+
         programStage.setProgramIndicators( programIndicators );
-      
+
         // SMS Reminder
 
         Set<TrackedEntityInstanceReminder> reminders = new HashSet<>();
@@ -431,7 +442,7 @@
             reminder.setSendTo( sendTo.get( i ) );
             reminder.setWhenToSend( whenToSend.get( i ) );
             reminder.setMessageType( messageType.get( i ) );
-            
+
             if ( sendTo.get( i ) == TrackedEntityInstanceReminder.SEND_TO_USER_GROUP )
             {
                 UserGroup selectedUserGroup = userGroupService.getUserGroup( userGroup.get( i ) );
@@ -441,15 +452,21 @@
             {
                 reminder.setUserGroup( null );
             }
-            
+
             reminders.add( reminder );
         }
-        
+
         programStage.setReminders( reminders );
         program.getProgramStages().add( programStage );
 
+        if ( jsonAttributeValues != null )
+        {
+            AttributeUtils.updateAttributeValuesFromJson( programStage.getAttributeValues(), jsonAttributeValues,
+                attributeService );
+        }
+
         programStageService.saveProgramStage( programStage );
-       
+
         // Data elements
 
         for ( int i = 0; i < this.selectedDataElementsValidator.size(); i++ )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java	2015-03-16 08:43:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java	2015-03-19 05:16:59 +0000
@@ -28,29 +28,29 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
 import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.ProgramIndicator;
 import org.hisp.dhis.program.ProgramIndicatorService;
-import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
  * @author Abyot Asalefew Gizaw
@@ -96,13 +96,13 @@
     {
         this.periodService = periodService;
     }
-    
-    @Autowired
-    private ProgramService programService;
 
     @Autowired
     private ProgramIndicatorService programIndicatorService;
 
+    @Autowired
+    private AttributeService attributeService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -323,7 +323,7 @@
     {
         this.selectedIndicators = selectedIndicators;
     }
-    
+
     private Boolean preGenerateUID;
 
     public void setPreGenerateUID( Boolean preGenerateUID )
@@ -337,7 +337,14 @@
     {
         this.periodTypeName = periodTypeName;
     }
-    
+
+    private List<String> jsonAttributeValues;
+
+    public void setJsonAttributeValues( List<String> jsonAttributeValues )
+    {
+        this.jsonAttributeValues = jsonAttributeValues;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -377,7 +384,7 @@
         programStage.setOpenAfterEnrollment( openAfterEnrollment );
         programStage.setReportDateToUse( reportDateToUse );
         programStage.setPreGenerateUID( preGenerateUID );
-        
+
         periodTypeName = StringUtils.trimToNull( periodTypeName );
 
         if ( periodTypeName != null )
@@ -398,31 +405,31 @@
         {
             programStage.setAutoGenerateEvent( autoGenerateEvent );
         }
-        
+
         programStage.setValidCompleteOnly( validCompleteOnly );
         programStage.setCaptureCoordinates( captureCoordinates );
 
         // Program indicators
-        
+
         List<ProgramIndicator> programIndicators = new ArrayList<>();
         for ( Integer id : selectedIndicators )
         {
             ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id );
             programIndicators.add( indicator );
         }
-        
+
         programStage.setProgramIndicators( programIndicators );
-        
+
         // SMS Reminder
-        
+
         programStage.getReminders().clear();
-        
+
         Set<TrackedEntityInstanceReminder> reminders = new HashSet<>();
         for ( int i = 0; i < this.daysAllowedSendMessages.size(); i++ )
         {
             TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( "", daysAllowedSendMessages.get( i ),
                 templateMessages.get( i ) );
-            reminder.setName(programStage.getProgram().getName()+ "-" + name + "-" + i);
+            reminder.setName( programStage.getProgram().getName() + "-" + name + "-" + i );
             reminder.setDateToCompare( TrackedEntityInstanceReminder.DUE_DATE_TO_COMPARE );
             reminder.setSendTo( sendTo.get( i ) );
             reminder.setWhenToSend( whenToSend.get( i ) );
@@ -436,13 +443,20 @@
             {
                 reminder.setUserGroup( null );
             }
-            
+
             reminders.add( reminder );
         }
-        
+
         programStage.setReminders( reminders );
+
+        if ( jsonAttributeValues != null )
+        {
+            AttributeUtils.updateAttributeValuesFromJson( programStage.getAttributeValues(), jsonAttributeValues,
+                attributeService );
+        }
+
         programStageService.updateProgramStage( programStage );
-        
+
         Set<ProgramStageDataElement> programStageDataElements = new HashSet<>(
             programStage.getProgramStageDataElements() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/AddTrackedEntityAction.java	2015-03-19 05:16:59 +0000
@@ -28,12 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.trackedentity.TrackedEntity;
 import org.hisp.dhis.trackedentity.TrackedEntityService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.List;
+
 /**
  * @author Chau Thu Tran
  * 
@@ -49,6 +53,9 @@
     @Autowired
     private TrackedEntityService trackedEntityService;
 
+    @Autowired
+    private AttributeService attributeService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -67,6 +74,13 @@
         this.description = description;
     }
 
+    private List<String> jsonAttributeValues;
+
+    public void setJsonAttributeValues( List<String> jsonAttributeValues )
+    {
+        this.jsonAttributeValues = jsonAttributeValues;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -77,6 +91,12 @@
     {
         TrackedEntity trackedEntity = new TrackedEntity( name, description );
 
+        if ( jsonAttributeValues != null )
+        {
+            AttributeUtils.updateAttributeValuesFromJson( trackedEntity.getAttributeValues(), jsonAttributeValues,
+                attributeService );
+        }
+
         trackedEntityService.addTrackedEntity( trackedEntity );
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/UpdateTrackedEntityAction.java	2015-03-19 05:16:59 +0000
@@ -28,12 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.trackedentity.TrackedEntity;
 import org.hisp.dhis.trackedentity.TrackedEntityService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.List;
+
 /**
  * @author Chau Thu Tran
  * 
@@ -49,6 +53,9 @@
     @Autowired
     private TrackedEntityService trackedEntityService;
 
+    @Autowired
+    private AttributeService attributeService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -74,6 +81,13 @@
         this.description = description;
     }
 
+    private List<String> jsonAttributeValues;
+
+    public void setJsonAttributeValues( List<String> jsonAttributeValues )
+    {
+        this.jsonAttributeValues = jsonAttributeValues;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -88,6 +102,12 @@
 
         trackedEntity.setDescription( description );
         
+        if ( jsonAttributeValues != null )
+        {
+            AttributeUtils.updateAttributeValuesFromJson( trackedEntity.getAttributeValues(), jsonAttributeValues,
+                attributeService );
+        }
+
         trackedEntityService.updateTrackedEntity( trackedEntity );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java	2015-02-24 21:48:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java	2015-03-19 05:16:59 +0000
@@ -29,15 +29,19 @@
  */
 
 import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.option.OptionService;
 import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.List;
+
 /**
  * @author Abyot Asalefew Gizaw
  * @version $Id$
@@ -55,11 +59,11 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private TrackedEntityAttributeService attributeService;
+    private TrackedEntityAttributeService trackedEntityAttributeService;
 
-    public void setAttributeService( TrackedEntityAttributeService attributeService )
+    public void setTrackedEntityAttributeService( TrackedEntityAttributeService trackedEntityAttributeService )
     {
-        this.attributeService = attributeService;
+        this.trackedEntityAttributeService = trackedEntityAttributeService;
     }
 
     @Autowired
@@ -71,6 +75,9 @@
     @Autowired
     private LegendService legendService;
 
+    @Autowired
+    private AttributeService attributeService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -159,6 +166,13 @@
         this.confidential = confidential;
     }
     
+    private List<String> jsonAttributeValues;
+
+    public void setJsonAttributeValues( List<String> jsonAttributeValues )
+    {
+        this.jsonAttributeValues = jsonAttributeValues;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -167,24 +181,24 @@
     public String execute()
         throws Exception
     {
-        TrackedEntityAttribute attribute = new TrackedEntityAttribute();
+        TrackedEntityAttribute trackedEntityAttribute = new TrackedEntityAttribute();
 
-        attribute.setName( name );
-        attribute.setShortName( shortName );
-        attribute.setCode( StringUtils.isEmpty( code.trim() ) ? null : code );
-        attribute.setDescription( description );
-        attribute.setValueType( valueType );
-        attribute.setExpression( expression );
-        attribute.setDisplayOnVisitSchedule( false );
+        trackedEntityAttribute.setName( name );
+        trackedEntityAttribute.setShortName( shortName );
+        trackedEntityAttribute.setCode( StringUtils.isEmpty( code.trim() ) ? null : code );
+        trackedEntityAttribute.setDescription( description );
+        trackedEntityAttribute.setValueType( valueType );
+        trackedEntityAttribute.setExpression( expression );
+        trackedEntityAttribute.setDisplayOnVisitSchedule( false );
 
         unique = (unique == null) ? false : true;
-        attribute.setUnique( unique );
+        trackedEntityAttribute.setUnique( unique );
 
         inherit = (inherit == null) ? false : true;
-        attribute.setInherit( inherit );
+        trackedEntityAttribute.setInherit( inherit );
 
         confidential = (confidential == null) ? false : true;
-        attribute.setConfidential( confidential );
+        trackedEntityAttribute.setConfidential( confidential );
 
         if ( unique )
         {
@@ -200,20 +214,26 @@
                 programScope = true;
             }
             
-            attribute.setOrgunitScope( orgunitScope );
-            attribute.setProgramScope( programScope );
+            trackedEntityAttribute.setOrgunitScope( orgunitScope );
+            trackedEntityAttribute.setProgramScope( programScope );
         }
         else if ( valueType.equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
         {
-            attribute.setOptionSet( optionService.getOptionSet( optionSetId ) );
+            trackedEntityAttribute.setOptionSet( optionService.getOptionSet( optionSetId ) );
         }
         
         if ( legendSetId != null )
         {
-            attribute.setLegendSet( legendService.getLegendSet( legendSetId ) );
-        }
-
-        attributeService.addTrackedEntityAttribute( attribute );
+            trackedEntityAttribute.setLegendSet( legendService.getLegendSet( legendSetId ) );
+        }
+
+        if ( jsonAttributeValues != null )
+        {
+            AttributeUtils.updateAttributeValuesFromJson( trackedEntityAttribute.getAttributeValues(), jsonAttributeValues,
+                attributeService );
+        }
+
+        trackedEntityAttributeService.addTrackedEntityAttribute( trackedEntityAttribute );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java	2015-02-24 21:48:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java	2015-03-19 05:16:59 +0000
@@ -29,15 +29,19 @@
  */
 
 import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.option.OptionService;
 import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
+import java.util.List;
+
 /**
  * @author Abyot Asalefew Gizaw
  * @version $Id$
@@ -55,11 +59,11 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private TrackedEntityAttributeService attributeService;
+    private TrackedEntityAttributeService trackedEntityAttributeService;
 
-    public void setAttributeService( TrackedEntityAttributeService attributeService )
+    public void setTrackedEntityAttributeService( TrackedEntityAttributeService trackedEntityAttributeService )
     {
-        this.attributeService = attributeService;
+        this.trackedEntityAttributeService = trackedEntityAttributeService;
     }
 
     @Autowired
@@ -71,6 +75,9 @@
     @Autowired
     private LegendService legendService;
 
+    @Autowired
+    private AttributeService attributeService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -166,6 +173,13 @@
         this.confidential = confidential;
     }
     
+    private List<String> jsonAttributeValues;
+
+    public void setJsonAttributeValues( List<String> jsonAttributeValues )
+    {
+        this.jsonAttributeValues = jsonAttributeValues;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -174,24 +188,24 @@
     public String execute()
         throws Exception
     {
-        TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( id );
+        TrackedEntityAttribute trackedEntityAttribute = trackedEntityAttributeService.getTrackedEntityAttribute( id );
 
-        attribute.setName( name );
-        attribute.setShortName( shortName );
-        attribute.setCode( StringUtils.isEmpty( code.trim() ) ? null : code );
-        attribute.setDescription( description );
-        attribute.setValueType( valueType );
-        attribute.setExpression( expression );
-        attribute.setDisplayOnVisitSchedule( false );
+        trackedEntityAttribute.setName( name );
+        trackedEntityAttribute.setShortName( shortName );
+        trackedEntityAttribute.setCode( StringUtils.isEmpty( code.trim() ) ? null : code );
+        trackedEntityAttribute.setDescription( description );
+        trackedEntityAttribute.setValueType( valueType );
+        trackedEntityAttribute.setExpression( expression );
+        trackedEntityAttribute.setDisplayOnVisitSchedule( false );
 
         unique = (unique == null) ? false : true;
-        attribute.setUnique( unique );
+        trackedEntityAttribute.setUnique( unique );
 
         inherit = (inherit == null) ? false : true;
-        attribute.setInherit( inherit );
+        trackedEntityAttribute.setInherit( inherit );
 
         confidential = (confidential == null) ? false : true;
-        attribute.setConfidential( confidential );
+        trackedEntityAttribute.setConfidential( confidential );
 
         if ( unique )
         {
@@ -207,20 +221,26 @@
                 programScope = true;
             }
 
-            attribute.setOrgunitScope( orgunitScope );
-            attribute.setProgramScope( programScope );
+            trackedEntityAttribute.setOrgunitScope( orgunitScope );
+            trackedEntityAttribute.setProgramScope( programScope );
         }
         else if ( valueType.equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
         {
-            attribute.setOptionSet( optionService.getOptionSet( optionSetId ) );
+            trackedEntityAttribute.setOptionSet( optionService.getOptionSet( optionSetId ) );
         }
 
         if ( legendSetId != null )
         {
-            attribute.setLegendSet( legendService.getLegendSet( legendSetId ) );
-        }
-
-        attributeService.updateTrackedEntityAttribute( attribute );
+            trackedEntityAttribute.setLegendSet( legendService.getLegendSet( legendSetId ) );
+        }
+
+        if ( jsonAttributeValues != null )
+        {
+            AttributeUtils.updateAttributeValuesFromJson( trackedEntityAttribute.getAttributeValues(), jsonAttributeValues,
+                attributeService );
+        }
+
+        trackedEntityAttributeService.updateTrackedEntityAttribute( trackedEntityAttribute );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml	2015-03-14 07:57:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml	2015-03-19 05:16:59 +0000
@@ -75,7 +75,7 @@
 		id="org.hisp.dhis.trackedentity.action.trackedentityattribute.AddAttributeAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentityattribute.AddAttributeAction"
 		scope="prototype">
-		<property name="attributeService"
+		<property name="trackedEntityAttributeService"
 			ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
 	</bean>
 
@@ -91,7 +91,7 @@
 		id="org.hisp.dhis.trackedentity.action.trackedentityattribute.UpdateAttributeAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentityattribute.UpdateAttributeAction"
 		scope="prototype">
-		<property name="attributeService"
+		<property name="trackedEntityAttributeService"
 			ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
 	</bean>