← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15728: Add storedBy as aggregated_from_tracker for aggregate data value which are created by runing aggr...

 

------------------------------------------------------------
revno: 15728
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-17 22:11:35 +0800
message:
  Add storedBy as aggregated_from_tracker for aggregate data value which are created by runing aggregate query builder formula
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/SaveAggregateDataValueAction.java
  dhis-2/dhis-web/dhis-web-caseentry/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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/SaveAggregateDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/SaveAggregateDataValueAction.java	2014-05-16 02:03:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/SaveAggregateDataValueAction.java	2014-06-17 14:11:35 +0000
@@ -32,6 +32,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -42,7 +43,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.user.CurrentUserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -88,13 +88,6 @@
         this.dataValueService = dataValueService;
     }
 
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-    
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -113,8 +106,6 @@
     public String execute()
         throws Exception
     {
-        String storedBy = currentUserService.getCurrentUsername() + "_CAE";
-
         for ( String aggregateValue : aggregateValues )
         {
             // -----------------------------------------------------------------
@@ -151,15 +142,15 @@
             {
                 if ( dataValue == null )
                 {
-                    dataValue = new DataValue( dataElement, period, orgunit, optionCombo, optionCombo, "" + resultValue, "", new Date(), null );
-
+                    dataValue = new DataValue( dataElement, period, orgunit, optionCombo, optionCombo,
+                        "" + resultValue, CaseAggregationCondition.AUTO_STORED_BY, new Date(), null );
                     dataValueService.addDataValue( dataValue );
                 }
                 else
                 {
                     dataValue.setValue( resultValue );
                     dataValue.setTimestamp( new Date() );
-                    dataValue.setStoredBy( storedBy );
+                    dataValue.setStoredBy(  CaseAggregationCondition.AUTO_STORED_BY );
 
                     dataValueService.updateDataValue( dataValue );
                 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2014-06-17 08:15:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2014-06-17 14:11:35 +0000
@@ -295,8 +295,6 @@
 		<property name="categoryService"
 			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
 		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-
 	</bean>
 
 	<bean