changeset 61:d2434d55daa3

Adding stubs for methods to DELETE und UPDATE a kommentar. The logic must be implemented in the repository.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 29 May 2013 17:17:13 +0200
parents bfc34abd2252
children 0b3f58cbbd75
files src/main/java/de/intevation/lada/rest/LKommentarService.java
diffstat 1 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/LKommentarService.java	Tue May 28 11:48:22 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/LKommentarService.java	Wed May 29 17:17:13 2013 +0200
@@ -11,6 +11,8 @@
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
@@ -55,6 +57,36 @@
         return repository.findById(LKommentarP.class, id);
     }
 
+    @DELETE
+    @Path("/{id}")
+    @Produces("text/json")
+    public String delete(@PathParam("id") String id) {
+        return "[{success: true}]";
+        //String response = repository.delete(id);
+        //if (response.isEmpty()) {
+        //    return "[{success: true}]";
+        //}
+        //else {
+        //    return "[{success: false," +
+        //        " error: " + response + "}]";
+        //}
+    }
+
+    @PUT
+    @Produces("text/json")
+    @Consumes("application/json")
+    public String update(LKommentarP kommentar) {
+        return "[{success: true}]";
+        //String response = repository.delete(id);
+        //if (response.isEmpty()) {
+        //    return "[{success: true}]";
+        //}
+        //else {
+        //    return "[{success: false," +
+        //        " error: " + response + "}]";
+        //}
+    }
+
     /**
      * Request a list of LKommentarP objects filtered by LProbe id.
      *
@@ -75,7 +107,6 @@
     }
 
     @POST
-    @Path("/create")
     @Consumes("application/json")
     public String create(LKommentarP kommentar) {
         String response = repository.create(kommentar);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)