changeset 186:15c7638511dc

Added an interface for CollectionItems and renamed the CollectionItem class from the artifact-database package to DefaultCollectionItem - because this is the default implementation of the interface. artifacts/trunk@1416 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 07 Mar 2011 15:13:36 +0000
parents afd5945ff8d1
children a85d889a1b0d
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionItem.java artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultCollectionItem.java artifacts/src/main/java/de/intevation/artifacts/CollectionItem.java
diffstat 5 files changed, 83 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 07 14:49:43 2011 +0000
+++ b/ChangeLog	Mon Mar 07 15:13:36 2011 +0000
@@ -1,3 +1,17 @@
+2011-03-07  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifacts/src/main/java/de/intevation/artifacts/CollectionItem.java:
+	  New. An interface that wraps artifacts and its attributes in collections.
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultCollectionItem.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionItem.java:
+	  Moved. The CollectionItem has been moved to DefaultCollectionItem and
+	  implements the new interface CollectionItem.
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java:
+	  The listCollectionArtifacts() method instantiates DefaultCollectionItem
+	  objects now.
+
 2011-03-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionItem.java:
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Mon Mar 07 14:49:43 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Mon Mar 07 15:13:36 2011 +0000
@@ -12,6 +12,7 @@
 import de.intevation.artifacts.ArtifactCollectionFactory;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.ArtifactSerializer;
+import de.intevation.artifacts.CollectionItem;
 import de.intevation.artifacts.User;
 import de.intevation.artifacts.UserFactory;
 
@@ -1357,7 +1358,7 @@
                 stmnt.setString(1, collectionId);
                 result = stmnt.executeQuery();
                 while (result.next()) {
-                    CollectionItem item = new CollectionItem(
+                    CollectionItem item = new DefaultCollectionItem(
                         result.getString(1),
                         result.getBytes(2));
                     collectionItems.add(item);
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionItem.java	Mon Mar 07 14:49:43 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011 by Intevation GmbH
- *
- * This program is free software under the LGPL (>=v2.1)
- * Read the file LGPL.txt coming with the software for details
- * or visit http://www.gnu.org/licenses/ if it does not exist.
- */
-package de.intevation.artifactdatabase;
-
-import de.intevation.artifacts.common.utils.XMLUtils;
-
-import org.w3c.dom.Document;
-
-public class CollectionItem
-{
-    protected String artifactIdentifier;
-
-    protected byte [] data;
-
-    protected Document document;
-
-    public CollectionItem() {
-    }
-
-    public CollectionItem(String artifactIdentifier, byte [] attribute) {
-        this.artifactIdentifier = artifactIdentifier;
-        this.data               = data;
-    }
-
-    public String getArtifactIdentifier() {
-        return artifactIdentifier;
-    }
-
-    public synchronized Document getAttribute() {
-        if (document == null) {
-            if (data != null) {
-                document = XMLUtils.fromByteArray(data);
-            }
-        }
-        return document;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultCollectionItem.java	Mon Mar 07 15:13:36 2011 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+package de.intevation.artifactdatabase;
+
+import de.intevation.artifacts.CollectionItem;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import org.w3c.dom.Document;
+
+public class DefaultCollectionItem
+implements   CollectionItem
+{
+    protected String artifactIdentifier;
+
+    protected byte [] data;
+
+    protected Document document;
+
+    public DefaultCollectionItem() {
+    }
+
+    public DefaultCollectionItem(String artifactIdentifier, byte [] attribute) {
+        this.artifactIdentifier = artifactIdentifier;
+        this.data               = data;
+    }
+
+    public String getArtifactIdentifier() {
+        return artifactIdentifier;
+    }
+
+    public synchronized Document getAttribute() {
+        if (document == null) {
+            if (data != null) {
+                document = XMLUtils.fromByteArray(data);
+            }
+        }
+        return document;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/CollectionItem.java	Mon Mar 07 15:13:36 2011 +0000
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2011 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+package de.intevation.artifacts;
+
+import java.io.Serializable;
+
+import org.w3c.dom.Document;
+
+
+public interface CollectionItem extends Serializable {
+
+    String getArtifactIdentifier();
+
+    Document getAttribute();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org