annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java @ 1117:dec4257ad570

Changed imports to fit new positions of XMLUtils and Config gnv-artifacts/trunk@1478 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 15 Mar 2011 16:13:39 +0000
parents f953c9a559d8
children c01c220312d0
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
5 * Read the file LGPL.txt coming with the software for details
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1028
diff changeset
8
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.artifacts.fis;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
594
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
11 import java.io.IOException;
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
12 import java.io.OutputStream;
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
13 import java.util.Collection;
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
14 import java.util.HashMap;
594
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
15 import java.util.Iterator;
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
16 import java.util.Map;
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
17
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
18 import javax.xml.xpath.XPathConstants;
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
19
594
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
20 import org.apache.log4j.Logger;
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
21 import org.w3c.dom.Document;
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
22 import org.w3c.dom.Element;
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
23 import org.w3c.dom.Node;
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
24 import org.w3c.dom.NodeList;
594
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
25
1028
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
26 import de.intevation.artifactdatabase.ProxyArtifact;
1117
dec4257ad570 Changed imports to fit new positions of XMLUtils and Config
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1115
diff changeset
27 import de.intevation.artifacts.common.utils.XMLUtils;
1028
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
28 import de.intevation.artifacts.Artifact;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
29 import de.intevation.artifacts.ArtifactFactory;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
30 import de.intevation.artifacts.ArtifactNamespaceContext;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
31 import de.intevation.artifacts.CallContext;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
32 import de.intevation.artifacts.CallMeta;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
33 import de.intevation.gnv.artifacts.GNVArtifactBase;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
34 import de.intevation.gnv.artifacts.GNVDefaultArtifact;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
35 import de.intevation.gnv.artifacts.GNVProductArtifactFactory;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
36 import de.intevation.gnv.artifacts.PreSettingArtifact;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
37 import de.intevation.gnv.artifacts.fis.product.Product;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
38 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
39 import de.intevation.gnv.state.DefaultInputData;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
40 import de.intevation.gnv.state.InputData;
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
41
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 /**
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
43 * This artifact is used to handle to input/output at the beginning of a
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
44 * parameterization when no product has been selected so far. After the user
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
45 * having selected a product, this artifact is replaced by a concrete product
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
46 * artifact.
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 792
diff changeset
47 *
780
c4156275c1e1 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 779
diff changeset
48 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 */
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
50 public class SelectProductArtifact extends GNVDefaultArtifact {
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
52 /**
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
53 * THE UID of this Class.
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
54 */
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
55 private static final long serialVersionUID = -7952357683127758677L;
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
56
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
57 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
58 * Path to uuid.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
59 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 public static final String XPATH_UUID = "art:action/art:uuid/@value";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
62 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
63 * Path to hash.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
64 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 public static final String XPATH_HASH = "art:action/art:hash/@value";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
67 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
68 * Path to selected product.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
69 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 public static final String XPATH_INPUT_DATA_VALUE =
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 "art:action/art:data/art:input[@name='product']/@value";
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
72
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
73 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
74 * Path to parameters required by the factory.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
75 */
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
76 public static final String XPATH_SETUP_PARAMETER_NODES =
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
77 "/art:action/art:factory/art:parameter";
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 public static final String XFORM_URL = "http://www.w3.org/2002/xforms";
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
80
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
81 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
82 * Prefix used in the user interface description part of the describe
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
83 * document.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
84 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 public static final String XFORM_PREFIX = "xform";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 private static Logger log = Logger.getLogger(SelectProductArtifact.class);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
89 private Map products;
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 private Product current;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 private Artifact artifact;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 private String name;
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
93
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
94 private Map<String, InputData> preSettings = null;
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
96 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
97 * Constructor.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
98 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 public SelectProductArtifact() {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 super();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
104 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
105 * Initialize this artifact and parse all required information from <code>
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
106 * data</code> document.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
107 *
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
108 * @param identifier
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
109 * @param factory
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
110 * @param context
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
111 * @param data
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
112 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 @Override
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 public void setup(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 String identifier,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 ArtifactFactory factory,
594
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
117 Object context,
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
118 Document data) {
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
119 log.debug("SelectProductArtifact.setup()");
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
120 super.setup(identifier, factory, context,data);
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 this.name = factory.getName();
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
122
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
123 // Read the Parameters that should be used for the setup from the
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
124 // Data-XML.Document.
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
125 NodeList parameterNodes = (NodeList) XMLUtils.xpath(data,
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
126 XPATH_SETUP_PARAMETER_NODES,
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
127 XPathConstants.NODESET,
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
128 ArtifactNamespaceContext.INSTANCE);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
129 if (parameterNodes != null && parameterNodes.getLength() > 0){
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
130 this.preSettings = new HashMap<String, InputData>();
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
131 for (int i = 0; i < parameterNodes.getLength(); i++){
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
132 Element parameterNode = (Element)parameterNodes.item(i);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
133 String name = parameterNode.getAttribute("name");
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
134 String value = parameterNode.getAttribute("value");
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
135 log.debug("Name: "+name);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
136 log.debug("Value: "+value);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
137 InputData inputData = this.preSettings.get(name);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
138 if (inputData == null){
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
139 inputData = new DefaultInputData(name, value);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
140 this.preSettings.put(name, inputData);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
141 }else{
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
142 inputData.concartValue(value);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
143 }
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
144 }
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
145 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
146
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
147 }
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
150 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
151 *
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
152 * @param products Insert a bunch of products.
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
153 */
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
154 public void setProducts(Map products) {
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
155 this.products = products;
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
159 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
160 * Search for a selected product and create a new concrecte product artifact
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
161 * with this information.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
162 *
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
163 * @param target Document which contains the selected product.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
164 * @param context CallContext.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
165 * @return Error or success message.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
166 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 @Override
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 public Document feed(Document target, CallContext context) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 log.debug("SelectProductArtifact.feed()");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 if (artifact == null) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 Document document = XMLUtils.newDocument();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 String productName = XMLUtils.xpathString(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 target,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 XPATH_INPUT_DATA_VALUE,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 ArtifactNamespaceContext.INSTANCE
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 current = (Product) products.get(productName);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 String reportNode = null;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 String resultNode = null;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 String msg = null;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 if (current != null) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 reportNode = "result";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 resultNode = "success";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 msg = "Feed was successfully. New Artifact created.";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 else {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 reportNode = "exceptionreport";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 resultNode = "exception";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 msg = "Product does not exist.";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 document,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 ArtifactNamespaceContext.NAMESPACE_URI,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 ArtifactNamespaceContext.NAMESPACE_PREFIX
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 Element report = creator.create(reportNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 Element success = creator.create(resultNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 success.setTextContent(msg);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 report.appendChild(success);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 document.appendChild(report);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 return document;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 else {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 return artifact.feed(target, context);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
216 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
217 * If {@link #feed(org.w3c.dom.Document, de.intevation.artifacts.CallContext)}
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
218 * was sucessfully called before, this artifact is replaced with a concrete
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
219 * product artifact.
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 792
diff changeset
220 *
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
221 * @param target The advance document.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
222 * @param context The CallContext.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
223 * @return a document with an error or success message.
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
224 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225 @Override
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226 public Document advance(Document target, CallContext context) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227 log.debug("SelectProductArtifact.advance()");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229 if (artifact != null) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230 Document result = artifact.advance(target, context);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231 context.putContextValue(ProxyArtifact.REPLACE_PROXY, artifact);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 return result;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235 Document result = XMLUtils.newDocument();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 if (current == null) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 // artifact needs to be feeded first
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238 String msg = "Artifact is not configured properly. Call 'feed' fist.";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 log.error(msg);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242 result,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 ArtifactNamespaceContext.NAMESPACE_URI,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 ArtifactNamespaceContext.NAMESPACE_PREFIX
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 Element report = creator.create("exceptionreport");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248 Element exception = creator.create("exception");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 exception.setTextContent(msg);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 report.appendChild(exception);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251 result.appendChild(report);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 return result;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 String uuid = XMLUtils.xpathString(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257 target, XPATH_UUID, ArtifactNamespaceContext.INSTANCE
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 String hash = XMLUtils.xpathString(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261 target, XPATH_HASH, ArtifactNamespaceContext.INSTANCE
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
264 // fetch ArtifactFactory from context and create a new Artifact
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
265 ArtifactFactory factory = context.getDatabase()
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
266 .getInternalArtifactFactory(this.name);
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
267 factory = ((GNVProductArtifactFactory)factory)
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
268 .getArtifactFactoryByName(current.getName());
594
5b9b74c08bbb Changed Method signatures because of Interfacemodifications in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 488
diff changeset
269 artifact = factory.createArtifact(uuid, context, null);
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
271
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
272 if (this.preSettings != null && artifact instanceof PreSettingArtifact){
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
273 ((PreSettingArtifact)artifact).setPreSettings(this.preSettings);
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 594
diff changeset
274 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 598
diff changeset
275
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276 artifact.feed(feedDocument(uuid, hash), context);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278 result = ((GNVArtifactBase) artifact).initialize(context);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 if (artifact instanceof GNVArtifactBase) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 ((GNVArtifactBase) artifact).setProduct(current);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 context.putContextValue(ProxyArtifact.REPLACE_PROXY, artifact);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 return result;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
287 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
288 * Create a describe document including the user interface description. The
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
289 * user gets the choice to select a product supported by the current fis.
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 792
diff changeset
290 *
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
291 * @param data The describe document.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
292 * @param context The CallContext.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
293 * @return A document with an error or success message.
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
294 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
295 @Override
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
296 public Document describe(Document data, CallContext context) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
297 log.debug("SelectProductArtifact.describe()");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
298
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
299 // create root node
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
300 Document document = XMLUtils.newDocument();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
301 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
302 document,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
303 ArtifactNamespaceContext.NAMESPACE_URI,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
304 ArtifactNamespaceContext.NAMESPACE_PREFIX
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
305 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
306
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
307 Element rootNode = creator.create("result");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
308 Element typeNode = creator.create("type");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
309 creator.addAttr(typeNode, "name", "describe");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
310 rootNode.appendChild(typeNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
311
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
312 Element uuidNode = creator.create("uuid");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313 creator.addAttr(uuidNode, "value", super.identifier);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
314 rootNode.appendChild(uuidNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
315
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
316 Element hashNode = creator.create("hash");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
317 creator.addAttr(hashNode, "value", hash());
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
318 rootNode.appendChild(hashNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
319
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
320 // create output node
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
321 Element out = creator.create("outputs");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
322 rootNode.appendChild(out);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
323
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324 // create current state
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
325 Element state = creator.create("state");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
326 creator.addAttr(state, "name", "choose-product");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
327 creator.addAttr(state, "description", "Auswahl des Produktes.");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
328 rootNode.appendChild(state);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
329
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
330 // create reachable states
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
331 Element rStates = creator.create("reachable-states");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
332 appendProducts(document, rStates, context);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
333 rootNode.appendChild(rStates);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
334
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
335 // create model
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
336 Element model = creator.create("model");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
337 Element input = creator.create("input");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
338 creator.addAttr(input, "name", "product");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
339 creator.addAttr(input, "type", "String");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
340 model.appendChild(input);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
341 rootNode.appendChild(model);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
342
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
343 // create ui
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
344 Element ui = creator.create("ui");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
345 Element staticNode = creator.create("static");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
346 Element dynamic = creator.create("dynamic");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
347
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
348 appendFis(document, staticNode, context, this.name);
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
349 appendSelectProducts(document, dynamic, context.getMeta());
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
350 ui.appendChild(staticNode);
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
351 ui.appendChild(dynamic);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
352 rootNode.appendChild(ui);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
353
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
354 document.appendChild(rootNode);
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
355
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
356 return document;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
357 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
358
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
359
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
360 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
361 *
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
362 * @param document
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
363 * @param out
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
364 * @param context
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
365 * @throws IOException
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
366 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
367 @Override
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
368 public void out(Document document, OutputStream out, CallContext context)
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
369 throws IOException
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
370 {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
371 log.debug("SelectProductArtifact.out()");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372 if (artifact != null) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
373 artifact.out(document, out, context);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
374 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
375 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
376
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
377
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
378 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
379 * Append products to the describe document.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
380 *
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
381 * @param document The describe document.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
382 * @param parent The node the products should be appended to.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
383 * @param context The CallContext object.
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
384 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385 protected void appendProducts(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386 Document document,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
387 Node parent,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
388 Object context
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
389 ) {
1028
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
390 if (products != null && !products.isEmpty()){
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
391 Iterator iter = products.values().iterator();
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
392
1028
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
393 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
394 document,
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
395 ArtifactNamespaceContext.NAMESPACE_URI,
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
396 ArtifactNamespaceContext.NAMESPACE_PREFIX
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
397 );
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
398
1028
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
399 while(iter.hasNext()) {
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
400 Product prod = (Product) iter.next();
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
401 String name = prod.getName();
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
402
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
403 Element current = creator.create("state");
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
404 creator.addAttr(current, "name", name);
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
405 creator.addAttr(current, "description", name);
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
406 parent.appendChild(current);
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
407 }
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
408 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
409 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
410
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
411
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
412 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
413 * Append the product select box to the user interface description of the
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
414 * describe document.
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
415 *
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
416 * @param document The describe document.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
417 * @param node The node the products should be appended to.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
418 * @param callMeta The CallMeta object.
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
419 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
420 protected void appendSelectProducts(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
421 Document document,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
422 Node node,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
423 CallMeta callMeta
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
424 ) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
425 RessourceFactory ressource = RessourceFactory.getInstance();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
426
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
427 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
428 document,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
429 XFORM_URL,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
430 XFORM_PREFIX
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
431 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
432
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
433 String selectboxName = "product";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
434 Element selectNode = creator.create("select1");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
435 creator.addAttr(selectNode, "ref", selectboxName);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
436
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
437 Element lableNode = creator.create("label");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
438 lableNode.setTextContent(ressource.getRessource(callMeta.getLanguages(),
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
439 selectboxName,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
440 selectboxName
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
441 )
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
442 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
443
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
444 Element choiceNode = creator.create("choices");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
445 selectNode.appendChild(lableNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
446 selectNode.appendChild(choiceNode);
1028
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
447 if (products != null && !products.isEmpty()){
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
448 Iterator it = products.values().iterator();
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
449 while (it.hasNext()) {
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
450 Product p = (Product) it.next();
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
451 Element itemNode = creator.create("item");
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
452 Element choiceLableNode = creator.create("label");
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
453 choiceLableNode.setTextContent(ressource.getRessource(
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
454 callMeta.getLanguages(),
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
455 p.getName(),
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
456 p.getName()
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
457 ));
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
458 itemNode.appendChild(choiceLableNode);
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
459
1028
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
460 Element choiceValueNode = creator.create("value");
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
461 choiceValueNode.setTextContent(p.getName());
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
462 itemNode.appendChild(choiceValueNode);
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
463 choiceNode.appendChild(itemNode);
41234fcf4c7e Some Bugfixes which prevent Exceptions executing the Examples in the config-manual
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
464 }
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
465 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
466
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
467 node.appendChild(selectNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
468 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
469
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
470
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
471 /**
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
472 * Create a feed document.
803
feae2f9d6c6f Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 792
diff changeset
473 *
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
474 * @param uuid The UUID of the current artifact.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
475 * @param hash The hash of the current artifact.
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
476 * @return the feed document.
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
477 */
475
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
478 protected Document feedDocument(String uuid, String hash) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
479 Document document = XMLUtils.newDocument();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
480
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
481 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
482 document,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
483 ArtifactNamespaceContext.NAMESPACE_URI,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
484 ArtifactNamespaceContext.NAMESPACE_PREFIX
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
485 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
486 Element rootNode = creator.create("action");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
487
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
488 Element typeNode = creator.create("type");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
489 creator.addAttr(typeNode, "name", "feed");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
490 rootNode.appendChild(typeNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
491
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
492 Element uuidNode = creator.create("uuid");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
493 creator.addAttr(uuidNode, "value", uuid);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
494 rootNode.appendChild(uuidNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
495
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
496 Element hashNode = creator.create("hash");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
497 creator.addAttr(hashNode, "value", hash);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
498 rootNode.appendChild(hashNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
499
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
500 Element dataNode = creator.create("data");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
501 rootNode.appendChild(dataNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
502
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
503 Collection<InputData> parameter = this.current.getParameter();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
504 if (parameter != null) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
505 Iterator<InputData> parameterIt = parameter.iterator();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
506
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
507 while (parameterIt.hasNext()) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
508 InputData inputData = parameterIt.next();
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
509
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
510 Element inputNode = creator.create("input");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
511 creator.addAttr(inputNode, "name", inputData.getName());
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
512 creator.addAttr(inputNode, "value", inputData.getValue());
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
513 dataNode.appendChild(inputNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
514 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
515 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
516 document.appendChild(rootNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
517 return document;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
518 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
519 }
792
9b9bf42b7928 Added and repaired JavaDoc in artifacts package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
520 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org