← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11328: use same summary for both event and events (bulk)

 

------------------------------------------------------------
revno: 11328
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-07-04 12:00:59 +0700
message:
  use same summary for both event and events (bulk)
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.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-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 <mortenoh@xxxxxxxxx>
  */
 @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() );