Mercurial > dive4elements > gnv-client
comparison gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java @ 36:ad381cc47217
Format Code to max 80 Chars per Row
gnv/trunk@172 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 02 Oct 2009 08:54:13 +0000 |
parents | 25fdec8b4c69 |
children | fccf90761825 |
comparison
equal
deleted
inserted
replaced
35:4405f31bbc30 | 36:ad381cc47217 |
---|---|
26 import de.intevation.gnv.util.XMLUtils; | 26 import de.intevation.gnv.util.XMLUtils; |
27 import de.intevation.gnv.util.XSLTransformer; | 27 import de.intevation.gnv.util.XSLTransformer; |
28 | 28 |
29 /** | 29 /** |
30 * @author Tim Englich <tim.englich@intevation.de> | 30 * @author Tim Englich <tim.englich@intevation.de> |
31 * | 31 * |
32 */ | 32 */ |
33 public class ChangeOptionsAction extends ArtifactDatabaseActionBase { | 33 public class ChangeOptionsAction extends ArtifactDatabaseActionBase { |
34 /** | 34 /** |
35 * the logger, used to log exceptions and additonaly information | 35 * the logger, used to log exceptions and additonaly information |
36 */ | 36 */ |
37 private static Logger log = Logger.getLogger(ChangeOptionsAction.class); | 37 private static Logger log = Logger.getLogger(ChangeOptionsAction.class); |
38 | |
38 /** | 39 /** |
39 * Constructor | 40 * Constructor |
40 */ | 41 */ |
41 public ChangeOptionsAction() { | 42 public ChangeOptionsAction() { |
42 super(); | 43 super(); |
46 public ActionForward execute(ActionMapping mapping, ActionForm form, | 47 public ActionForward execute(ActionMapping mapping, ActionForm form, |
47 HttpServletRequest request, HttpServletResponse response) | 48 HttpServletRequest request, HttpServletResponse response) |
48 throws Exception { | 49 throws Exception { |
49 log.debug("NextArtifactStepAction.execute"); | 50 log.debug("NextArtifactStepAction.execute"); |
50 try { | 51 try { |
51 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); | 52 SessionModel sm = SessionModelFactory.getInstance() |
52 | 53 .getSessionModel(request); |
54 | |
53 String target = request.getParameter("target"); | 55 String target = request.getParameter("target"); |
54 OutputMode outputMode = sm.getOutputMode(target); | 56 OutputMode outputMode = sm.getOutputMode(target); |
55 if (outputMode != null){ | 57 if (outputMode != null) { |
56 | 58 |
57 Collection<OutputParameter> op = outputMode.getOutputParameters(); | 59 Collection<OutputParameter> op = outputMode |
58 if (op != null){ | 60 .getOutputParameters(); |
61 if (op != null) { | |
59 Iterator<OutputParameter> it = op.iterator(); | 62 Iterator<OutputParameter> it = op.iterator(); |
60 DiagrammOptions diagrammOptions = new DiagrammOptions(); | 63 DiagrammOptions diagrammOptions = new DiagrammOptions(); |
61 while (it.hasNext()){ | 64 while (it.hasNext()) { |
62 OutputParameter parameter = it.next(); | 65 OutputParameter parameter = it.next(); |
63 diagrammOptions.setValue(parameter.getName(), request.getParameter(parameter.getName())); | 66 diagrammOptions.setValue(parameter.getName(), request |
64 | 67 .getParameter(parameter.getName())); |
68 | |
65 } | 69 } |
66 sm.setDiagrammOptions(diagrammOptions); | 70 sm.setDiagrammOptions(diagrammOptions); |
67 } | 71 } |
68 } | 72 } |
69 | 73 |
70 ArtifactDescription ad = sm.getArtifactDescription(); | 74 ArtifactDescription ad = sm.getArtifactDescription(); |
71 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); | 75 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory |
72 ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); | 76 .getInstance().getArtifactDatabaseClient(); |
73 | 77 ArtifactDescription artifactDescription = adc |
78 .getCurrentStepDescription(sm.getSelectedArtifactFactory(), | |
79 sm.getCurrentArtifact()); | |
80 | |
74 Node currentUI = artifactDescription.getCurrentUI(); | 81 Node currentUI = artifactDescription.getCurrentUI(); |
75 XSLTransformer transformer = new XSLTransformer(); | 82 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")); | 83 String ui = transformer.transform(new XMLUtils().getNodeXPath( |
77 | 84 currentUI, "dynamic"), "UTF-8", request |
85 .getRealPath("WEB-INF/config/templates/describe-ui.xsl")); | |
86 | |
78 request.setAttribute("ui", ui); | 87 request.setAttribute("ui", ui); |
79 | 88 |
80 String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); | 89 String staticUI = transformer |
90 .transform( | |
91 new XMLUtils().getNodeXPath(currentUI, "static"), | |
92 "UTF-8", | |
93 request | |
94 .getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); | |
81 request.setAttribute("staticui", staticUI); | 95 request.setAttribute("staticui", staticUI); |
82 request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty())); | 96 request.setAttribute("furthertargets", |
83 | 97 (ad.getReachableStates() != null && !ad |
84 if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){ | 98 .getReachableStates().isEmpty())); |
85 }else{ | 99 |
100 if (ad.getReachableStates() != null | |
101 && !ad.getReachableStates().isEmpty()) { | |
102 } else { | |
86 request.setAttribute("diagramm", true); | 103 request.setAttribute("diagramm", true); |
87 } | 104 } |
88 return super.execute(mapping, form, request, response); | 105 return super.execute(mapping, form, request, response); |
89 } catch (Exception e) { | 106 } catch (Exception e) { |
90 log.error(e,e); | 107 log.error(e, e); |
91 request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); | 108 request.setAttribute( |
109 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e | |
110 .getMessage()); | |
92 return super.getExceptionForward(mapping); | 111 return super.getExceptionForward(mapping); |
93 } | 112 } |
94 } | 113 } |
95 | |
96 | |
97 | 114 |
98 } | 115 } |