dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26403
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13082: add back postComment in ip-controller
------------------------------------------------------------
revno: 13082
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-12-01 15:16:04 +0100
message:
add back postComment 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 14:12:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2013-12-01 14:16:04 +0000
@@ -122,6 +122,19 @@
return entityList;
}
+ @Override
+ 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 );
+ }
+
+ interpretationService.deleteInterpretation( interpretation );
+ }
+
@RequestMapping( value = "/chart/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void shareChartInterpretation(
@PathVariable( "uid" ) String chartUid,
@@ -246,19 +259,6 @@
ContextUtils.createdResponse( response, "Interpretation created", InterpretationController.RESOURCE_PATH + "/" + interpretation.getUid() );
}
- @Override
- 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 );
- }
-
- interpretationService.deleteInterpretation( interpretation );
- }
-
@RequestMapping( value = "/{uid}/comments/{cuid}", method = RequestMethod.DELETE )
public void deleteComment( @PathVariable( "uid" ) String uid, @PathVariable( "cuid" ) String cuid ) throws NotFoundException
{
@@ -283,4 +283,22 @@
interpretationService.updateInterpretation( interpretation );
}
+
+ @RequestMapping( value = "/{uid}/comment", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
+ public void postComment(
+ @PathVariable( "uid" ) String uid,
+ @RequestBody String text, HttpServletResponse response )
+ {
+ Interpretation interpretation = interpretationService.getInterpretation( uid );
+
+ if ( interpretation == null )
+ {
+ ContextUtils.conflictResponse( response, "Interpretation does not exist: " + uid );
+ return;
+ }
+
+ interpretationService.addInterpretationComment( uid, text );
+
+ ContextUtils.createdResponse( response, "Commented created", InterpretationController.RESOURCE_PATH + "/" + uid );
+ }
}