diff gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 89:cde042a0a395

Successreporting added gnv-artifacts/trunk@126 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Thu, 24 Sep 2009 11:03:31 +0000
parents 1b12021905b9
children 6bdef6e590d6
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Thu Sep 24 10:45:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Thu Sep 24 11:03:31 2009 +0000
@@ -91,6 +91,7 @@
      */
     @Override
     public Document advance(Document target, CallContext context) {
+        log.debug("GNVArtifactBase.advance");
         Document result = XMLUtils.newDocument();
         try {
             if (this.current != null){
@@ -108,6 +109,7 @@
                             nextStep.putInputData(this.current.getInputData());
                             // 4. Umschalten auf neue Transistion
                             this.current = nextStep;
+                            result = new ArtifactXMLUtilities().createSuccessReport("Advance success", XMLUtils.newDocument());
                         } catch (TransitionException e) {
                             log.error(e,e);
                             result = new ArtifactXMLUtilities().createExceptionReport(e.getLocalizedMessage(), XMLUtils.newDocument());
@@ -154,15 +156,20 @@
      */
     @Override
     public Document feed(Document target, CallContext context) {
+        log.debug("GNVArtifactBase.feed");
         Document result = XMLUtils.newDocument();
         try {
             if (this.current != null){
                 this.current.putInputData(this.parseInputData(target));
-                // TODO Ergebnisdokument erzeugen.
+                result = new ArtifactXMLUtilities().createSuccessReport("Feed success", XMLUtils.newDocument());
+            }else{
+                String msg = "No Transition instantiated";
+                log.warn(msg);
+                result = new ArtifactXMLUtilities().createExceptionReport(msg, XMLUtils.newDocument());
             }
         } catch (TransitionException e) {
             log.error(e,e);
-            return new ArtifactXMLUtilities().createExceptionReport(e.getLocalizedMessage(), XMLUtils.newDocument());
+            result = new ArtifactXMLUtilities().createExceptionReport(e.getLocalizedMessage(), XMLUtils.newDocument());
         }
         return result;
     }
@@ -232,9 +239,8 @@
         Element hashNode = xmlUtilities.createArtifactElement(document,"hash");
         hashNode.setAttribute("value", this.hash());
         parent.appendChild(hashNode);
+    }
 
-        
-    }
     protected void createReachableStates(Element parent,Document document){
         Element stateNode = xmlUtilities.createArtifactElement(document,"reachable-states");
         if (this.current != null){
@@ -358,6 +364,7 @@
             }
         } catch (TransitionException e) {
             log.error(e,e);
+            throw new IOException(e.getMessage());
         }
     }
 

http://dive4elements.wald.intevation.org