annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 478:0e0c64c821dc

Added support to step back to the point for choosing a product. gnv-artifacts/trunk@547 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 15 Jan 2010 18:21:49 +0000
parents c0504976e606
children d47b478e662b
rev   line source
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.artifacts;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
6 import java.io.IOException;
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
7 import java.io.OutputStream;
337
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
8 import java.util.ArrayList;
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
9 import java.util.Collection;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import java.util.HashMap;
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
11 import java.util.Iterator;
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
12 import java.util.List;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import java.util.Map;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents: 70
diff changeset
15 import javax.xml.xpath.XPathConstants;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents: 70
diff changeset
16
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
17 import net.sf.ehcache.Cache;
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
18
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.Logger;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Document;
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
21 import org.w3c.dom.Element;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import org.w3c.dom.Node;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import org.w3c.dom.NodeList;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
25 import de.intevation.artifacts.Artifact;
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
26 import de.intevation.artifacts.ArtifactDatabase;
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
27 import de.intevation.artifactdatabase.ArtifactDatabaseImpl;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 import de.intevation.artifactdatabase.Config;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 import de.intevation.artifactdatabase.DefaultArtifact;
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
30 import de.intevation.artifactdatabase.ProxyArtifact;
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents: 70
diff changeset
31 import de.intevation.artifactdatabase.XMLUtils;
70
0035862b0295 Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
32 import de.intevation.artifacts.ArtifactFactory;
0035862b0295 Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
33 import de.intevation.artifacts.ArtifactNamespaceContext;
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
34 import de.intevation.artifacts.CallContext;
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
35 import de.intevation.artifacts.CallMeta;
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
36 import de.intevation.gnv.artifacts.cache.CacheFactory;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
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: 473
diff changeset
38 import de.intevation.gnv.artifacts.fis.SelectProductArtifact;
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
39 import de.intevation.gnv.artifacts.fis.product.Product;
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
40 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
41 import de.intevation.gnv.state.DefaultInputData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
42 import de.intevation.gnv.state.InputData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
43 import de.intevation.gnv.state.InputValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
44 import de.intevation.gnv.state.OutputMode;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
45 import de.intevation.gnv.state.OutputState;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
46 import de.intevation.gnv.state.State;
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
47 import de.intevation.gnv.state.StateBase;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
48 import de.intevation.gnv.state.StateFactory;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
49 import de.intevation.gnv.state.exception.StateException;
337
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
50 import de.intevation.gnv.transition.Transition;
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
51 import de.intevation.gnv.transition.TransitionFactory;
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents: 70
diff changeset
52 import de.intevation.gnv.utils.ArtifactXMLUtilities;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 * @author Tim Englich <tim.englich@intevation.de>
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
56 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
57 *
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 public abstract class GNVArtifactBase extends DefaultArtifact {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 * the logger, used to log exceptions and additonaly information
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 private static Logger log = Logger.getLogger(GNVArtifactBase.class);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 * The UID of this Class
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 private static final long serialVersionUID = -8907096744400741458L;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
68
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
69 /**
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
70 * The Identifier for the Replacement of the Artifactname
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
71 */
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 public static final String XPATH_IDENTIFIER_REPLACE = "IDENTIFIER";
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
73
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 * The XPATH to the XML-Fragment that should be used for the Configuration
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 */
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
77 public static final String XPATH_ARTIFACT_CONFIGURATION = "/artifact-database/artifacts/artifact[@name='"
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
78 + XPATH_IDENTIFIER_REPLACE
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
79 + "']";
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
80
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
81 public static final String XPATH_STATIC_NODE = "/art:result/art:ui/art:static";
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
82
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
83 public static final String XPATH_INPUT_DATA = "/art:action/art:data/art:input";
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
84
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
85 public static final String XPATH_INCLUDE_UI = "/art:action/art:include-ui";
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
86
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
87 public static final String XPATH_TARGET_NAME = "/art:action/art:target/@name";
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
88
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
89 public static final String XPATH_OUTPUT_NAME = "/art:action/art:out/@name";
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
90
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
91 public static final String XPATH_OUTPUT_PARAMS = "/art:action/art:out/art:params/art:input";
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
92
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
93 public static final String INITIAL_STATE = "product";
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
94
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
95 /**
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
96 * The current State
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
97 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
98 protected State current = null;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
99
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
100 /**
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
101 * The States that can be used
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
102 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
103 protected Map<String, State> states = null;
337
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
104
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
105 /**
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
106 * The Transitions which can switch between the different States.
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
107 */
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
108 protected Collection<Transition> transitions = null;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
110
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
111 /**
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
112 * The current product
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
113 */
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
114 protected Product product;
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
115
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
116 /**
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
117 * The Name of the Artifact
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
118 */
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 protected String name = null;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
120
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 * Constructor
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 public GNVArtifactBase() {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 super();
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
127
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
128
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
129 @Override
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
130 public Document advance(Document target, CallContext context) {
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
131 log.debug("GNVArtifactBase.advance()");
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
132
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
133 Document result = XMLUtils.newDocument();
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
134 String targetState = XMLUtils.xpathString(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
135 target, XPATH_TARGET_NAME, ArtifactNamespaceContext.INSTANCE
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
136 );
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
137
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
138 // no current state...
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
139 if (current == null) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
140 log.debug("No current state. Advance not possible.");
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
141
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
142 result = createReport(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
143 result,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
144 "exceptionreport",
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
145 "exception",
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
146 "No State activated."
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
147 );
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
148
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
149 return result;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
150 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
151
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
152 State next = null;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
153
88
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
154 try {
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
155
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
156 // step forward
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
157 if (isStateCurrentlyReachable(targetState)) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
158 next = states.get(targetState);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
159
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
160 // 2. Transfer Results
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
161 next.putInputData(current.getInputData(), identifier);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
162 next.setParent(current);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
163
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
164 // 3. Switch to next State
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
165 current = next;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
166
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
167 // 4. Initialize next Step
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
168 current.initialize(identifier, context.getMeta());
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
169
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
170 result = createReport(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
171 result, "result", "success", "Advance success"
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
172 );
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
173 }
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
174
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
175 // step backward
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
176 else if((next = getPreviousState(current, targetState)) != null) {
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
177
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
178 // reset input data
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
179 resetFutureStates(current, targetState);
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
180
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
181 // remove data from future states from cache
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
182 resetDescribeData(current, identifier, targetState);
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
183
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
184 current = next;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
185
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
186 result = createReport(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
187 result, "result", "success", "Advance success"
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
188 );
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
189 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
190
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
191 // goto initial step
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
192 else if(targetState.equals(INITIAL_STATE)) {
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
193
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
194 String fis = product.getArtifactFactory();
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
195 ArtifactDatabase db = 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
196 GNVProductArtifactFactory fac = (GNVProductArtifactFactory)
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
197 db.getInternalArtifactFactory(fis);
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
198
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
199 Artifact select = fac.createArtifact(identifier, context);
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
200 context.putContextValue(ProxyArtifact.REPLACE_PROXY, select);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
201
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
202 resetDescribeData(current, identifier, INITIAL_STATE);
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
203
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
204 result = createReport(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
205 result, "result", "success", "Advance success"
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
206 );
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
207 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
208
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
209 // advance not possible
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
210 else {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
211 log.warn("advance not possible for target: " + targetState);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
212 result = createReport(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
213 result,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
214 "exceptionreport",
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
215 "exception",
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
216 "Statetransition not supported"
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
217 );
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
218 }
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
219 }
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
220 catch (StateException se) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
221 log.error(se, se);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
222 result = createReport(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
223 result,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
224 "exceptionreport",
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
225 "exception",
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
226 se.getLocalizedMessage()
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
227 );
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
228 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
229
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
230 return result;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
231 }
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
232
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
233
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
234 protected Document createReport(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
235 Document document,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
236 String nodeName,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
237 String state,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
238 String msg
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
239 ) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
240 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
241 document,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
242 ArtifactNamespaceContext.NAMESPACE_URI,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
243 ArtifactNamespaceContext.NAMESPACE_PREFIX
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
244 );
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
245
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
246 Element reportNode = creator.create(nodeName);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
247 Element stateNode = creator.create(state);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
248
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
249 stateNode.setTextContent(msg);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
250 reportNode.appendChild(stateNode);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
251 document.appendChild(reportNode);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
252
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
253 return document;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
254
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
255 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
256
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
257
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
258 protected State getPreviousState(State current, String name) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
259 if (current == null) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
260 return null;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
261 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
262
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
263 if (current.getID().equals(name)) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
264 return current;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
265 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
266 else {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
267 return getPreviousState(current.getParent(), name);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
268 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
269 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
270
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
271 public void resetDescribeData(State state, String uuid, String target) {
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
272 CacheFactory factory = CacheFactory.getInstance();
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
273
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
274 if (factory.isInitialized()) {
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
275 Cache cache = factory.getCache();
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
276 String key = uuid + StateBase.DESCRIBEDATAKEY;
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
277
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
278 net.sf.ehcache.Element value = cache.get(key);
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
279 if (value == null)
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
280 return;
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
281
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
282 List data = (List) value.getObjectValue();
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
283 while(!target.equals(state.getID())) {
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
284 data.remove(data.size()-1);
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
285 state = state.getParent();
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
286
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
287 if (state == null)
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
288 break;
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
289 }
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
290
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
291 cache.put(new net.sf.ehcache.Element(key, data));
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
292 }
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
293 }
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
294
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
295
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
296 protected void resetFutureStates(State current, String name) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
297 if (current == null) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
298 return;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
299 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
300
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
301 if (current.getID().equals(name)) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
302 return;
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
303 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
304 else {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
305 current.reset(identifier);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
306 resetFutureStates(current.getParent(), name);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
307 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
308 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
309
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
310
337
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
311 private boolean isStateCurrentlyReachable(String stateid){
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
312 Iterator<Transition> it = this.transitions.iterator();
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
313 String from = this.current.getID();
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
314 while (it.hasNext()){
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
315 Transition transition = it.next();
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
316 if (transition.getFrom().equals(from)){
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
317 if (transition.getTo().equals(stateid) && transition.isValid(this.current)){
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
318 return true;
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
319 }
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
320 }
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
321 }
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
322 return false;
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
323 }
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
324
325
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
325 public Document initialize (CallContext context) {
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
326 Document result = XMLUtils.newDocument();
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
327 try {
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
328 this.current.initialize(super.identifier, context.getMeta());
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
329 result = new ArtifactXMLUtilities()
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
330 .createSuccessReport("Initialize success",
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
331 XMLUtils.newDocument());
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
332 } catch (StateException e) {
325
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
333 log.error(e,e);
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
334 result = new ArtifactXMLUtilities().createExceptionReport(e
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
335 .getLocalizedMessage(), XMLUtils.newDocument());
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
336 }
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
337 return result;
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
338 }
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
339
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
340 protected String readStateName(Document document) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
341 String returnValue = XMLUtils.xpathString(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
342 document, XPATH_TARGET_NAME, ArtifactNamespaceContext.INSTANCE);
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
343 return returnValue;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
344 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
345
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
346 protected Node getConfigurationFragment(Document document) {
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
347 log.debug("GNVArtifactBase.getConfigurationFragment");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
348 String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
349 XPATH_IDENTIFIER_REPLACE, this.name);
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
350 log.debug(xpathQuery);
204
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
351
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
352 Element configurationNode = (Element)Config.getNodeXPath(document, xpathQuery);
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
353
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
354 String link = configurationNode.getAttribute("xlink:href");
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
355 if (link != null ){
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
356 String absolutFileName = Config.replaceConfigDir(link);
217
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 208
diff changeset
357 configurationNode = (Element)new ArtifactXMLUtilities().readConfiguration(absolutFileName);
204
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
358 }
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
359
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
360 return configurationNode;
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
361 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
362
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
363 /**
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
364 * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
365 * de.intevation.artifacts.CallContext)
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
366 */
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
367 @Override
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
368 public Document feed(Document target, CallContext context) {
89
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
369 log.debug("GNVArtifactBase.feed");
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents: 70
diff changeset
370 Document result = XMLUtils.newDocument();
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
371 try {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
372 if (this.current != null) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
373 Collection<InputData> inputData = this.parseInputData(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
374 target,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
375 XPATH_INPUT_DATA);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
376
194
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
377 if (!inputData.isEmpty()){
208
a33d59f5791a Use super.identifier as uuid. issue3
Tim Englich <tim.englich@intevation.de>
parents: 207
diff changeset
378 this.current.putInputData(inputData, super.identifier);
194
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
379 result = new ArtifactXMLUtilities().createSuccessReport(
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
380 "Feed success", XMLUtils.newDocument());
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
381 }else{
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
382 String msg = "No Inputdata given. Please select at least one Entry.";
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
383 log.warn(msg);
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
384 result = new ArtifactXMLUtilities().createExceptionReport(msg,
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
385 XMLUtils.newDocument());
00c1a931b9c3 Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
386 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
387 } else {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
388 String msg = "No State instantiated";
89
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
389 log.warn(msg);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
390 result = new ArtifactXMLUtilities().createExceptionReport(msg,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
391 XMLUtils.newDocument());
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
392 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
393 } catch (StateException e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
394 log.error(e, e);
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
395 result = new ArtifactXMLUtilities().createExceptionReport(e
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
396 .getLocalizedMessage(), XMLUtils.newDocument());
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
397 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
398 return result;
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
399 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
400
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
401
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
402 /**
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
403 * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
404 */
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
405 @Override
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
406 public Document describe(Document data, CallContext context) {
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
407 log.debug("GNVArtifactBase.describe");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
408
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
409 Document document = createDescibeOutput(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
410 context.getMeta(),
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
411 identifier,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
412 getIncludeUIFromDocument(data)
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
413 );
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
414
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
415 // insert node for rendering product field
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
416 Element staticNode = (Element) XMLUtils.xpath(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
417 document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
418 XPATH_STATIC_NODE,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
419 XPathConstants.NODE,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
420 ArtifactNamespaceContext.INSTANCE
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
421 );
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
422
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
423 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
424 document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
425 XMLUtils.XFORM_URL,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
426 XMLUtils.XFORM_PREFIX
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
427 );
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
428
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
429 XMLUtils.ElementCreator artCreator = new XMLUtils.ElementCreator(
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
430 document,
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
431 ArtifactNamespaceContext.NAMESPACE_URI,
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
432 ArtifactNamespaceContext.NAMESPACE_PREFIX
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
433 );
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
434
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
435 if (staticNode != null) {
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
436 Element staticUI = createSelectBox(
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
437 artCreator, creator, document, context
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
438 );
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
439 staticNode.insertBefore(staticUI, staticNode.getFirstChild());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
440 }
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
441
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
442 return document;
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
443 }
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
444
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
445 /**
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
446 * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
447 * java.lang.Object)
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
448 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
449 @Override
70
0035862b0295 Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
450 public void setup(String identifier, ArtifactFactory factory, Object context) {
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
451 log.debug("GNVArtifactBase.setup");
70
0035862b0295 Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
452 super.setup(identifier, factory, context);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
453
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 73
diff changeset
454 Object localContext = context;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
455 if (context instanceof CallContext) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
456 localContext = ((CallContext) context).globalContext();
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
457
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 73
diff changeset
458 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
459
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
460 if (localContext instanceof GNVArtifactContext) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
461 GNVArtifactContext gnvContext = (GNVArtifactContext) localContext;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
462 Document doc = gnvContext.getConfig();
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
463 Node artifactNode = this.getConfigurationFragment(doc);
204
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
464
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
465 NodeList stateList = Config.getNodeSetXPath(artifactNode,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
466 "states/state");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
467 this.states = new HashMap<String, State>(stateList
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
468 .getLength());
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
469 for (int i = 0; i < stateList.getLength(); i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
470 State tmpState = StateFactory.getInstance()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
471 .createState(stateList.item(i));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
472 if (tmpState != null) {
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
473 log.debug("Initiate new state: " + tmpState.getID());
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
474 this.states.put(tmpState.getID(), tmpState);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
475 if (this.current == null) {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
476 this.current = tmpState;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
477 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
478 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
479 }
337
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
480
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
481 NodeList transitionList = Config.getNodeSetXPath(artifactNode,
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
482 "states/transition");
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
483 this.transitions = new ArrayList<Transition>(transitionList.getLength());
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
484 for (int i = 0; i < transitionList.getLength(); i++) {
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
485 Transition tmpTransition = TransitionFactory.getInstance()
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
486 .createTransition(transitionList.item(i));
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
487 if (tmpTransition != null) {
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
488 this.transitions.add(tmpTransition);
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
489 }
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
490 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
491
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
492 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
493 }
325
3eff9241ea1e Refactoring of the Transitionmodel.
Tim Englich <tim.englich@intevation.de>
parents: 301
diff changeset
494
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
495
222
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
496 protected Document createDescibeOutput(CallMeta callMeta, String uuid, boolean incudeUI) {
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
497 log.debug("GNVArtifactBase.createDescibeOutput");
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents: 70
diff changeset
498 Document document = XMLUtils.newDocument();
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
499
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
500 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
501 document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
502 ArtifactNamespaceContext.NAMESPACE_URI,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
503 ArtifactNamespaceContext.NAMESPACE_PREFIX
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
504 );
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
505 Element rootNode = this.createRootNode(creator, document);
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
506 this.createHeader(creator, rootNode, document, "describe");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
507 this.createOutputs(creator, rootNode, document);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
508 this.createCurrentState(creator, rootNode, document);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
509 this.createReachableStates(creator, rootNode, document);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
510 this.createModel(creator, rootNode, document);
222
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
511 if (incudeUI){
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
512 this.createUserInterface(creator, rootNode, document, callMeta, uuid);
222
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
513 }
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
514
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
515 return document;
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
516 }
222
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
517
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
518 protected boolean getIncludeUIFromDocument(Document document){
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
519 String value = XMLUtils.xpathString(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
520 document, XPATH_INCLUDE_UI, ArtifactNamespaceContext.INSTANCE);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
521
222
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
522 boolean includeUI = false;
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
523 if (value != null){
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
524 includeUI = Boolean.parseBoolean(value);
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
525 }
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
526 return includeUI;
3e82b4f1c455 Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents: 220
diff changeset
527 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
528
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
529 protected Element createRootNode(
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
530 XMLUtils.ElementCreator creator,
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
531 Document document
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
532 ) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
533 Element rootNode = creator.create("result");
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
534 document.appendChild(rootNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
535 return rootNode;
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
536 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
537
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
538 protected void createHeader(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
539 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
540 Element parent,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
541 Document document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
542 String documentType
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
543 ) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
544 Element typeNode = creator.create("type");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
545 creator.addAttr(typeNode, "name", documentType);
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
546 parent.appendChild(typeNode);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
547
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
548 Element uuidNode = creator.create("uuid");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
549 creator.addAttr(uuidNode, "value", super.identifier);
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
550 parent.appendChild(uuidNode);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
551
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
552 Element hashNode = creator.create("hash");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
553 creator.addAttr(hashNode, "value", this.hash());
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
554 parent.appendChild(hashNode);
89
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
555 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
556
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
557 protected Element createSelectBox(
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
558 XMLUtils.ElementCreator artCreator,
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
559 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
560 Document document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
561 CallContext context
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
562 ) {
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
563 RessourceFactory resource = RessourceFactory.getInstance();
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
564 CallMeta callMeta = (CallMeta) context.getMeta();
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
565 String productName = product.getName();
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
566
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
567 Element selectNode = creator.create("select1");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
568 creator.addAttr(selectNode, "ref", "product");
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
569 artCreator.addAttr(selectNode, "state", INITIAL_STATE, true);
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
570
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
571
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
572 Element labelNode = creator.create("label");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
573 labelNode.setTextContent(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
574 resource.getRessource(callMeta.getLanguages(), "product", "product")
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
575 );
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
576
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
577 Element choicesNode = creator.create("choices");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
578
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
579 Element itemNode = creator.create("item");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
580 creator.addAttr(itemNode, "selected", "true");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
581
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
582 Element choiceLabel = creator.create("label");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
583 choiceLabel.setTextContent(resource.getRessource(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
584 callMeta.getLanguages(),
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
585 productName,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
586 productName
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
587 ));
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
588
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
589 Element choiceValue = creator.create("value");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
590 choiceValue.setTextContent(productName);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
591
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
592 itemNode.appendChild(choiceLabel);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
593 itemNode.appendChild(choiceValue);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
594 choicesNode.appendChild(itemNode);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
595
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
596 selectNode.appendChild(labelNode);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
597 selectNode.appendChild(choicesNode);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
598
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
599 return selectNode;
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
600 }
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
601
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
602 protected void createReachableStates(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
603 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
604 Element parent,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
605 Document document
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
606 ) {
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
607 Element stateNode = creator.create("reachable-states");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
608 if (this.current != null) {
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
609
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
610 // add future states
337
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
611 Iterator<Transition> transitions = this.transitions.iterator();
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
612 while (transitions.hasNext()) {
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
613 Transition tmpTransition = transitions.next();
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
614 if (tmpTransition.getFrom().equals(current.getID()) &&
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
615 tmpTransition.isValid(this.current)){
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
616 Element currentNode = creator.create("state");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
617 creator.addAttr(currentNode, "name", tmpTransition.getTo());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
618 creator.addAttr(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
619 currentNode,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
620 "description",
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
621 this.states.get(tmpTransition.getTo()).getDescription());
337
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
622 stateNode.appendChild(currentNode);
a887074460b6 Last Step of the Refactoring Work on the Transition Model.
Tim Englich <tim.englich@intevation.de>
parents: 335
diff changeset
623 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
624 }
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
625
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
626
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
627 // add old states
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
628 appendOldReachableStates(creator, stateNode, current);
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
629 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
630 parent.appendChild(stateNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
631 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
632
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
633
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
634 protected void appendOldReachableStates(
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
635 XMLUtils.ElementCreator creator,
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
636 Element parent,
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
637 State state
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
638 ) {
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
639 if (state == null)
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
640 return;
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
641
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
642 while (state != null) {
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
643 Element currentNode = creator.create("state");
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
644 creator.addAttr(currentNode, "name", state.getID());
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
645 creator.addAttr(currentNode, "description", state.getDescription());
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
646 parent.appendChild(currentNode);
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
647
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
648 state = state.getParent();
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
649 }
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
650 }
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
651
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
652
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
653 protected void createCurrentState(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
654 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
655 Element parent,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
656 Document document
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
657 ) {
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
658 Element stateNode = creator.create("state");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
659 creator.addAttr(stateNode, "name", this.current.getID());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
660 creator.addAttr(stateNode, "description", this.current.getDescription());
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
661 parent.appendChild(stateNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
662 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
663
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
664 protected void createModel(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
665 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
666 Element parent,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
667 Document document
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
668 ) {
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
669 Element modelNode = creator.create("model");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
670 if (this.current != null) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
671 Collection<InputValue> inputValues = this.current
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
672 .getRequiredInputValues();
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
673 if (inputValues != null) {
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
674 Iterator<InputValue> it = inputValues.iterator();
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
675 while (it.hasNext()) {
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
676 InputValue inputValue = it.next();
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
677 Element inputNode = creator.create("input");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
678 creator.addAttr(inputNode, "name", inputValue.getName());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
679 creator.addAttr(inputNode, "type", inputValue.getType());
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
680 modelNode.appendChild(inputNode);
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
681 }
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
682 }
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
683 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
684 parent.appendChild(modelNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
685 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
686
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
687 protected void createUserInterface(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
688 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
689 Element parent,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
690 Document document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
691 CallMeta callMeta,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
692 String uuid
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
693 ) {
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
694 Element uiNode = creator.create("ui");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
695
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
696 if (this.current != null) {
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
697 this.current.describe(
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
698 document, uiNode, callMeta, uuid
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
699 );
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
700 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
701
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
702 parent.appendChild(uiNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
703 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
704
478
0e0c64c821dc Added support to step back to the point for choosing a product.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 475
diff changeset
705
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
706 protected void createOutputs(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
707 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
708 Element parent,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
709 Document document
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
710 ) {
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
711 log.debug("GNVArtifactBase.createOutputs");
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
712 Element outputsNode = creator.create("outputs");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
713 if (this.current instanceof OutputState) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
714 Collection<OutputMode> outputModes = ((OutputState) this.current)
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
715 .getOutputModes();
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
716 if (outputModes != null) {
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
717 Iterator<OutputMode> it = outputModes.iterator();
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
718 while (it.hasNext()) {
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
719 OutputMode outputMode = it.next();
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
720 log.debug("Write Outputnode for " + outputMode.toString());
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
721 Element outputModeNode = creator.create("output");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
722 creator.addAttr(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
723 outputModeNode, "name", outputMode.getName());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
724 creator.addAttr(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
725 outputModeNode, "description", outputMode.getDescription());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
726 creator.addAttr(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
727 outputModeNode, "mime-type", outputMode.getMimeType());
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
728 outputsNode.appendChild(outputModeNode);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
729
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
730 Collection<InputValue> inputParameters = outputMode
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
731 .getInputParameters();
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
732 if (inputParameters != null) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
733 Element inputParametersNode = creator.create("parameter");
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 90
diff changeset
734 outputModeNode.appendChild(inputParametersNode);
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 90
diff changeset
735 Iterator<InputValue> it2 = inputParameters.iterator();
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
736 while (it2.hasNext()) {
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 90
diff changeset
737 InputValue inputValue = it2.next();
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
738 Element inputParameterNode =
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
739 creator.create("parameter");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
740 creator.addAttr(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
741 inputParameterNode, "name", inputValue.getName());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
742 creator.addAttr(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
743 inputParameterNode, "type", inputValue.getType());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
744 creator.addAttr(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
745 inputParameterNode, "value", inputValue.getDefaultValue());
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 90
diff changeset
746 inputParametersNode.appendChild(inputParameterNode);
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 90
diff changeset
747 }
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 90
diff changeset
748 }
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
749 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
750 } else {
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
751 log.warn("No Outputmodes given.");
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
752 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
753 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
754 parent.appendChild(outputsNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
755 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
756
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
757 protected Collection<InputData> parseInputData(Document document,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
758 String xPath) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
759 HashMap<String, InputData> returnValue = null;
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
760
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
761 NodeList inputElemets = (NodeList) XMLUtils.xpath(document, xPath,
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
762 XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
763 if (inputElemets != null) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
764 returnValue = new HashMap<String, InputData>();
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
765
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
766 for (int i = 0; i < inputElemets.getLength(); i++) {
204
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
767 Element inputDataNode = (Element)inputElemets.item(i);
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
768 String name = inputDataNode.getAttribute("name");
734ac082c8d1 Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents: 194
diff changeset
769 String value = inputDataNode.getAttribute("value");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
770
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
771 if (returnValue.containsKey(name)) {
78
969faa37a11b Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents: 77
diff changeset
772 InputData inputData = returnValue.get(name);
969faa37a11b Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents: 77
diff changeset
773 inputData.concartValue(value);
969faa37a11b Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents: 77
diff changeset
774 log.debug(inputData.toString());
969faa37a11b Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents: 77
diff changeset
775 returnValue.put(name, inputData);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
776 } else {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
777 InputData inputData = new DefaultInputData(name, value);
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
778
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
779 returnValue.put(name, inputData);
78
969faa37a11b Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents: 77
diff changeset
780 }
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
781 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
782 }
78
969faa37a11b Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents: 77
diff changeset
783 return returnValue.values();
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
784 }
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
785
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
786 /**
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
787 * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document,
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
788 * java.io.OutputStream, de.intevation.artifacts.CallContext)
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
789 */
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
790 @Override
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
791 public void out(Document format, OutputStream outputStream,
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
792 CallContext context) throws IOException {
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
793 log.debug("TGNVArtifactBase.out");
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
794 try {
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
795
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
796 if (current != null && current instanceof OutputState) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
797 ((OutputState) current)
299
d6c75171f1e9 Pass the xml document of the request to OutputTransition for more information about output formats of charts (png,jpeg).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
798 .out(format, this.parseInputData(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
799 format, XPATH_OUTPUT_PARAMS),
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 337
diff changeset
800 outputStream, super.identifier, context);
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
801 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 325
diff changeset
802 } catch (StateException e) {
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
803 log.error(e, e);
89
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
804 throw new IOException(e.getMessage());
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
805 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
806 }
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
807
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
808 protected String readOutputType(Document document) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
809 String value = XMLUtils.xpathString(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
810 document, XPATH_OUTPUT_NAME, ArtifactNamespaceContext.INSTANCE);
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
811 return value;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
812 }
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
813
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
814
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
815 public void setProduct(Product product) {
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
816 this.product = product;
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
817 }
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
818 }
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
819 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org