changeset 259:9da1ee33b1fa

Implemented 'delete' for LStatus objects.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 16 Jul 2013 08:05:06 +0200
parents 4810071c364c
children 0de24f5e7c01
files src/main/java/de/intevation/lada/data/LStatusRepository.java
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/LStatusRepository.java	Mon Jul 15 17:56:45 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LStatusRepository.java	Tue Jul 16 08:05:06 2013 +0200
@@ -157,11 +157,28 @@
     }
 
     /**
-     * This class does not support this operation.
+     * Delete a LStatus object.
      *
-     * @param object
+     * @param object    The object to delete.
+     * @return Response object.
      */
     public Response delete(Object object) {
-        return null;
+        if (!(object instanceof LStatus)) {
+            return new Response(false, 602, null);
+        }
+        LStatus status = (LStatus)object;
+        Response response = new Response(true, 200, null);
+        try {
+            manager.delete(status);
+        }
+        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)