changeset 191:253160854d79

Added new method to delete objects to repositories.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 01 Jul 2013 14:17:33 +0200
parents bf7488ec0e8d
children 0ae1ee3d8db3
files src/main/java/de/intevation/lada/data/LKommentarMRepository.java src/main/java/de/intevation/lada/data/LKommentarPRepository.java src/main/java/de/intevation/lada/data/LMessungRepository.java src/main/java/de/intevation/lada/data/LMesswertRepository.java src/main/java/de/intevation/lada/data/LOrtRepository.java src/main/java/de/intevation/lada/data/LProbeRepository.java src/main/java/de/intevation/lada/data/LStatusRepository.java src/main/java/de/intevation/lada/data/LZusatzwertRepository.java src/main/java/de/intevation/lada/data/ReadOnlyRepository.java src/main/java/de/intevation/lada/data/Repository.java
diffstat 10 files changed, 69 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/LKommentarMRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LKommentarMRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -87,4 +87,10 @@
         }
         return response;
     }
+
+    @Override
+    public Response delete(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/LKommentarPRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LKommentarPRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -51,4 +51,10 @@
     public Response update(Object object) {
         return new Response(false, 698, new ArrayList<LKommentarP>());
     }
+
+    @Override
+    public Response delete(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/LMessungRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LMessungRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -117,4 +117,10 @@
         }
         return response;
     }
+
+    @Override
+    public Response delete(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/LMesswertRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LMesswertRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -89,5 +89,11 @@
         }
         return response;
     }
+
+    @Override
+    public Response delete(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
 
--- a/src/main/java/de/intevation/lada/data/LOrtRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LOrtRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -108,4 +108,10 @@
         }
         return response;
     }
+
+    @Override
+    public Response delete(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/LProbeRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LProbeRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -134,4 +134,9 @@
         }
         return response;
     }
+
+    @Override
+    public Response delete(Object object) {
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/LStatusRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LStatusRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -88,4 +88,10 @@
         }
         return response;
     }
+
+    @Override
+    public Response delete(Object object) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/LZusatzwertRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LZusatzwertRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -4,7 +4,6 @@
 import javax.inject.Inject;
 import javax.inject.Named;
 import javax.persistence.EntityExistsException;
-import javax.persistence.EntityManager;
 import javax.persistence.TransactionRequiredException;
 
 import de.intevation.lada.manage.Manager;
@@ -99,4 +98,25 @@
         }
         return response;
     }
+
+    @Override
+    public Response delete(Object object) {
+        if (!(object instanceof LZusatzWert)) {
+            return new Response(false, 602, null);
+        }
+        LZusatzWert zusatzwert = (LZusatzWert)object;
+        Response response = new Response(true, 200, null);
+        try {
+            manager.delete(zusatzwert);
+        }
+        catch (IllegalArgumentException iae) {
+            response.setSuccess(false);
+            response.setMessage(602);
+        }
+        catch (TransactionRequiredException tre) {
+            response.setSuccess(false);
+            response.setMessage(603);
+        }
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/ReadOnlyRepository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/ReadOnlyRepository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -20,4 +20,9 @@
     public Response update(Object object) {
         return null;
     }
+
+    @Override
+    public Response delete(Object object) {
+        return null;
+    }
 }
--- a/src/main/java/de/intevation/lada/data/Repository.java	Mon Jul 01 14:16:20 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/Repository.java	Mon Jul 01 14:17:33 2013 +0200
@@ -30,6 +30,8 @@
 
     public abstract Response update(Object object);
 
+    public abstract Response delete(Object object);
+
     /**
      * Filter object list by the given criteria.
      *
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)