Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollection.java @ 208:8ea4d0824d8f
Changed a return type of a ClientProtocolUtils method.
artifacts/trunk@1533 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 21 Mar 2011 14:05:45 +0000 |
parents | b2115f484edb |
children | 70cbbe144931 |
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; |
207
b2115f484edb
Move Config and XMLUtils totally to commons package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
170
diff
changeset
|
12 |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import java.util.ArrayList; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import java.util.Date; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import java.util.HashMap; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import java.util.List; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import java.util.Map; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 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
|
20 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 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
|
22 |
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.Artifact; |
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.ArtifactCollection; |
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.ArtifactCollectionFactory; |
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.CallContext; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 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
|
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * 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
|
32 * @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
|
33 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public class DefaultArtifactCollection |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 implements ArtifactCollection |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 /** 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
|
38 private static Logger logger = |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 Logger.getLogger(DefaultArtifactCollection.class); |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * 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
|
43 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 protected String identifier; |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 /** |
159
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
47 * The identifier of the collection. |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
48 */ |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
49 protected String name; |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
50 |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
51 /** |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * 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
|
53 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 protected User user; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 * 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
|
58 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 protected List<Artifact> artifacts; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * 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
|
63 * 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
|
64 * belong to. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 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
|
67 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 /** 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
|
69 protected Date creationTime; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 * Default constructor. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 public DefaultArtifactCollection() { |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 * 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
|
81 * initialize the collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 * @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
|
83 * @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
|
84 * @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
|
85 * @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
|
86 * more details. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 public void setup( |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 String identifier, |
170
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
90 String name, |
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
91 Date creationTime, |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 ArtifactCollectionFactory factory, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 Object context, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 Document data) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 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
|
97 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 artifacts = new ArrayList<Artifact>(); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 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
|
100 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 setIdentifier(identifier); |
170
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
102 setName(name); |
ac0f8bd97277
Fix parameter propagation of creation time ond collection names.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
159
diff
changeset
|
103 setCreationTime(creationTime); |
119
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 * 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
|
109 * @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
|
110 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 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
|
112 this.identifier = identifier; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 * Identify this collection. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 * @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
|
119 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 public String identifier() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 return identifier; |
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 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 /** |
159
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
126 * Name of this collection. |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
127 * @return Returns the name of this collection |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
128 */ |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
129 public String getName() { |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
130 return name; |
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 /** |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
134 * Name of this collection. |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
135 * @return Returns the name of this collection |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
136 */ |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
137 public void setName(String name) { |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
138 this.name = name; |
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 |
db0d20440b92
Added code to create collections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
119
diff
changeset
|
142 /** |
119
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 * 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
|
144 * @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
|
145 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 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
|
147 this.user = user; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 * 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
|
153 * @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
|
154 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 public User getUser() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 return user; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 * 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
|
162 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 * @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
|
164 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 public Date getCreationTime() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 return creationTime; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 * 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
|
172 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 * @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
|
174 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 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
|
176 this.creationTime = creationTime; |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 * 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
|
182 * 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
|
183 * @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
|
184 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 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
|
186 logger.debug("DefaultArtifactCollection.endOfLife"); |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 * 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
|
192 * @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
|
193 * 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
|
194 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 public String hash() { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 logger.debug("DefaultArtifactCollection.hash"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 return String.valueOf(hashCode()); |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 * 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
|
204 * 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
|
205 * @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
|
206 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 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
|
208 logger.debug("DefaultArtifactCollection.cleanup"); |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 * 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
|
214 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 * @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
|
216 * @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
|
217 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 public void addArtifact( |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 Artifact artifact, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 Document attribute, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 CallContext context) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 logger.debug("DefaultArtifactCollection.addArtifact"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 artifacts.add(artifact); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 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
|
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 * 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
|
233 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 * @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
|
235 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 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
|
238 logger.debug("DefaultArtifactCollection.removeArtifact"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 if (artifact == null) { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 return; |
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 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 artifacts.remove(artifact); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 attributes.remove(artifact.identifier()); |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 * 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
|
251 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 * @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
|
255 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 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
|
257 logger.debug("DefaultArtifactCollection.getArtifacts"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 return (Artifact[]) artifacts.toArray(); |
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 * 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
|
265 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 * @param artifact The artifact. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 * @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
|
270 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 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
|
272 logger.debug("DefaultArtifactCollection.getAttribute"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 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
|
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 * 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
|
280 * |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 * @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
|
282 * @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
|
283 * @param context The CallContext. |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 public void setAttribute( |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 Artifact artifact, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 Document document, |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 CallContext context) |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 logger.debug("DefaultArtifactCollection.setAttribute"); |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 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
|
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 /** |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 * 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
|
298 * @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
|
299 * @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
|
300 * @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
|
301 * @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
|
302 */ |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
303 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
|
304 throws IOException |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
305 { |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
306 logger.debug("DefaultArtifactCollection.out"); |
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 } |
3bb121d5b0b7
Added a default implementation of an ArtifactCollection and a User.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
309 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |