comparison gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java @ 150:c5408b0f34c7

Now the UI will compelte be shown if the User has done an Mistake entering values to input-fields eg. Coordinates or formatted Date-Strings. issue 35 gnv/trunk@242 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 19 Oct 2009 10:30:28 +0000
parents 23a4f196d7d6
children d6b82c585f1f
comparison
equal deleted inserted replaced
149:9b7f74e58f8d 150:c5408b0f34c7
53 */ 53 */
54 @Override 54 @Override
55 public ActionForward execute(ActionMapping mapping, ActionForm form, 55 public ActionForward execute(ActionMapping mapping, ActionForm form,
56 HttpServletRequest request, 56 HttpServletRequest request,
57 HttpServletResponse response) throws Exception { 57 HttpServletResponse response) throws Exception {
58 try {
59 log.debug("NextArtifactStepAction.execute"); 58 log.debug("NextArtifactStepAction.execute");
60 SessionModel sm = SessionModelFactory.getInstance() 59 SessionModel sm = SessionModelFactory.getInstance()
61 .getSessionModel(request); 60 .getSessionModel(request);
62 ArtifactDescription ad = sm.getArtifactDescription(); 61 ArtifactDescription ad = sm.getArtifactDescription();
63 Collection<String> inputParameter = ad.getInputParameter(); 62 Collection<String> inputParameter = ad.getInputParameter();
88 // state. 87 // state.
89 } else { 88 } else {
90 target = ad.getReachableStates().iterator().next(); 89 target = ad.getReachableStates().iterator().next();
91 } 90 }
92 91
93 ArtifactDescription artifactDescription = adc.doNextStep(sm 92 ArtifactDescription artifactDescription;
94 .getSelectedArtifactFactory(), sm.getCurrentArtifact(), 93 try {
95 target, ips); 94 artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(),
95 sm.getCurrentArtifact(),
96 target, ips);
97 } catch (Exception e) {
98 log.error(e, e);
99 request.setAttribute(
100 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
101 .getMessage());
102 artifactDescription = sm.getArtifactDescription();
103 }
96 104
97 Node currentUI = artifactDescription.getCurrentUI(); 105 Node currentUI = artifactDescription.getCurrentUI();
98 XSLTransformer transformer = new XSLTransformer(); 106 XSLTransformer transformer = new XSLTransformer();
99 String ui = transformer 107 String ui = transformer
100 .transform( 108 .transform(
118 request.setAttribute("furthertargets", 126 request.setAttribute("furthertargets",
119 (ad.getReachableStates() != null && !ad 127 (ad.getReachableStates() != null && !ad
120 .getReachableStates().isEmpty())); 128 .getReachableStates().isEmpty()));
121 129
122 } else { 130 } else {
123
124 adc.doFeed(sm.getSelectedArtifactFactory(), sm
125 .getCurrentArtifact(), ips);
126
127 request.setAttribute("diagramm", true);
128
129 // statistic abholen und in das sessionmodell schreiben. 131 // statistic abholen und in das sessionmodell schreiben.
130 132 ArtifactDescription artifactDescription;
131 Collection<ArtifactStatisticValue> statistics = adc 133 try{
132 .calculateStatistics(sm.getSelectedArtifactFactory(), 134 adc.doFeed(sm.getSelectedArtifactFactory(), sm
133 sm.getCurrentArtifact()); 135 .getCurrentArtifact(), ips);
134 sm.setStatistics(statistics); 136
135 137 Collection<ArtifactStatisticValue> statistics = adc
136 ArtifactDescription artifactDescription = adc 138 .calculateStatistics(sm.getSelectedArtifactFactory(),
137 .getCurrentStepDescription(sm 139 sm.getCurrentArtifact());
138 .getSelectedArtifactFactory(), sm 140 sm.setStatistics(statistics);
139 .getCurrentArtifact()); 141 artifactDescription = adc
142 .getCurrentStepDescription(sm
143 .getSelectedArtifactFactory(), sm
144 .getCurrentArtifact());
145
146 request.setAttribute("diagramm", true);
147
148 } catch (Exception e) {
149 log.error(e, e);
150 request.setAttribute(
151 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
152 .getMessage());
153 artifactDescription = sm.getArtifactDescription();
154 }
140 155
141 Node currentUI = artifactDescription.getCurrentUI(); 156 Node currentUI = artifactDescription.getCurrentUI();
142 XSLTransformer transformer = new XSLTransformer(); 157 XSLTransformer transformer = new XSLTransformer();
143 String ui = transformer 158 String ui = transformer
144 .transform( 159 .transform(
160 request.setAttribute("staticui", staticUI); 175 request.setAttribute("staticui", staticUI);
161 176
162 request.setAttribute("furthertargets", false); 177 request.setAttribute("furthertargets", false);
163 } 178 }
164 return super.execute(mapping, form, request, response); 179 return super.execute(mapping, form, request, response);
165 } catch (Exception e) {
166 log.error(e, e);
167 request.setAttribute(
168 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
169 .getMessage());
170 return super.getExceptionForward(mapping);
171 }
172 } 180 }
173 181
174 } 182 }

http://dive4elements.wald.intevation.org