comparison gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.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 4405f31bbc30
children fccf90761825
comparison
equal deleted inserted replaced
35:4405f31bbc30 36:ad381cc47217
21 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; 21 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
22 import de.intevation.gnv.util.XSLTransformer; 22 import de.intevation.gnv.util.XSLTransformer;
23 23
24 /** 24 /**
25 * @author Tim Englich <tim.englich@intevation.de> 25 * @author Tim Englich <tim.englich@intevation.de>
26 * 26 *
27 */ 27 */
28 public class SelectArtifactFactoryAction extends ArtifactDatabaseActionBase { 28 public class SelectArtifactFactoryAction extends ArtifactDatabaseActionBase {
29 /** 29 /**
30 * the logger, used to log exceptions and additonaly information 30 * the logger, used to log exceptions and additonaly information
31 */ 31 */
32 private static Logger log = Logger.getLogger(SelectArtifactFactoryAction.class); 32 private static Logger log = Logger
33 33 .getLogger(SelectArtifactFactoryAction.class);
34
34 /** 35 /**
35 * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 36 * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping,
37 * org.apache.struts.action.ActionForm,
38 * javax.servlet.http.HttpServletRequest,
39 * javax.servlet.http.HttpServletResponse)
36 */ 40 */
37 @Override 41 @Override
38 public ActionForward execute(ActionMapping mapping, ActionForm form, 42 public ActionForward execute(ActionMapping mapping, ActionForm form,
39 HttpServletRequest request, HttpServletResponse response) 43 HttpServletRequest request, HttpServletResponse response)
40 throws Exception { 44 throws Exception {
41 log.debug("SelectArtifactFactoryAction.execute"); 45 log.debug("SelectArtifactFactoryAction.execute");
42 String selectedArtifactFactoryID = request.getParameter("artifactFactory"); 46 String selectedArtifactFactoryID = request
43 log.debug("Selected ArtifactFactory ==> "+selectedArtifactFactoryID); 47 .getParameter("artifactFactory");
44 48 log.debug("Selected ArtifactFactory ==> " + selectedArtifactFactoryID);
49
45 try { 50 try {
46 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); 51 SessionModel sm = SessionModelFactory.getInstance()
47 Collection<ArtifactObject> artifactFactories = sm.getArtifactFactories(); 52 .getSessionModel(request);
53 Collection<ArtifactObject> artifactFactories = sm
54 .getArtifactFactories();
48 // Löscht die Artifactspezifischen Attribute am Sessionmodel 55 // Löscht die Artifactspezifischen Attribute am Sessionmodel
49 sm.resetModel(); 56 sm.resetModel();
50 if (artifactFactories == null || artifactFactories.isEmpty()){ 57 if (artifactFactories == null || artifactFactories.isEmpty()) {
51 new FetchArtifactFactoriesAction().execute(mapping, form, request, response); 58 new FetchArtifactFactoriesAction().execute(mapping, form,
52 59 request, response);
60
53 } 61 }
54 62
55 sm.selectArtifactFactory(selectedArtifactFactoryID); 63 sm.selectArtifactFactory(selectedArtifactFactoryID);
56 ArtifactObject af = sm.getSelectedArtifactFactory();; 64 ArtifactObject af = sm.getSelectedArtifactFactory();
57 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); 65 ;
66 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
67 .getInstance().getArtifactDatabaseClient();
58 ArtifactObject artifact = adc.createNewArtifact(af); 68 ArtifactObject artifact = adc.createNewArtifact(af);
59 sm.setCurrentArtifact(artifact); 69 sm.setCurrentArtifact(artifact);
60 70
61 ArtifactDescription artifactdescription = adc.getCurrentStepDescription(af, artifact); 71 ArtifactDescription artifactdescription = adc
62 72 .getCurrentStepDescription(af, artifact);
73
63 XSLTransformer transformer = new XSLTransformer(); 74 XSLTransformer transformer = new XSLTransformer();
64 String ui = transformer.transform(artifactdescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); 75 String ui = transformer.transform(artifactdescription
65 76 .getCurrentUI(), "UTF-8", request
77 .getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
78
66 request.setAttribute("ui", ui); 79 request.setAttribute("ui", ui);
67 80
68 // return succsess 81 // return succsess
69 return super.execute(mapping, form, request, response); 82 return super.execute(mapping, form, request, response);
70 } catch (Exception e) { 83 } catch (Exception e) {
71 log.error(e,e); 84 log.error(e, e);
72 request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); 85 request.setAttribute(
86 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
87 .getMessage());
73 return super.getExceptionForward(mapping); 88 return super.getExceptionForward(mapping);
74 } 89 }
75 } 90 }
76 91
77 /** 92 /**

http://dive4elements.wald.intevation.org