changeset 17:6cb8aff3cd6b

Enhanced the Collection and its default implementation. flys-client/trunk@1330 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 18 Feb 2011 15:40:04 +0000
parents f8a5f2c5e2b7
children 3c85259bd92a
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/shared/model/Collection.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java
diffstat 3 files changed, 38 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Feb 18 14:23:12 2011 +0000
+++ b/flys-client/ChangeLog	Fri Feb 18 15:40:04 2011 +0000
@@ -1,3 +1,11 @@
+2011-02-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java,
+	  src/main/java/de/intevation/flys/client/shared/model/Collection.java:
+	  Enhanced the Collection and its default implementation with new methods
+	  to add new Artifacts, retrieve Artifacts and get the number of artifacts
+	  managed by the Collection.
+
 2011-02-18  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Collection.java	Fri Feb 18 14:23:12 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Collection.java	Fri Feb 18 15:40:04 2011 +0000
@@ -15,5 +15,11 @@
     public String getName();
 
     public Date getLastAccess();
+
+    public void addArtifact(Artifact artifact);
+
+    public int getArtifactLength();
+
+    public Artifact getArtifact(int idx);
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java	Fri Feb 18 14:23:12 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java	Fri Feb 18 15:40:04 2011 +0000
@@ -1,6 +1,8 @@
 package de.intevation.flys.client.shared.model;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 
 /**
@@ -13,6 +15,9 @@
     /** The uuid of the collection. */
     protected String uuid;
 
+    /** The list of artifacts that are managed by this Collection.*/
+    protected List<Artifact> artifacts;
+
 
     /**
      * Creates a new DefaultCollection with a UUID.
@@ -20,7 +25,8 @@
      * @param uuid The UUID.
      */
     public DefaultCollection(String uuid) {
-        this.uuid = uuid;
+        this.uuid      = uuid;
+        this.artifacts = new ArrayList<Artifact>();
     }
 
 
@@ -37,5 +43,22 @@
     public String getName() {
         return uuid;
     }
+
+
+    public void addArtifact(Artifact artifact) {
+        if (artifact != null) {
+            artifacts.add(artifact);
+        }
+    }
+
+
+    public int getArtifactLength() {
+        return artifacts.size();
+    }
+
+
+    public Artifact getArtifact(int idx) {
+        return artifacts.get(idx);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org