Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java @ 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 | 14bf7895a2ec |
children | 74257b95567b |
comparison
equal
deleted
inserted
replaced
16:f8a5f2c5e2b7 | 17:6cb8aff3cd6b |
---|---|
1 package de.intevation.flys.client.shared.model; | 1 package de.intevation.flys.client.shared.model; |
2 | 2 |
3 import java.util.ArrayList; | |
3 import java.util.Date; | 4 import java.util.Date; |
5 import java.util.List; | |
4 | 6 |
5 | 7 |
6 /** | 8 /** |
7 * The default implementation of a {@link Collection}. | 9 * The default implementation of a {@link Collection}. |
8 * | 10 * |
11 public class DefaultCollection implements Collection { | 13 public class DefaultCollection implements Collection { |
12 | 14 |
13 /** The uuid of the collection. */ | 15 /** The uuid of the collection. */ |
14 protected String uuid; | 16 protected String uuid; |
15 | 17 |
18 /** The list of artifacts that are managed by this Collection.*/ | |
19 protected List<Artifact> artifacts; | |
20 | |
16 | 21 |
17 /** | 22 /** |
18 * Creates a new DefaultCollection with a UUID. | 23 * Creates a new DefaultCollection with a UUID. |
19 * | 24 * |
20 * @param uuid The UUID. | 25 * @param uuid The UUID. |
21 */ | 26 */ |
22 public DefaultCollection(String uuid) { | 27 public DefaultCollection(String uuid) { |
23 this.uuid = uuid; | 28 this.uuid = uuid; |
29 this.artifacts = new ArrayList<Artifact>(); | |
24 } | 30 } |
25 | 31 |
26 | 32 |
27 public String identifier() { | 33 public String identifier() { |
28 return uuid; | 34 return uuid; |
35 | 41 |
36 | 42 |
37 public String getName() { | 43 public String getName() { |
38 return uuid; | 44 return uuid; |
39 } | 45 } |
46 | |
47 | |
48 public void addArtifact(Artifact artifact) { | |
49 if (artifact != null) { | |
50 artifacts.add(artifact); | |
51 } | |
52 } | |
53 | |
54 | |
55 public int getArtifactLength() { | |
56 return artifacts.size(); | |
57 } | |
58 | |
59 | |
60 public Artifact getArtifact(int idx) { | |
61 return artifacts.get(idx); | |
62 } | |
40 } | 63 } |
41 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 64 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |