changeset 19:1557bea6cb55

Do some Imporvements for Userfriendly exceptionhandling. Added multisupport for Products gnv/trunk@108 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 21 Sep 2009 15:28:02 +0000
parents 87002cbd194c
children 2f4ae7d9e058
files gnv/Changelog gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java
diffstat 4 files changed, 28 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/Changelog	Thu Sep 17 14:30:16 2009 +0000
+++ b/gnv/Changelog	Mon Sep 21 15:28:02 2009 +0000
@@ -1,3 +1,12 @@
+2009-09-21  Tim Englich  <tim.englich@intevation.de>
+
+    * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: 
+      Remnoved logging of Resultdocuments becaus it slow down the Application.
+    * src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java (execute): 
+      Added support of ArtifactFactory Reload if Session was lost.
+    * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java (execute): 
+      Added Support of more than one Product.
+      
 2009-09-17  Tim Englich  <tim.englich@intevation.de>
 
     * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: 
--- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Thu Sep 17 14:30:16 2009 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Mon Sep 21 15:28:02 2009 +0000
@@ -67,7 +67,12 @@
         ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient();
         if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){
             // TODO: Woher kommt der zu erreichende Status;
-            String target = ad.getReachableStates().iterator().next();
+            String target = null;
+            if (ad.getReachableStates().size() > 1){
+               target = request.getParameter("product"); // TODO HACK for Propducts every other Step has currently only one reachable state.
+            }else{
+                target = ad.getReachableStates().iterator().next();
+            }
             
             ArtifactDescription artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), target, ips);
             
--- a/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java	Thu Sep 17 14:30:16 2009 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java	Mon Sep 21 15:28:02 2009 +0000
@@ -3,6 +3,8 @@
  */
 package de.intevation.gnv.action;
 
+import java.util.Collection;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -16,6 +18,7 @@
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
 import de.intevation.gnv.util.XSLTransformer;
 
@@ -41,13 +44,20 @@
         log.debug("Selected ArtifactFactory ==> "+selectedArtifactFactoryID);
         
         SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
-        sm.selectArtifactFactory(selectedArtifactFactoryID);
+        Collection<ArtifactObject> artifactFactories = sm.getArtifactFactories();
+        if (artifactFactories == null || artifactFactories.isEmpty()){
+            new FetchArtifactFactoriesAction().execute(mapping, form, request, response);
+           
+        }
         
+        
+        sm.selectArtifactFactory(selectedArtifactFactoryID);
+        ArtifactObject af =  sm.getSelectedArtifactFactory();;
         ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient();
-        ArtifactObject artifact = adc.createNewArtifact(sm.getSelectedArtifactFactory());
+        ArtifactObject artifact = adc.createNewArtifact(af);
         sm.setCurrentArtifact(artifact);
         
-        ArtifactDescription artifactdescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), artifact);
+        ArtifactDescription artifactdescription = adc.getCurrentStepDescription(af, artifact);
         
         XSLTransformer transformer = new XSLTransformer();
         String ui = transformer.transform(artifactdescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Thu Sep 17 14:30:16 2009 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Mon Sep 21 15:28:02 2009 +0000
@@ -122,7 +122,6 @@
         XMLUtils xmlUtils = new XMLUtils();
         Representation output = doGetRequestInternal(requestUrl, requestBody);
         Document document = xmlUtils.readDocument(output.getStream());
-        log.debug(xmlUtils.writeDocument2String(document));
         return document;
     }
     
@@ -253,7 +252,6 @@
     InputStream is = this.doPostRequest(url+"/"+suburl, request);
     Document result = xmlUtils.readDocument(is);
     // TODO: Fehleranalyse des Dokumentes
-    log.debug(xmlUtils.writeDocument2String(result));
     return result;
 }
     
@@ -356,7 +354,6 @@
              // 2 Advance
             String url = this.getArtifactUrl(artifactFactory, currentArtifact);
             Document advanceDocument = this.createAdvanceRequestBody(currentArtifact, target);
-            log.debug(new XMLUtils().writeDocument2String(advanceDocument));
             InputStream advanceResult = this.doPostRequest(url, advanceDocument);
             // TODO feedResult auswerten und ggf. Fehler werfen.
             // 3 Descibe

http://dive4elements.wald.intevation.org