Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollection.java @ 200:62dd8438885f
Added a further constructor to the DefaultStateData class.
artifacts/trunk@1439 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 09 Mar 2011 14:02:03 +0000 |
parents | ac0f8bd97277 |
children | b2115f484edb |
rev | line source |
---|---|
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 package de.intevation.artifactdatabase; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import java.io.IOException; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import java.io.OutputStream; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import java.util.ArrayList; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import java.util.Date; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import java.util.HashMap; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import java.util.List; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import java.util.Map; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.apache.log4j.Logger; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import org.w3c.dom.Document; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.Artifact; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifacts.ArtifactCollection; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifacts.ArtifactCollectionFactory; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.artifacts.CallContext; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.artifacts.User; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * Trivial implementation of an artifact collection. Useful to be subclassed. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public class DefaultArtifactCollection |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 implements ArtifactCollection |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 /** The logger used in this class.*/ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 private static Logger logger = |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 Logger.getLogger(DefaultArtifactCollection.class); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * The identifier of the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 protected String identifier; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 /** |
159
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
46 * The identifier of the collection. |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
47 */ |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
48 protected String name; |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
49 |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
50 /** |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 * The owner of this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 protected User user; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 * The artifacts stored in this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 protected List<Artifact> artifacts; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * The attributes used for the artifacts stored in this collection. The key |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * of this map represents the identifier of the artifact which the attribute |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 * belong to. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 protected Map<String, Document> attributes; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 /** The creation time of this collection.*/ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 protected Date creationTime; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 * Default constructor. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 public DefaultArtifactCollection() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 * When created by a factory this method is called to |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 * initialize the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 * @param identifier The identifier from collection database |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 * @param factory The factory which created this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 * @param context The global context of the runtime system. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 * @param data The data which can be use to setup a collection with |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 * more details. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 public void setup( |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 String identifier, |
170
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
89 String name, |
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
90 Date creationTime, |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 ArtifactCollectionFactory factory, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 Object context, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 Document data) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 logger.debug("DefaultArtifactCollection.setup: " + identifier); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 artifacts = new ArrayList<Artifact>(); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 attributes = new HashMap<String, Document>(); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 setIdentifier(identifier); |
170
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
101 setName(name); |
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
102 setCreationTime(creationTime); |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 * Set a new identifier for this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 * @param identifier New identifier for this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 public void setIdentifier(String identifier) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 this.identifier = identifier; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 * Identify this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 * @return Returns unique string to identify this collection globally. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 public String identifier() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 return identifier; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 /** |
159
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
125 * Name of this collection. |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
126 * @return Returns the name of this collection |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
127 */ |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
128 public String getName() { |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
129 return name; |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
130 } |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
131 |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
132 /** |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
133 * Name of this collection. |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
134 * @return Returns the name of this collection |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
135 */ |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
136 public void setName(String name) { |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
137 this.name = name; |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
138 } |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
139 |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
140 |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
141 /** |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 * Set a new owner of this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 * @param user New owner for this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 public void setUser(User user) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 this.user = user; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 * Identify the owner of the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 * @return Returns owner of the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 public User getUser() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 return user; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 * Returns the creation time of the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 * @return the creation time of the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 public Date getCreationTime() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 return creationTime; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 * Sets the creation time of the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 * @param creationTime The new creation time. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 public void setCreationTime(Date creationTime) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 this.creationTime = creationTime; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 * Called from artifact database when an artifact is |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 * going to be removed from system. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 * @param context The global context of the runtime system. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 public void endOfLife(Object context) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 logger.debug("DefaultArtifactCollection.endOfLife"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 * Internal hash of this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 * @return Returns hash that should stay the same if the internal |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 * value has not changed. Useful for caching |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 public String hash() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 logger.debug("DefaultArtifactCollection.hash"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 return String.valueOf(hashCode()); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 * Called from artifact database before an artifact is |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 * going to be exported as xml document. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 * @param context The global context of the runtime system. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 public void cleanup(Object context) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 logger.debug("DefaultArtifactCollection.cleanup"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 * Adds a new artifact to this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 * @param artifact The new artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 * @param attribute The attributes used for this artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 public void addArtifact( |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 Artifact artifact, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 Document attribute, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 CallContext context) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 logger.debug("DefaultArtifactCollection.addArtifact"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 artifacts.add(artifact); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 attributes.put(artifact.identifier(), attribute); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 * Removes the given artifact from this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 * @param artifact The artifact that should be removed. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 public void removeArtifact(Artifact artifact, CallContext context) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 logger.debug("DefaultArtifactCollection.removeArtifact"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 if (artifact == null) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 return; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 artifacts.remove(artifact); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 attributes.remove(artifact.identifier()); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 * Returns a list of artifacts that are stored in this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 * @return the list of artifacts stored in this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 public Artifact[] getArtifacts(CallContext context) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 logger.debug("DefaultArtifactCollection.getArtifacts"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 return (Artifact[]) artifacts.toArray(); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 * Returns the attribute document for the given artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 * @param artifact The artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 * @return a document that contains the attributes of the artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 public Document getAttribute(Artifact artifact, CallContext context) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 logger.debug("DefaultArtifactCollection.getAttribute"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 return attributes.get(artifact.identifier()); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
276 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 * Set the attribute for the given artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 * @param artifact The artifact of the attribute. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 * @param document The new attribute of the artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 public void setAttribute( |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 Artifact artifact, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 Document document, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 CallContext context) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 logger.debug("DefaultArtifactCollection.setAttribute"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 attributes.put(artifact.identifier(), document); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
293 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
294 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 * Produce output for this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 * @param format Specifies the format of the output. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
298 * @param out Stream to write the result data to. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
299 * @param context The global context of the runtime system. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
300 * @throws IOException Thrown if an I/O occurs. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
301 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
302 public void out(Document format, OutputStream out, CallContext context) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
303 throws IOException |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
304 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
305 logger.debug("DefaultArtifactCollection.out"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
306 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
307 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
308 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |