changeset 219:90404d19e75d

Implemented delete for LKommentarM and LOrt repositories.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 04 Jul 2013 13:43:11 +0200
parents f4824d67afb0
children f0482fa04e2b
files src/main/java/de/intevation/lada/data/LKommentarMRepository.java src/main/java/de/intevation/lada/data/LOrtRepository.java
diffstat 2 files changed, 34 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/LKommentarMRepository.java	Thu Jul 04 13:38:48 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LKommentarMRepository.java	Thu Jul 04 13:43:11 2013 +0200
@@ -147,7 +147,22 @@
 
     @Override
     public Response delete(Object object) {
-        // TODO Auto-generated method stub
-        return null;
+        if (!(object instanceof LKommentarM)) {
+            return new Response(false, 602, null);
+        }
+        LKommentarM kommentar = (LKommentarM)object;
+        Response response = new Response(true, 200, null);
+        try {
+            manager.delete(kommentar);
+        }
+        catch (IllegalArgumentException iae) {
+            response.setSuccess(false);
+            response.setMessage(602);
+        }
+        catch (TransactionRequiredException tre) {
+            response.setSuccess(false);
+            response.setMessage(603);
+        }
+        return response;
     }
 }
--- a/src/main/java/de/intevation/lada/data/LOrtRepository.java	Thu Jul 04 13:38:48 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LOrtRepository.java	Thu Jul 04 13:43:11 2013 +0200
@@ -168,7 +168,22 @@
 
     @Override
     public Response delete(Object object) {
-        // TODO Auto-generated method stub
-        return null;
+        if (!(object instanceof LOrt)) {
+            return new Response(false, 602, null);
+        }
+        LOrt ort = (LOrt)object;
+        Response response = new Response(true, 200, null);
+        try {
+            manager.delete(ort);
+        }
+        catch (IllegalArgumentException iae) {
+            response.setSuccess(false);
+            response.setMessage(602);
+        }
+        catch (TransactionRequiredException tre) {
+            response.setSuccess(false);
+            response.setMessage(603);
+        }
+        return response;
     }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)