Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java @ 158:d718a4d55662
Implemented the createCollection() method in the artifact database.
artifacts/trunk@1383 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 03 Mar 2011 10:54:33 +0000 |
parents | ab646e0f5569 |
children | 435631e07da2 |
rev | line source |
---|---|
107
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 package de.intevation.artifactdatabase; |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
109
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
10 import java.util.List; |
107
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.w3c.dom.Element; |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.common.utils.XMLUtils; |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
109
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
16 import de.intevation.artifactdatabase.state.State; |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
17 |
107
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 /** |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * This class provides methods that help creating the artifact protocol |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 * documents describe, feed, advance and out. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 */ |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 public class ProtocolUtils { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 /** |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * It should not be necessary to create instances of this class. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 */ |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 private ProtocolUtils() {} |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 /** |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 * This method creates a node that might be used for the artifact protocol. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 * |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * @param creator The ElementCreator that is used to create the node. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 * @param nodeName The node name. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 * @param attrName The names of optional attributes. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 * @param value The values for the optional attributes. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * @return the created node. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 */ |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 public static Element createArtNode( |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 XMLUtils.ElementCreator creator, |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 String nodeName, String[] attrName, String[] value) |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 Element typeNode = creator.create(nodeName); |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 if (attrName != null && value != null) { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 for (int i = 0; i < attrName.length; i++) { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 if (i < value.length) { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 creator.addAttr(typeNode, attrName[i], value[i], true); |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 else { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 break; |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 return typeNode; |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 /** |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 * This method creates the root node for all artifact protocol documents. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 * |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 * @param creator The ElementCreator used to create new elements. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 * |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * @return the root node for the artifact protocol document. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 */ |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 public static Element createRootNode(XMLUtils.ElementCreator creator) { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 return createArtNode(creator, "result", null, null); |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 /** |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 * This method appends the three necessary nodes <i>type</i>, <i>uuid</i> |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 * and <i>hash</i> of the describe document to <i>root</i> node. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 * |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 * @param creator The ElementCreator that is used to create new nodes. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 * @param root The root node of the describe document. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 * @param uuid The UUID of the artifact. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 * @param hash The hash if the artifact. |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 */ |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 public static void appendDescribeHeader( |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 XMLUtils.ElementCreator creator, Element root, String uuid, String hash) |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 { |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 root.appendChild(createArtNode( |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 creator, |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 "type", |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 new String[] {"name"}, |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 new String[] {"describe"})); |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 root.appendChild(createArtNode( |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 creator, |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 "uuid", |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 new String[] {"value"}, |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 new String[] {uuid})); |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 root.appendChild(createArtNode( |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 creator, |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 "hash", |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 new String[] {"value"}, |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 new String[] {hash})); |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 } |
109
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
106 |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
107 |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
108 /** |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
109 * This method appends a node that describes the current state to |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
110 * <i>root</i>. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
111 * |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
112 * @param creator The ElementCreator used to create new elements. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
113 * @param root The parent node for new elements. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
114 * @param state The state to be appended. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
115 */ |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
116 public static void appendState( |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
117 XMLUtils.ElementCreator creator, Element root, State state) |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
118 { |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
119 root.appendChild(createArtNode( |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
120 creator, "state", |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
121 new String[] { "description", "name" }, |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
122 new String[] { state.getDescription(), state.getID() })); |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
123 } |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
124 |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
125 |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
126 /** |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
127 * This method appends a node with reachable states to <i>root</i>. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
128 * |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
129 * @param creator The ElementCreator used to create new elements. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
130 * @param root The parent node for new elements. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
131 * @param states The reachable states to be appended. |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
132 */ |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
133 public static void appendReachableStates( |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
134 XMLUtils.ElementCreator creator, |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
135 Element root, |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
136 List<State> states) |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
137 { |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
138 Element reachable = createArtNode( |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
139 creator, "reachable-states", null, null); |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
140 |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
141 for (State s: states) { |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
142 appendState(creator, reachable, s); |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
143 } |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
144 |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
145 root.appendChild(reachable); |
ab646e0f5569
Improved the ProtocolUtils - there are new functions to append a current state and the reachable states to a root node.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
146 } |
107
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |