=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java 2013-05-19 04:37:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java 2013-07-04 05:00:59 +0000 @@ -46,7 +46,7 @@ * @author Morten Olav Hansen */ @Controller -@RequestMapping( value = EventController.RESOURCE_PATH ) +@RequestMapping(value = EventController.RESOURCE_PATH) public class EventController { public static final String RESOURCE_PATH = "/events"; @@ -58,40 +58,23 @@ // Controller // ------------------------------------------------------------------------- - @RequestMapping( method = RequestMethod.POST, consumes = "application/xml" ) - @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_DATAVALUE_ADD')" ) + @RequestMapping(method = RequestMethod.POST, consumes = "application/xml") + @PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_DATAVALUE_ADD')") public void postXmlEvents( HttpServletResponse response, InputStream inputStream ) throws IOException { ImportSummaries importSummaries = eventService.saveEventsXml( inputStream ); - - if ( importSummaries.getImportSummaries().size() == 1 ) - { - JacksonUtils.toXml( response.getOutputStream(), importSummaries.getImportSummaries().get( 0 ) ); - } - else - { - JacksonUtils.toXml( response.getOutputStream(), importSummaries ); - } + JacksonUtils.toXml( response.getOutputStream(), importSummaries ); } - @RequestMapping( method = RequestMethod.POST, consumes = "application/json" ) - @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_DATAVALUE_ADD')" ) + @RequestMapping(method = RequestMethod.POST, consumes = "application/json") + @PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_DATAVALUE_ADD')") public void postJsonEvents( HttpServletResponse response, InputStream inputStream ) throws IOException { ImportSummaries importSummaries = eventService.saveEventsJson( inputStream ); - - if ( importSummaries.getImportSummaries().size() == 1 ) - { - JacksonUtils.toJson( response.getOutputStream(), importSummaries.getImportSummaries().get( 0 ) ); - } - else - { - JacksonUtils.toJson( response.getOutputStream(), importSummaries ); - } - + JacksonUtils.toJson( response.getOutputStream(), importSummaries ); } - @ExceptionHandler( IllegalArgumentException.class ) + @ExceptionHandler(IllegalArgumentException.class) public void handleError( IllegalArgumentException ex, HttpServletResponse response ) { ContextUtils.conflictResponse( response, ex.getMessage() );