dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26409
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13087: minor not-found change in ip-controller
------------------------------------------------------------
revno: 13087
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-12-01 17:41:00 +0100
message:
minor not-found change in ip-controller
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.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/InterpretationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2013-12-01 15:05:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2013-12-01 16:41:00 +0000
@@ -68,7 +68,7 @@
* @author Lars Helge Overland
*/
@Controller
-@RequestMapping(value = InterpretationController.RESOURCE_PATH)
+@RequestMapping( value = InterpretationController.RESOURCE_PATH )
public class InterpretationController
extends AbstractCrudController<Interpretation>
{
@@ -123,9 +123,9 @@
return entityList;
}
- @RequestMapping(value = "/chart/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" })
+ @RequestMapping( value = "/chart/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void shareChartInterpretation(
- @PathVariable("uid") String chartUid,
+ @PathVariable( "uid" ) String chartUid,
@RequestBody String text, HttpServletResponse response )
{
Chart chart = chartService.getChart( chartUid );
@@ -152,9 +152,9 @@
ContextUtils.createdResponse( response, "Interpretation created", InterpretationController.RESOURCE_PATH + "/" + interpretation.getUid() );
}
- @RequestMapping(value = "/map/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" })
+ @RequestMapping( value = "/map/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void shareMapInterpretation(
- @PathVariable("uid") String mapUid,
+ @PathVariable( "uid" ) String mapUid,
@RequestBody String text, HttpServletResponse response )
{
Map map = mappingService.getMap( mapUid );
@@ -172,11 +172,11 @@
ContextUtils.createdResponse( response, "Interpretation created", InterpretationController.RESOURCE_PATH + "/" + interpretation.getUid() );
}
- @RequestMapping(value = "/reportTable/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" })
+ @RequestMapping( value = "/reportTable/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void shareReportTableInterpretation(
- @PathVariable("uid") String reportTableUid,
- @RequestParam(value = "pe", required = false) String isoPeriod,
- @RequestParam(value = "ou", required = false) String orgUnitUid,
+ @PathVariable( "uid" ) String reportTableUid,
+ @RequestParam( value = "pe", required = false ) String isoPeriod,
+ @RequestParam( value = "ou", required = false ) String orgUnitUid,
@RequestBody String text, HttpServletResponse response )
{
ReportTable reportTable = reportTableService.getReportTable( reportTableUid );
@@ -209,11 +209,11 @@
ContextUtils.createdResponse( response, "Interpretation created", InterpretationController.RESOURCE_PATH + "/" + interpretation.getUid() );
}
- @RequestMapping(value = "/dataSetReport/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" })
+ @RequestMapping( value = "/dataSetReport/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void shareDataSetReportInterpretation(
- @PathVariable("uid") String dataSetUid,
- @RequestParam("pe") String isoPeriod,
- @RequestParam("ou") String orgUnitUid,
+ @PathVariable( "uid" ) String dataSetUid,
+ @RequestParam( "pe" ) String isoPeriod,
+ @RequestParam( "ou" ) String orgUnitUid,
@RequestBody String text, HttpServletResponse response )
{
DataSet dataSet = dataSetService.getDataSet( dataSetUid );
@@ -248,13 +248,14 @@
}
@Override
- public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid ) throws Exception
+ public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid ) throws Exception
{
Interpretation interpretation = interpretationService.getInterpretation( uid );
if ( interpretation == null )
{
- throw new NotFoundException( uid );
+ ContextUtils.conflictResponse( response, "Interpretation does not exist: " + uid );
+ return;
}
if ( !currentUserService.getCurrentUser().equals( interpretation.getUser() ) )
@@ -265,14 +266,15 @@
interpretationService.deleteInterpretation( interpretation );
}
- @RequestMapping(value = "/{uid}/comments/{cuid}", method = RequestMethod.DELETE)
- public void deleteComment( @PathVariable("uid") String uid, @PathVariable("cuid") String cuid ) throws NotFoundException
+ @RequestMapping( value = "/{uid}/comments/{cuid}", method = RequestMethod.DELETE )
+ public void deleteComment( @PathVariable( "uid" ) String uid, @PathVariable( "cuid" ) String cuid, HttpServletResponse response )
{
Interpretation interpretation = interpretationService.getInterpretation( uid );
if ( interpretation == null )
{
- throw new NotFoundException( uid );
+ ContextUtils.conflictResponse( response, "Interpretation does not exist: " + uid );
+ return;
}
Iterator<InterpretationComment> iterator = interpretation.getComments().iterator();
@@ -295,9 +297,9 @@
interpretationService.updateInterpretation( interpretation );
}
- @RequestMapping(value = "/{uid}/comment", method = RequestMethod.POST, consumes = { "text/html", "text/plain" })
+ @RequestMapping( value = "/{uid}/comment", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void postComment(
- @PathVariable("uid") String uid,
+ @PathVariable( "uid" ) String uid,
@RequestBody String text, HttpServletResponse response )
{
Interpretation interpretation = interpretationService.getInterpretation( uid );