changeset 190:7acf4a325bfe

Implemented removeCollectionArtifact() method of the artifact database. artifacts/trunk@1420 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 08 Mar 2011 08:25:24 +0000
parents fbaeb5931d10
children 3bce5556a2e5
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java
diffstat 2 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 07 16:30:45 2011 +0000
+++ b/ChangeLog	Tue Mar 08 08:25:24 2011 +0000
@@ -1,3 +1,8 @@
+2011-03-08  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java:
+	  Implemented removeCollectionArtifact() method.
+
 2011-03-07  Ingo Weinzierl <ingo@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java,
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Mon Mar 07 16:30:45 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Tue Mar 08 08:25:24 2011 +0000
@@ -1293,8 +1293,31 @@
     }
 
     public Document removeCollectionArtifact(String collectionId, String artifactId,
-        CallMeta callMeta) throws ArtifactDatabaseException {
-        throw new ArtifactDatabaseException("Not implemented, yet!");
+        CallMeta callMeta) throws ArtifactDatabaseException
+    {
+        logger.debug(
+            "Remove artifact '" + artifactId + "' from collection '" +
+            collectionId + "'");
+
+        Document attr = XMLUtils.newDocument();
+
+        boolean success = backend.removeCollectionArtifact(
+            collectionId,
+            artifactId);
+
+        Document result = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
+            result,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element root = ec.create("result");
+        result.appendChild(root);
+
+        root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE);
+
+        return result;
     }
 
     public Document listCollectionArtifacts(String collectionId,

http://dive4elements.wald.intevation.org