← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6660: [mobile] add storedby for completeddatasetregistration

 

------------------------------------------------------------
revno: 6660
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Fri 2012-04-20 15:30:53 +0700
message:
  [mobile] add storedby for completeddatasetregistration
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-mobile/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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java	2012-04-10 06:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/FacilityReportingServiceImpl.java	2012-04-20 08:30:53 +0000
@@ -60,6 +60,7 @@
 import org.hisp.dhis.period.QuarterlyPeriodType;
 import org.hisp.dhis.period.WeeklyPeriodType;
 import org.hisp.dhis.period.YearlyPeriodType;
+import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.beans.factory.annotation.Required;
 
 public class FacilityReportingServiceImpl
@@ -89,6 +90,8 @@
 
     private CompleteDataSetRegistrationService registrationService;
 
+    private CurrentUserService currentUserService;
+
     // -------------------------------------------------------------------------
     // Service methods
     // -------------------------------------------------------------------------
@@ -198,7 +201,7 @@
     public DataSet getDataSetForLocale( int dataSetId, Locale locale )
     {
         org.hisp.dhis.dataset.DataSet dataSet = dataSetService.getDataSet( dataSetId );
-        
+
         if ( dataSet == null )
         {
             return null;
@@ -221,7 +224,7 @@
 
         ds.setVersion( 1 );
         Integer version = dataSet.getVersion();
-        if (version != null)
+        if ( version != null )
         {
             ds.setVersion( version );
         }
@@ -345,7 +348,7 @@
         registration.setPeriod( period );
         registration.setSource( unit );
         registration.setDate( new Date() );
-
+        registration.setStoredBy( currentUserService.getCurrentUser().getUsername() );
         registrationService.saveCompleteDataSetRegistration( registration );
 
         log.info( "Saved and registered data value set as complete: " + unit.getName() + ", " + dataSet.getName()
@@ -469,4 +472,12 @@
     {
         this.registrationService = registrationService;
     }
+    
+    @Required
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+    
+    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-02-16 12:58:37 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-04-20 08:30:53 +0000
@@ -14,6 +14,7 @@
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
     <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
     <property name="modelMapping" ref="org.hisp.dhis.mobile.service.ModelMapping" />
+	<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
   </bean>
 
   <bean id="org.hisp.dhis.mobile.api.ActivityReportingService" class="org.hisp.dhis.mobile.service.ActivityReportingServiceImpl">