diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 1157:a470b7c3b165

Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document. flys-artifacts/trunk@2689 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 09 Sep 2011 15:03:00 +0000
parents 854c2f7da3f1
children a7def20539fb
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Sep 09 13:26:28 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Sep 09 15:03:00 2011 +0000
@@ -14,6 +14,7 @@
 import de.intevation.artifactdatabase.transition.TransitionEngine;
 
 import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.Message;
 
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
 
@@ -53,6 +54,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -63,6 +65,7 @@
 import org.w3c.dom.Node;
 
 import de.intevation.flys.artifacts.charts.CrossSectionApp;
+import de.intevation.flys.artifacts.model.CalculationMessage;
 
 /**
  * The default WINFO artifact.
@@ -192,6 +195,7 @@
         CallContext    context
     ) {
         Element inBackground = cr.create("background-processing");
+        root.appendChild(inBackground);
 
         cr.addAttr(
             inBackground,
@@ -199,7 +203,26 @@
             String.valueOf(context.isInBackground()),
             true);
 
-        root.appendChild(inBackground);
+        LinkedList<Message> messages = context.getBackgroundMessages();
+
+        if (messages == null) {
+            return;
+        }
+
+        CalculationMessage  message  = (CalculationMessage) messages.getLast();
+        cr.addAttr(
+            inBackground,
+            "steps",
+            String.valueOf(message.getSteps()),
+            true);
+
+        cr.addAttr(
+            inBackground,
+            "currentStep",
+            String.valueOf(message.getCurrentStep()),
+            true);
+
+        inBackground.setTextContent(message.getMessage());
     }
 
 

http://dive4elements.wald.intevation.org