annotate gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java @ 1008:1b42a86184f6

Removed the changes of rev1206 and 1214. gnv/trunk@1222 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 25 Jun 2010 08:11:39 +0000
parents b1eea43ba133
children 28a0628b11b0
rev   line source
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.action;
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
706
2659a5b1fa1e Added a link (and a controller) to toggle between german and english language (issue254).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 703
diff changeset
3 import java.util.Locale;
703
21ad44ccdb84 Tooltip text of the back-button became language specific (issue227).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
4 import java.util.ResourceBundle;
21ad44ccdb84 Tooltip text of the back-button became language specific (issue227).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
5
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import javax.servlet.http.HttpServletRequest;
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import javax.servlet.http.HttpServletResponse;
991
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 966
diff changeset
8 import javax.servlet.http.HttpSession;
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import javax.xml.xpath.XPathConstants;
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
682
d3062dc8626a Application is now sensitive to changes of the preferred browser language in the current session (issue30).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 681
diff changeset
12 import org.apache.struts.Globals;
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.apache.struts.action.ActionForm;
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.apache.struts.action.ActionForward;
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.apache.struts.action.ActionMapping;
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
16 import org.w3c.dom.Node;
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
18 import de.intevation.gnv.action.sessionmodel.SessionModel;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
19 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
20 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
21 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
22 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
23 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
24 import de.intevation.gnv.util.ArtifactNamespaceContext;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
25 import de.intevation.gnv.util.XMLUtils;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
26 import de.intevation.gnv.util.XSLTransformer;
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 /**
690
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
29 * This controller is called to fetch the current artifact description using the
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
30 * describe operation. The describe document is used to feed an XSL transformer
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
31 * that parses the xml and creats html output representing the parameter panel.
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
32 * The html code is stored as attribute on the request object which is queried
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
33 * in a jsp page later.
699
af22fa5567a6 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 690
diff changeset
34 *
684
57fa8019fbdc Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 683
diff changeset
35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 */
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 public class DescribeUIAction extends ArtifactDatabaseActionBase {
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public static final String XPATH_DYNAMIC_UI = "art:dynamic";
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public static final String XPATH_STATIC_UI = "art:static";
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 public static final String XSL_SHEET_DYNAMIC =
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 "WEB-INF/config/templates/describe-ui.xsl";
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 public static final String XSL_SHEET_STATIC =
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 "WEB-INF/config/templates/describe-ui-static.xsl";
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
48 /**
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
49 * the logger, used to log exceptions and additonaly information
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
50 */
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 private static Logger logger = Logger.getLogger(DescribeUIAction.class);
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
54 /**
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
55 * Constructor
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 720
diff changeset
56 */
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 public DescribeUIAction() {
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 super();
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 }
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 @Override
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 public ActionForward execute(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 ActionMapping mapping,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 ActionForm form,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 HttpServletRequest request,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 HttpServletResponse response
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 ) throws Exception
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 {
991
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 966
diff changeset
70 if (isSessionExhausted(request)) {
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 966
diff changeset
71 // session timed out before
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 966
diff changeset
72 return sessionExhaustedForward(mapping, form, request, response);
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 966
diff changeset
73 }
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 966
diff changeset
74
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 logger.info("describe user interface");
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 try {
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 // render describe document and create user interface
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 request);
706
2659a5b1fa1e Added a link (and a controller) to toggle between german and english language (issue254).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 703
diff changeset
80 Locale tmp = sm.getCurrentLocale();
2659a5b1fa1e Added a link (and a controller) to toggle between german and english language (issue254).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 703
diff changeset
81 Locale locale = tmp != null ? tmp : request.getLocale();
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
706
2659a5b1fa1e Added a link (and a controller) to toggle between german and english language (issue254).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 703
diff changeset
84 .getInstance().getArtifactDatabaseClient(locale);
2659a5b1fa1e Added a link (and a controller) to toggle between german and english language (issue254).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 703
diff changeset
85 request.getSession().setAttribute(Globals.LOCALE_KEY, locale);
715
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
86 ArtifactObject artifactFactory = sm.getSelectedArtifactFactory();
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
87
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
88 if (artifactFactory == null) {
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
89 logger.error("No connection to artifact server.");
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
90 request.setAttribute(
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
91 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
92 "java.io.ioexception..connection.refused");
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
93
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
94 return super.getExceptionForward(mapping);
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
95 }
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 ArtifactDescription artifactDescription =
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 adc.getCurrentStepDescription(
715
0aeac0fe5db2 Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 706
diff changeset
99 artifactFactory,
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 sm.getCurrentArtifact(),
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 true);
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 Node currentUI = artifactDescription.getCurrentUI();
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 if (currentUI != null) {
703
21ad44ccdb84 Tooltip text of the back-button became language specific (issue227).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
105 ResourceBundle res = ResourceBundle.getBundle(
706
2659a5b1fa1e Added a link (and a controller) to toggle between german and english language (issue254).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 703
diff changeset
106 "applicationMessages", locale);
1008
1b42a86184f6 Removed the changes of rev1206 and 1214.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1002
diff changeset
107 String editText = res.getString(
966
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
108 "gnviewer.history.back.button");
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
109 String exampleLinestring = res.getString(
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
110 "gnviewer.example.linestring");
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
111 String examplePolygon = res.getString(
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
112 "gnviewer.example.polygon");
703
21ad44ccdb84 Tooltip text of the back-button became language specific (issue227).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
113
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 XSLTransformer transformer = new XSLTransformer();
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 String url = response.encodeURL(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 mapping.findForward("back").getPath());
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 transformer.addParameter("back-url", url);
703
21ad44ccdb84 Tooltip text of the back-button became language specific (issue227).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
119 transformer.addParameter("edit", editText);
966
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
120 transformer.addParameter("example-polygon", examplePolygon);
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
121 transformer.addParameter(
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
122 "example-linestring",
13de46229f63 I18N of links to insert example linestrings/polygons (issue272).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 963
diff changeset
123 exampleLinestring);
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 String fisUrl = response.encodeURL(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 mapping.findForward("selectfis").getPath());
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 transformer.addParameter("selectfis", fisUrl);
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 // fetch dynamic part from describe document and transform it
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 Node dynamicNode = (Node) XMLUtils.xpath(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 currentUI,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 XPATH_DYNAMIC_UI,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 XPathConstants.NODE,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 ArtifactNamespaceContext.INSTANCE
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 );
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 String ui = transformer.transform(
1008
1b42a86184f6 Removed the changes of rev1206 and 1214.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1002
diff changeset
138 dynamicNode,
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 "UTF-8",
1008
1b42a86184f6 Removed the changes of rev1206 and 1214.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1002
diff changeset
140 request.getRealPath(XSL_SHEET_DYNAMIC
1b42a86184f6 Removed the changes of rev1206 and 1214.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1002
diff changeset
141 ));
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 if (ui != null && ui.length() > 1)
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 request.setAttribute("ui", ui);
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 // fetch static part from describe document and transform it
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 Node staticNode = (Node) XMLUtils.xpath(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 currentUI,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 XPATH_STATIC_UI,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 XPathConstants.NODE,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 ArtifactNamespaceContext.INSTANCE
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 );
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 String staticUI = transformer.transform(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 staticNode,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 "UTF-8",
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 request.getRealPath(XSL_SHEET_STATIC));
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 if (staticUI != null && staticUI.length() > 1)
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 409
diff changeset
160 request.setAttribute("staticui", staticUI);
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 }
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 return super.execute(mapping, form, request, response);
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 }
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 catch (Exception e) {
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 logger.error(e, e);
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 request.setAttribute(
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 e.getMessage());
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 return super.getExceptionForward(mapping);
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 }
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 }
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 }
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org