annotate gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java @ 394:14eecfde4607

Render links to step back to previous states into gui. Added controller to advance back to these states. gnv/trunk@538 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 13 Jan 2010 22:17:02 +0000
parents 416ff31f6273
children 79378c4babde
rev   line source
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.action;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.util.ArrayList;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.util.Collection;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 import java.util.Iterator;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import javax.servlet.http.HttpServletRequest;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import javax.servlet.http.HttpServletResponse;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import org.apache.struts.action.ActionForm;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import org.apache.struts.action.ActionForward;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import org.apache.struts.action.ActionMapping;
18
87002cbd194c Static UI -integration an some refactoringwork done
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
17 import org.w3c.dom.Node;
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import de.intevation.gnv.action.sessionmodel.SessionModel;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
164
5570d9b3282f Implemented a better GUI-Structure for displaying the Statisticdata. issue83
Tim Englich <tim.englich@intevation.de>
parents: 163
diff changeset
24 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet;
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 import de.intevation.gnv.artifactdatabase.objects.InputParameter;
18
87002cbd194c Static UI -integration an some refactoringwork done
Tim Englich <tim.englich@intevation.de>
parents: 17
diff changeset
27 import de.intevation.gnv.util.XMLUtils;
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 import de.intevation.gnv.util.XSLTransformer;
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 /**
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 * @author Tim Englich <tim.englich@intevation.de>
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
32 *
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 */
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 public class NextArtifactStepAction extends ArtifactDatabaseActionBase {
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 /**
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 * the logger, used to log exceptions and additonaly information
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 */
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
38 private static Logger log = Logger
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
39 .getLogger(SelectArtifactFactoryAction.class);
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
40
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 /**
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 * Constructor
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 */
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 public NextArtifactStepAction() {
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 super();
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 }
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 /**
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
49 * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping,
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
50 * org.apache.struts.action.ActionForm,
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
51 * javax.servlet.http.HttpServletRequest,
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
52 * javax.servlet.http.HttpServletResponse)
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 */
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 @Override
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 public ActionForward execute(ActionMapping mapping, ActionForm form,
38
fccf90761825 Format Code to max 80 Chars per Row better Formatter choosen
Tim Englich <tim.englich@intevation.de>
parents: 36
diff changeset
56 HttpServletRequest request,
fccf90761825 Format Code to max 80 Chars per Row better Formatter choosen
Tim Englich <tim.englich@intevation.de>
parents: 36
diff changeset
57 HttpServletResponse response) throws Exception {
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 32
diff changeset
58 log.debug("NextArtifactStepAction.execute");
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
59 SessionModel sm = SessionModelFactory.getInstance()
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
60 .getSessionModel(request);
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 32
diff changeset
61 ArtifactDescription ad = sm.getArtifactDescription();
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
62 if (ad != null){
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
63 Collection<String> inputParameter = ad.getInputParameter();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
64 Collection<InputParameter> ips = null;
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
65 if (inputParameter != null) {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
66 ips = new ArrayList<InputParameter>(inputParameter.size());
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
67 Iterator<String> it = inputParameter.iterator();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
68 while (it.hasNext()) {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
69 String name = it.next();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
70 String[] values = request.getParameterValues(name);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
71 InputParameter ip = new DefaultInputParameter(name, values);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
72 ips.add(ip);
154
d6b82c585f1f Bugfix NPE was thrown when an Exception occured in the Called ArtifactDatabase-Server issue58.
Tim Englich <tim.englich@intevation.de>
parents: 150
diff changeset
73 }
d6b82c585f1f Bugfix NPE was thrown when an Exception occured in the Called ArtifactDatabase-Server issue58.
Tim Englich <tim.englich@intevation.de>
parents: 150
diff changeset
74 }
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
75 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
76 .getInstance()
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
77 .getArtifactDatabaseClient(getLocale(request));
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
78 if (ad.getReachableStates() != null
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
79 && !ad.getReachableStates().isEmpty()) {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
80 // TODO: Woher kommt der zu erreichende Status;
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
81 String target = null;
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
82 if (ad.getReachableStates().size() > 1) {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
83 target = request.getParameter("product"); // TODO HACK for
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
84 // Propducts every
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
85 // other Step has
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
86 // currently only
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
87 // one reachable
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
88 // state.
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
89 } else {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
90 target = ad.getReachableStates().iterator().next();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
91 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
92
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
93 ArtifactDescription artifactDescription;
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
94 try {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
95 artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(),
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
96 sm.getCurrentArtifact(),
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
97 target, ips);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
98 } catch (Exception e) {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
99 log.error(e, e);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
100 request.setAttribute(
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
101 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
102 .getMessage());
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
103 artifactDescription = sm.getArtifactDescription();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
104 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
105
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
106 Node currentUI = artifactDescription.getCurrentUI();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
107 if (currentUI != null){
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
108 XSLTransformer transformer = new XSLTransformer();
394
14eecfde4607 Render links to step back to previous states into gui. Added controller to advance back to these states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
109 String url = response.encodeURL(
14eecfde4607 Render links to step back to previous states into gui. Added controller to advance back to these states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
110 mapping.findForward("back").getPath());
14eecfde4607 Render links to step back to previous states into gui. Added controller to advance back to these states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
111 transformer.addParameter("back-url", url);
14eecfde4607 Render links to step back to previous states into gui. Added controller to advance back to these states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
112
389
416ff31f6273 Removed local-name() method from xsl stylesheet and adjusted xpathes while reading xml documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 286
diff changeset
113 Node dynamicUINode = new XMLUtils().getNodeXPath(currentUI,"art:dynamic");
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
114 if (dynamicUINode != null){
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
115 String ui = transformer
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
116 .transform(
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
117 dynamicUINode,
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
118 "UTF-8",
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
119 request
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
120 .getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
121
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
122 request.setAttribute("ui", ui);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
123 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
124
389
416ff31f6273 Removed local-name() method from xsl stylesheet and adjusted xpathes while reading xml documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 286
diff changeset
125 Node staticUINode = new XMLUtils().getNodeXPath(currentUI, "art:static");
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
126 if (staticUINode != null){
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
127 String staticUI = transformer
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
128 .transform(
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
129 staticUINode,
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
130 "UTF-8",
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
131 request
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
132 .getRealPath("WEB-INF/config/templates/describe-ui-static.xsl"));
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
133 request.setAttribute("staticui", staticUI);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
134 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
135 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
136 request.setAttribute("furthertargets",
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
137 (ad.getReachableStates() != null && !ad
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
138 .getReachableStates().isEmpty()));
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
139
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
140 } else {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
141 // statistic abholen und in das sessionmodell schreiben.
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
142 ArtifactDescription artifactDescription;
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
143 try{
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
144
164
5570d9b3282f Implemented a better GUI-Structure for displaying the Statisticdata. issue83
Tim Englich <tim.englich@intevation.de>
parents: 163
diff changeset
145 Collection<ArtifactStatisticsSet> statistics = adc
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
146 .calculateStatistics(sm.getSelectedArtifactFactory(),
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
147 sm.getCurrentArtifact());
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
148 sm.setStatistics(statistics);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
149 artifactDescription = adc
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
150 .getCurrentStepDescription(sm
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
151 .getSelectedArtifactFactory(), sm
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
152 .getCurrentArtifact(),
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
153 true);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
154
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
155 request.setAttribute("diagramm", true);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
156
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
157 } catch (Exception e) {
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
158 log.error(e, e);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
159 request.setAttribute(
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
160 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
161 .getMessage());
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
162 artifactDescription = sm.getArtifactDescription();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
163 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
164
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
165 Node currentUI = artifactDescription.getCurrentUI();
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
166 if (currentUI != null){
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
167 XSLTransformer transformer = new XSLTransformer();
394
14eecfde4607 Render links to step back to previous states into gui. Added controller to advance back to these states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
168 String url = response.encodeURL(
14eecfde4607 Render links to step back to previous states into gui. Added controller to advance back to these states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
169 mapping.findForward("back").getPath());
14eecfde4607 Render links to step back to previous states into gui. Added controller to advance back to these states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
170 transformer.addParameter("back-url", url);
389
416ff31f6273 Removed local-name() method from xsl stylesheet and adjusted xpathes while reading xml documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 286
diff changeset
171 Node dynamicUINode = new XMLUtils().getNodeXPath(currentUI,"art:dynamic");
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
172 if (dynamicUINode != null){
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
173 String ui = transformer
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
174 .transform(
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
175 dynamicUINode,
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
176 "UTF-8",
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
177 request
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
178 .getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
179
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
180 request.setAttribute("ui", ui);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
181 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
182
389
416ff31f6273 Removed local-name() method from xsl stylesheet and adjusted xpathes while reading xml documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 286
diff changeset
183 Node staticUINode = new XMLUtils().getNodeXPath(currentUI, "art:static");
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
184 if (staticUINode != null){
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
185 String staticUI = transformer
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
186 .transform(
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
187 staticUINode,
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
188 "UTF-8",
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
189 request
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
190 .getRealPath("WEB-INF/config/templates/describe-ui-static.xsl"));
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
191 request.setAttribute("staticui", staticUI);
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
192 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
193 }
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
194 request.setAttribute("furthertargets", false);
150
c5408b0f34c7 Now the UI will compelte be shown if the User has done an Mistake entering
Tim Englich <tim.englich@intevation.de>
parents: 40
diff changeset
195 }
163
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
196 }else{
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
197 log.warn("SessionTimeout has occured");
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
198 request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
199 "SessionTimeout has occured");
1fe52a0cbd1f Catch NPE and tell the user that the Session has expired. issue80
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
200 new FetchArtifactFactoriesAction().execute(mapping, form, request, response);
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 32
diff changeset
201 }
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 32
diff changeset
202 return super.execute(mapping, form, request, response);
12
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
203 }
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
204
4ebe57b170d3 Integration of moving through the Artifact-States and rendering the UI.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
205 }

http://dive4elements.wald.intevation.org