dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22559
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10869: set storedBy property on events, use currentUsername if no storedBy was provided
------------------------------------------------------------
revno: 10869
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-17 16:48:29 +0700
message:
set storedBy property on events, use currentUsername if no storedBy was provided
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/event/BaseEventService.java
--
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-dxf2/src/main/java/org/hisp/dhis/dxf2/event/BaseEventService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/event/BaseEventService.java 2013-05-17 07:40:18 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/event/BaseEventService.java 2013-05-17 09:48:29 +0000
@@ -185,6 +185,13 @@
ProgramStageInstance programStageInstance = saveExecutionDate( program, organisationUnit, executionDate, event.getCompleted() );
+ String storedBy = event.getStoredBy();
+
+ if ( storedBy == null )
+ {
+ storedBy = currentUserService.getCurrentUsername();
+ }
+
for ( DataValue dataValue : event.getDataValues() )
{
DataElement dataElement = dataElementService.getDataElement( dataValue.getDataElementId() );
@@ -198,7 +205,7 @@
{
if ( validateDataElement( dataElement, dataValue.getValue(), importSummary ) )
{
- saveDataValue( programStageInstance, dataElement, dataValue.getValue(), dataValue.getProvidedElsewhere() );
+ saveDataValue( programStageInstance, storedBy, dataElement, dataValue.getValue(), dataValue.getProvidedElsewhere() );
importSummary.getDataValueCount().incrementImported();
}
}
@@ -245,10 +252,8 @@
return programStageInstance;
}
- private void saveDataValue( ProgramStageInstance programStageInstance, DataElement dataElement, String value, Boolean providedElsewhere )
+ private void saveDataValue( ProgramStageInstance programStageInstance, String storedBy, DataElement dataElement, String value, Boolean providedElsewhere )
{
- String storedBy = currentUserService.getCurrentUsername();
-
if ( value != null && value.trim().length() == 0 )
{
value = null;