Mercurial > dive4elements > gnv-client
comparison 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 |
comparison
equal
deleted
inserted
replaced
88:1b12021905b9 | 89:cde042a0a395 |
---|---|
89 /** | 89 /** |
90 * @see de.intevation.artifactdatabase.DefaultArtifact#advance(org.w3c.dom.Document, de.intevation.artifacts.CallContext) | 90 * @see de.intevation.artifactdatabase.DefaultArtifact#advance(org.w3c.dom.Document, de.intevation.artifacts.CallContext) |
91 */ | 91 */ |
92 @Override | 92 @Override |
93 public Document advance(Document target, CallContext context) { | 93 public Document advance(Document target, CallContext context) { |
94 log.debug("GNVArtifactBase.advance"); | |
94 Document result = XMLUtils.newDocument(); | 95 Document result = XMLUtils.newDocument(); |
95 try { | 96 try { |
96 if (this.current != null){ | 97 if (this.current != null){ |
97 String transitionName = this.readTransitionName(target); | 98 String transitionName = this.readTransitionName(target); |
98 if (this.current.isTransitionReachable(transitionName)){ | 99 if (this.current.isTransitionReachable(transitionName)){ |
106 // 3. Ergebnisse übergeben | 107 // 3. Ergebnisse übergeben |
107 nextStep.setDescibeData(this.current.getDescibeData()); | 108 nextStep.setDescibeData(this.current.getDescibeData()); |
108 nextStep.putInputData(this.current.getInputData()); | 109 nextStep.putInputData(this.current.getInputData()); |
109 // 4. Umschalten auf neue Transistion | 110 // 4. Umschalten auf neue Transistion |
110 this.current = nextStep; | 111 this.current = nextStep; |
112 result = new ArtifactXMLUtilities().createSuccessReport("Advance success", XMLUtils.newDocument()); | |
111 } catch (TransitionException e) { | 113 } catch (TransitionException e) { |
112 log.error(e,e); | 114 log.error(e,e); |
113 result = new ArtifactXMLUtilities().createExceptionReport(e.getLocalizedMessage(), XMLUtils.newDocument()); | 115 result = new ArtifactXMLUtilities().createExceptionReport(e.getLocalizedMessage(), XMLUtils.newDocument()); |
114 } | 116 } |
115 | 117 |
152 /** | 154 /** |
153 * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document, de.intevation.artifacts.CallContext) | 155 * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document, de.intevation.artifacts.CallContext) |
154 */ | 156 */ |
155 @Override | 157 @Override |
156 public Document feed(Document target, CallContext context) { | 158 public Document feed(Document target, CallContext context) { |
159 log.debug("GNVArtifactBase.feed"); | |
157 Document result = XMLUtils.newDocument(); | 160 Document result = XMLUtils.newDocument(); |
158 try { | 161 try { |
159 if (this.current != null){ | 162 if (this.current != null){ |
160 this.current.putInputData(this.parseInputData(target)); | 163 this.current.putInputData(this.parseInputData(target)); |
161 // TODO Ergebnisdokument erzeugen. | 164 result = new ArtifactXMLUtilities().createSuccessReport("Feed success", XMLUtils.newDocument()); |
165 }else{ | |
166 String msg = "No Transition instantiated"; | |
167 log.warn(msg); | |
168 result = new ArtifactXMLUtilities().createExceptionReport(msg, XMLUtils.newDocument()); | |
162 } | 169 } |
163 } catch (TransitionException e) { | 170 } catch (TransitionException e) { |
164 log.error(e,e); | 171 log.error(e,e); |
165 return new ArtifactXMLUtilities().createExceptionReport(e.getLocalizedMessage(), XMLUtils.newDocument()); | 172 result = new ArtifactXMLUtilities().createExceptionReport(e.getLocalizedMessage(), XMLUtils.newDocument()); |
166 } | 173 } |
167 return result; | 174 return result; |
168 } | 175 } |
169 | 176 |
170 /** | 177 /** |
230 parent.appendChild(uuidNode); | 237 parent.appendChild(uuidNode); |
231 | 238 |
232 Element hashNode = xmlUtilities.createArtifactElement(document,"hash"); | 239 Element hashNode = xmlUtilities.createArtifactElement(document,"hash"); |
233 hashNode.setAttribute("value", this.hash()); | 240 hashNode.setAttribute("value", this.hash()); |
234 parent.appendChild(hashNode); | 241 parent.appendChild(hashNode); |
235 | 242 } |
236 | 243 |
237 } | |
238 protected void createReachableStates(Element parent,Document document){ | 244 protected void createReachableStates(Element parent,Document document){ |
239 Element stateNode = xmlUtilities.createArtifactElement(document,"reachable-states"); | 245 Element stateNode = xmlUtilities.createArtifactElement(document,"reachable-states"); |
240 if (this.current != null){ | 246 if (this.current != null){ |
241 Iterator<String> states = this.current.reachableTransitions().iterator(); | 247 Iterator<String> states = this.current.reachableTransitions().iterator(); |
242 while(states.hasNext()){ | 248 while(states.hasNext()){ |
356 if (current != null && current instanceof OutputTransition){ | 362 if (current != null && current instanceof OutputTransition){ |
357 ((OutputTransition)current).out(this.readOutputType(format), outputStream); | 363 ((OutputTransition)current).out(this.readOutputType(format), outputStream); |
358 } | 364 } |
359 } catch (TransitionException e) { | 365 } catch (TransitionException e) { |
360 log.error(e,e); | 366 log.error(e,e); |
367 throw new IOException(e.getMessage()); | |
361 } | 368 } |
362 } | 369 } |
363 | 370 |
364 protected String readOutputType(Document document){ | 371 protected String readOutputType(Document document){ |
365 String value = Config.getStringXPath(document,"action/out/@name"); | 372 String value = Config.getStringXPath(document,"action/out/@name"); |