Mercurial > dive4elements > gnv-client
comparison gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java @ 34:25fdec8b4c69
Added Global Errorhandling to the GNV-Client
gnv/trunk@170 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 02 Oct 2009 08:38:57 +0000 |
parents | 07e9c137a2f1 |
children | ad381cc47217 |
comparison
equal
deleted
inserted
replaced
33:32ffff3f67aa | 34:25fdec8b4c69 |
---|---|
45 @Override | 45 @Override |
46 public ActionForward execute(ActionMapping mapping, ActionForm form, | 46 public ActionForward execute(ActionMapping mapping, ActionForm form, |
47 HttpServletRequest request, HttpServletResponse response) | 47 HttpServletRequest request, HttpServletResponse response) |
48 throws Exception { | 48 throws Exception { |
49 log.debug("NextArtifactStepAction.execute"); | 49 log.debug("NextArtifactStepAction.execute"); |
50 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); | 50 try { |
51 | 51 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); |
52 String target = request.getParameter("target"); | |
53 OutputMode outputMode = sm.getOutputMode(target); | |
54 if (outputMode != null){ | |
55 | 52 |
56 Collection<OutputParameter> op = outputMode.getOutputParameters(); | 53 String target = request.getParameter("target"); |
57 if (op != null){ | 54 OutputMode outputMode = sm.getOutputMode(target); |
58 Iterator<OutputParameter> it = op.iterator(); | 55 if (outputMode != null){ |
59 DiagrammOptions diagrammOptions = new DiagrammOptions(); | 56 |
60 while (it.hasNext()){ | 57 Collection<OutputParameter> op = outputMode.getOutputParameters(); |
61 OutputParameter parameter = it.next(); | 58 if (op != null){ |
62 diagrammOptions.setValue(parameter.getName(), request.getParameter(parameter.getName())); | 59 Iterator<OutputParameter> it = op.iterator(); |
63 | 60 DiagrammOptions diagrammOptions = new DiagrammOptions(); |
61 while (it.hasNext()){ | |
62 OutputParameter parameter = it.next(); | |
63 diagrammOptions.setValue(parameter.getName(), request.getParameter(parameter.getName())); | |
64 | |
65 } | |
66 sm.setDiagrammOptions(diagrammOptions); | |
64 } | 67 } |
65 sm.setDiagrammOptions(diagrammOptions); | |
66 } | 68 } |
69 | |
70 ArtifactDescription ad = sm.getArtifactDescription(); | |
71 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); | |
72 ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); | |
73 | |
74 Node currentUI = artifactDescription.getCurrentUI(); | |
75 XSLTransformer transformer = new XSLTransformer(); | |
76 String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); | |
77 | |
78 request.setAttribute("ui", ui); | |
79 | |
80 String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); | |
81 request.setAttribute("staticui", staticUI); | |
82 request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty())); | |
83 | |
84 if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){ | |
85 }else{ | |
86 request.setAttribute("diagramm", true); | |
87 } | |
88 return super.execute(mapping, form, request, response); | |
89 } catch (Exception e) { | |
90 log.error(e,e); | |
91 request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); | |
92 return super.getExceptionForward(mapping); | |
67 } | 93 } |
68 | |
69 ArtifactDescription ad = sm.getArtifactDescription(); | |
70 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); | |
71 ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); | |
72 | |
73 Node currentUI = artifactDescription.getCurrentUI(); | |
74 XSLTransformer transformer = new XSLTransformer(); | |
75 String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); | |
76 | |
77 request.setAttribute("ui", ui); | |
78 | |
79 String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); | |
80 request.setAttribute("staticui", staticUI); | |
81 request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty())); | |
82 | |
83 if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){ | |
84 }else{ | |
85 request.setAttribute("diagramm", true); | |
86 } | |
87 return super.execute(mapping, form, request, response); | |
88 } | 94 } |
89 | 95 |
90 | 96 |
91 | 97 |
92 } | 98 } |