Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java @ 226:41404961c804
Added support for facets - facets of output modes are read from configuration now.
artifacts/trunk@1626 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 30 Mar 2011 14:45:15 +0000 |
parents | 435631e07da2 |
children | 4bb6bfaca393 |
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 |
211
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
16 import de.intevation.artifactdatabase.state.Output; |
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
|
17 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
|
18 |
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
|
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 /** |
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 * 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
|
22 * 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
|
23 * |
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 * @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
|
25 */ |
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 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
|
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 /** |
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 * 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
|
30 */ |
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 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
|
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 /** |
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 * 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
|
36 * |
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 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
|
38 * @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
|
39 * @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
|
40 * @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
|
41 * |
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 * @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
|
43 */ |
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 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
|
45 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
|
46 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
|
47 { |
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 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
|
49 |
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 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
|
51 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
|
52 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
|
53 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
|
54 } |
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 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
|
56 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
|
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 |
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 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
|
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 /** |
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 * 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
|
67 * |
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 * @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
|
69 * |
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 * @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
|
71 */ |
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 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
|
73 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
|
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 /** |
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 * 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
|
79 * 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
|
80 * |
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 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
|
82 * @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
|
83 * @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
|
84 * @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
|
85 */ |
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 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
|
87 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
|
88 { |
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 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
|
90 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
|
91 "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
|
92 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
|
93 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
|
94 |
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 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
|
96 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
|
97 "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
|
98 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
|
99 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
|
100 |
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 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
|
102 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
|
103 "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
|
104 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
|
105 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
|
106 } |
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
|
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 /** |
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 * 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
|
111 * <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
|
112 * |
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 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
|
114 * @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
|
115 * @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
|
116 */ |
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 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
|
118 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
|
119 { |
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 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
|
121 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
|
122 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
|
123 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
|
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 /** |
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 * 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
|
129 * |
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 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
|
131 * @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
|
132 * @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
|
133 */ |
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 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
|
135 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
|
136 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
|
137 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
|
138 { |
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 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
|
140 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
|
141 |
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 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
|
143 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
|
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 |
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 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
|
147 } |
211
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
148 |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
149 |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
150 public static void appendOutputModes( |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
151 XMLUtils.ElementCreator creator, |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
152 Element out, |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
153 List<Output> outputs) |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
154 { |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
155 for (Output o: outputs) { |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
156 out.appendChild(createArtNode( |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
157 creator, |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
158 "output", |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
159 new String[] {"name", "description", "mime-type"}, |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
160 new String[] {o.getName(),o.getDescription(),o.getMimeType()})); |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
161 } |
435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
162 } |
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
|
163 } |
39d9391059bd
Added a ProtocolUtils class that provides functions that help creating the artifact protocol documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |