annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java @ 488:d265f5dc2979

Appended the selected fis to the describe document. gnv-artifacts/trunk@564 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Jan 2010 13:43:50 +0000
parents d47b478e662b
children 5b9b74c08bbb
rev   line source
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
1 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
2
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import de.intevation.artifactdatabase.ProxyArtifact;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import de.intevation.artifactdatabase.XMLUtils;
479
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
5
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
6 import de.intevation.artifacts.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
7 import de.intevation.artifacts.ArtifactFactory;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import de.intevation.artifacts.ArtifactNamespaceContext;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 import de.intevation.artifacts.CallContext;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 import de.intevation.artifacts.CallMeta;
479
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
11
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
12 import de.intevation.gnv.artifacts.GNVArtifactBase;
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
13 import de.intevation.gnv.artifacts.GNVDefaultArtifact;
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
14 import de.intevation.gnv.artifacts.GNVProductArtifactFactory;
479
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
15
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
16 import de.intevation.gnv.artifacts.fis.product.Product;
479
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
17
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
18 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
479
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
19
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
20 import de.intevation.gnv.state.InputData;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
479
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
22 import java.io.IOException;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
23 import java.io.OutputStream;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
24
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
25 import java.util.Collection;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
26 import java.util.Iterator;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
27 import java.util.Map;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
28
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
29 import org.apache.log4j.Logger;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
30
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
31 import org.w3c.dom.Document;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
32 import org.w3c.dom.Element;
d47b478e662b Cleaned up imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 478
diff changeset
33 import org.w3c.dom.Node;
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
34
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
35
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
36 /**
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 */
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
39 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
40
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 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
42
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 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
44
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 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
46 "art:action/art:data/art:input[@name='product']/@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
47
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 public static final String XFORM_URL = "http://www.w3.org/2002/xforms";
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
50
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
52
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
53 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
54 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
55 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
56 private String name;
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 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
59 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
60 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 @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
64 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
65 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
66 ArtifactFactory factory,
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 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
68 ) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 log.debug("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
70 super.setup(identifier, factory, 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
71 this.name = factory.getName();
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
72 }
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
73
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
75 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
76 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
77 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 @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
81 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
82 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
83
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 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
85 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
86 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
87 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
88 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
89 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
90 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
93
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 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
95 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
96 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
97
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 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
99 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
100 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
101 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
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 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
104 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
105 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
106 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
107 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 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
110 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
111 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
112 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
113 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
116 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
117 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
118 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
119 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
120
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
122 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 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
124 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
125 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 @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
130 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
131 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
132
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 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
134 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
135 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
136 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
137 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 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
140 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
141 // 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
142 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
143 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
144
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 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
146 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
147 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
148 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
149 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 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
152 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
153 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
154 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
155 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
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 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
158 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 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
161 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
162 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 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
165 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
166 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
168 // 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
169 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
170 .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
171 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
172 .getArtifactFactoryByName(current.getName());
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
173 artifact = factory.createArtifact(uuid, context);
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
174
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 Document feedDocument = feedDocument(uuid, 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
176 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
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 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
179 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
180 ((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
181 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
183 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
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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 @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
188 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
189 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
190
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 // 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
192 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
193 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
194 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
195 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
196 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
197 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
200 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
201 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
202 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
203
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
205 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
206 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
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 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
209 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
210 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
211
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 // 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
213 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
214 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
215
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 // 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
217 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
218 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
219 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
220 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
221
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 // 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
223 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
224 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
225 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
226
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 // 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
228 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
229 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
230 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
231 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
232 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
233 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
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 // create ui
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
236 Element ui = creator.create("ui");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
237 Element staticNode = creator.create("static");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
238 Element dynamic = creator.create("dynamic");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
239
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
240 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
241 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
242 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
243 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
244 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
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 document.appendChild(rootNode);
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 479
diff changeset
247
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
248 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
249 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 @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
253 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
254 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
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 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
257 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
258 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
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 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
264 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
265 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
266 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
267 ) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 Iterator iter = products.values().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
269
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
271 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
272 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
273 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
274 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 while(iter.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
277 Product prod = (Product) iter.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
278 String name = prod.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
279
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 Element current = 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
281 creator.addAttr(current, "name", name);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 creator.addAttr(current, "description", name);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 parent.appendChild(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
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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 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
289 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
290 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
291 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
292 ) {
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293 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
294
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
296 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
297 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
298 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
299 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
302 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
303 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
304
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
306 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
307 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
308 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
309 )
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
313 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
314 selectNode.appendChild(choiceNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 Iterator it = products.values().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
317 while (it.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
318 Product p = (Product) it.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
319 Element itemNode = creator.create("item");
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 Element choiceLableNode = 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
321 choiceLableNode.setTextContent(ressource.getRessource(
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
323 p.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
324 p.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
325 ));
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 itemNode.appendChild(choiceLableNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 Element choiceValueNode = creator.create("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
329 choiceValueNode.setTextContent(p.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
330 itemNode.appendChild(choiceValueNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 choiceNode.appendChild(itemNode);
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
335 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
339 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
340
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
342 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
343 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
344 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
345 );
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
346 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
347
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
348 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
349 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
350 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
351
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
353 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
354 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
355
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
357 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
358 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
359
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
360 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
361 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
362
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
363 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
364 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
365 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
366
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
368 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
369
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits 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 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
371 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
372 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
373 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
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 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
377 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
378 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
379 }
c0504976e606 Renamed FISSelectArtifact to SelectProductArtifact which fits better, because the intent of this artifact is to choose a product - not a fis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
380 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org