=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-10-09 06:53:32 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-10-09 07:03:34 +0000 @@ -308,8 +308,7 @@ { if ( !CodeGenerator.isValidCode( event.getEvent() ) ) { - return new ImportSummary( ImportStatus.ERROR, - "Event.event did not point to a valid event" ); + return new ImportSummary( ImportStatus.ERROR, "Event.event did not point to a valid event" ); } } } @@ -520,7 +519,7 @@ TrackedEntityDataValue existingDataValue = existingDataValues.get( value.getDataElement() ); saveDataValue( programStageInstance, event.getStoredBy(), dataElement, value.getValue(), - value.getProvidedElsewhere(), existingDataValue ); + value.getProvidedElsewhere(), existingDataValue, null ); } } @@ -744,7 +743,7 @@ } private void saveDataValue( ProgramStageInstance programStageInstance, String storedBy, DataElement dataElement, - String value, Boolean providedElsewhere, TrackedEntityDataValue dataValue ) + String value, Boolean providedElsewhere, TrackedEntityDataValue dataValue, ImportSummary importSummary ) { if ( value != null && value.trim().length() == 0 ) { @@ -760,6 +759,11 @@ dataValue.setProvidedElsewhere( providedElsewhere ); dataValueService.saveTrackedEntityDataValue( dataValue ); + + if ( importSummary != null ) + { + importSummary.getDataValueCount().incrementImported(); + } } else { @@ -769,11 +773,21 @@ dataValue.setProvidedElsewhere( providedElsewhere ); dataValueService.updateTrackedEntityDataValue( dataValue ); + + if ( importSummary != null ) + { + importSummary.getDataValueCount().incrementUpdated(); + } } } else if ( dataValue != null ) { dataValueService.deleteTrackedEntityDataValue( dataValue ); + + if ( importSummary != null ) + { + importSummary.getDataValueCount().incrementDeleted(); + } } } @@ -892,10 +906,8 @@ TrackedEntityDataValue existingDataValue = dataElementValueMap.get( dataValue.getDataElement() ); saveDataValue( programStageInstance, dataValueStoredBy, dataElement, dataValue.getValue(), - dataValue.getProvidedElsewhere(), existingDataValue ); + dataValue.getProvidedElsewhere(), existingDataValue, importSummary ); } - - importSummary.getDataValueCount().incrementImported(); } } else