------------------------------------------------------------
revno: 20840
committer: Morten Olav Hansen <[email protected]>
branch nick: dhis2
timestamp: Thu 2015-10-22 10:40:22 +0700
message:
use programStageInstanceService.programStageInstanceExists to check for
existence of event UID, should perform better as we don't have to both fetch
the PSI and then convert it to an event (just to check for valid event uid)
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/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/webapi/controller/event/EventController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2015-10-22 03:37:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2015-10-22 03:40:22 +0000
@@ -446,9 +446,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_ADD')" )
public void putXmlEvent( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, ImportOptions importOptions ) throws IOException, WebMessageException
{
- Event event = eventService.getEvent( uid );
-
- if ( event == null )
+ if ( !programStageInstanceService.programStageInstanceExists( uid ) )
{
throw new WebMessageException( WebMessageUtils.notFound( "Event not found for ID " + uid ) );
}
@@ -464,9 +462,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_ADD')" )
public void putJsonEvent( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, ImportOptions importOptions ) throws IOException, WebMessageException
{
- Event event = eventService.getEvent( uid );
-
- if ( event == null )
+ if ( !programStageInstanceService.programStageInstanceExists( uid ) )
{
throw new WebMessageException( WebMessageUtils.notFound( "Event not found for ID " + uid ) );
}
@@ -482,9 +478,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_ADD')" )
public void putJsonEventSingleValue( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, @PathVariable( "dataElementUid" ) String dataElementUid ) throws IOException, WebMessageException
{
- Event event = eventService.getEvent( uid );
-
- if ( event == null )
+ if ( !programStageInstanceService.programStageInstanceExists( uid ) )
{
throw new WebMessageException( WebMessageUtils.notFound( "Event not found for ID " + uid ) );
}
@@ -507,9 +501,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_ADD')" )
public void putJsonEventForNote( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, ImportOptions importOptions ) throws IOException, WebMessageException
{
- Event event = eventService.getEvent( uid );
-
- if ( event == null )
+ if ( !programStageInstanceService.programStageInstanceExists( uid ) )
{
throw new WebMessageException( WebMessageUtils.notFound( "Event not found for ID " + uid ) );
}
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp