Created
September 3, 2016 08:23
-
-
Save chathurawidanage/404f824230143d79d97fb626d11a4b7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping( value = "/{uid}", method = RequestMethod.DELETE ) | |
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_DELETE')" ) | |
public void deleteEvent( HttpServletResponse response, HttpServletRequest request, | |
@PathVariable( "uid" ) String uid ) throws WebMessageException | |
{ | |
if ( !programStageInstanceService.programStageInstanceExists( uid ) ) | |
{ | |
throw new WebMessageException( WebMessageUtils.notFound( "Event not found for ID " + uid ) ); | |
} | |
response.setStatus( HttpServletResponse.SC_OK ); | |
try | |
{ | |
ImportSummary importSummary = eventService.deleteEvent( uid ); | |
webMessageService.send( WebMessageUtils.importSummary( importSummary ), response, request ); | |
} | |
catch ( Exception ex ) | |
{ | |
webMessageService.send( WebMessageUtils.conflict( "Unable to delete event " + uid, ex.getMessage() ), response, request ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment