Mercurial > dive4elements > gnv-client
comparison gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java @ 998:27029f0ec7e1
Reverted the changes of rev1194.
gnv/trunk@1199 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 11 Jun 2010 10:28:50 +0000 |
parents | 9b126bceb0b2 |
children | b1eea43ba133 |
comparison
equal
deleted
inserted
replaced
997:f55692e3e0ce | 998:27029f0ec7e1 |
---|---|
23 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; | 23 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; |
24 import de.intevation.gnv.util.ArtifactNamespaceContext; | 24 import de.intevation.gnv.util.ArtifactNamespaceContext; |
25 import de.intevation.gnv.util.XMLUtils; | 25 import de.intevation.gnv.util.XMLUtils; |
26 import de.intevation.gnv.util.XSLTransformer; | 26 import de.intevation.gnv.util.XSLTransformer; |
27 | 27 |
28 import org.apache.log4j.Logger; | |
29 | |
30 /** | 28 /** |
31 * This controller is called to fetch the current artifact description using the | 29 * This controller is called to fetch the current artifact description using the |
32 * describe operation. The describe document is used to feed an XSL transformer | 30 * describe operation. The describe document is used to feed an XSL transformer |
33 * that parses the xml and creats html output representing the parameter panel. | 31 * that parses the xml and creats html output representing the parameter panel. |
34 * The html code is stored as attribute on the request object which is queried | 32 * The html code is stored as attribute on the request object which is queried |
35 * in a jsp page later. | 33 * in a jsp page later. |
36 * | 34 * |
37 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
38 */ | 36 */ |
39 public class DescribeUIAction extends ArtifactDatabaseActionBase { | 37 public class DescribeUIAction extends ArtifactDatabaseActionBase { |
40 | |
41 private static Logger log = Logger | |
42 .getLogger(DescribeUIAction.class); | |
43 | 38 |
44 public static final String XPATH_DYNAMIC_UI = "art:dynamic"; | 39 public static final String XPATH_DYNAMIC_UI = "art:dynamic"; |
45 public static final String XPATH_STATIC_UI = "art:static"; | 40 public static final String XPATH_STATIC_UI = "art:static"; |
46 | 41 |
47 public static final String XSL_SHEET_DYNAMIC = | 42 public static final String XSL_SHEET_DYNAMIC = |
59 /** | 54 /** |
60 * Constructor | 55 * Constructor |
61 */ | 56 */ |
62 public DescribeUIAction() { | 57 public DescribeUIAction() { |
63 super(); | 58 super(); |
64 } | |
65 | |
66 public static String getInputException(HttpServletRequest request) { | |
67 Object msg = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID); | |
68 return msg != null ? msg.toString() : ""; | |
69 } | 59 } |
70 | 60 |
71 | 61 |
72 @Override | 62 @Override |
73 public ActionForward execute( | 63 public ActionForward execute( |
112 | 102 |
113 Node currentUI = artifactDescription.getCurrentUI(); | 103 Node currentUI = artifactDescription.getCurrentUI(); |
114 if (currentUI != null) { | 104 if (currentUI != null) { |
115 ResourceBundle res = ResourceBundle.getBundle( | 105 ResourceBundle res = ResourceBundle.getBundle( |
116 "applicationMessages", locale); | 106 "applicationMessages", locale); |
117 String editText = res.getString( | 107 String editText = res.getString( |
118 "gnviewer.history.back.button"); | 108 "gnviewer.history.back.button"); |
119 String submitButton = res.getString( | |
120 "gnviewer.select.button.src"); | |
121 String exampleLinestring = res.getString( | 109 String exampleLinestring = res.getString( |
122 "gnviewer.example.linestring"); | 110 "gnviewer.example.linestring"); |
123 String examplePolygon = res.getString( | 111 String examplePolygon = res.getString( |
124 "gnviewer.example.polygon"); | 112 "gnviewer.example.polygon"); |
125 | 113 |
126 XSLTransformer transformer = new XSLTransformer(); | 114 XSLTransformer transformer = new XSLTransformer(); |
127 | 115 |
128 String nextUrl = response.encodeURL( | |
129 mapping.findForward("next").getPath()); | |
130 | |
131 String url = response.encodeURL( | 116 String url = response.encodeURL( |
132 mapping.findForward("back").getPath()); | 117 mapping.findForward("back").getPath()); |
133 | |
134 | |
135 transformer.addParameter( | |
136 "uuid", | |
137 sm.getCurrentArtifact().getDescription()); | |
138 | |
139 transformer.addParameter( | |
140 "exception", | |
141 getInputException(request)); | |
142 | |
143 | |
144 Object ft = request.getAttribute("furthertargets"); | |
145 | |
146 transformer.addParameter("further", | |
147 ft == null || (ft instanceof Boolean && ((Boolean)ft).booleanValue()) | |
148 ? "true" | |
149 : "false"); | |
150 | |
151 transformer.addParameter("next-url", nextUrl); | |
152 transformer.addParameter("back-url", url); | 118 transformer.addParameter("back-url", url); |
153 transformer.addParameter("edit", editText); | 119 transformer.addParameter("edit", editText); |
154 transformer.addParameter("example-polygon", examplePolygon); | 120 transformer.addParameter("example-polygon", examplePolygon); |
155 transformer.addParameter( | |
156 "gnviewer-select-button-src", | |
157 submitButton); | |
158 transformer.addParameter( | 121 transformer.addParameter( |
159 "example-linestring", | 122 "example-linestring", |
160 exampleLinestring); | 123 exampleLinestring); |
161 | 124 |
162 String fisUrl = response.encodeURL( | 125 String fisUrl = response.encodeURL( |
170 XPathConstants.NODE, | 133 XPathConstants.NODE, |
171 ArtifactNamespaceContext.INSTANCE | 134 ArtifactNamespaceContext.INSTANCE |
172 ); | 135 ); |
173 | 136 |
174 String ui = transformer.transform( | 137 String ui = transformer.transform( |
175 dynamicNode.getParentNode(), | 138 dynamicNode, |
176 "UTF-8", | 139 "UTF-8", |
177 request.getRealPath(XSL_SHEET_DYNAMIC)); | 140 request.getRealPath(XSL_SHEET_DYNAMIC |
141 )); | |
178 | 142 |
179 if (ui != null && ui.length() > 1) | 143 if (ui != null && ui.length() > 1) |
180 request.setAttribute("ui", ui); | 144 request.setAttribute("ui", ui); |
181 | 145 |
182 // fetch static part from describe document and transform it | 146 // fetch static part from describe document and transform it |