comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 208:a33d59f5791a

Use super.identifier as uuid. issue3 gnv-artifacts/trunk@264 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 23 Oct 2009 14:26:45 +0000
parents d87347142702
children 3dcd2b0b456e
comparison
equal deleted inserted replaced
207:d87347142702 208:a33d59f5791a
63 */ 63 */
64 public static final String XPATH_ARTIFACT_CONFIGURATION = "/artifact-database/artifacts/artifact[@name='" 64 public static final String XPATH_ARTIFACT_CONFIGURATION = "/artifact-database/artifacts/artifact[@name='"
65 + XPATH_IDENTIFIER_REPLACE 65 + XPATH_IDENTIFIER_REPLACE
66 + "']"; 66 + "']";
67 67
68
69 protected String uuid = null;
70 /** 68 /**
71 * The current Transition 69 * The current Transition
72 */ 70 */
73 protected Transition current = null; 71 protected Transition current = null;
74 72
96 * de.intevation.artifacts.CallContext) 94 * de.intevation.artifacts.CallContext)
97 */ 95 */
98 @Override 96 @Override
99 public Document advance(Document target, CallContext context) { 97 public Document advance(Document target, CallContext context) {
100 log.debug("GNVArtifactBase.advance"); 98 log.debug("GNVArtifactBase.advance");
101 this.uuid = Config.getStringXPath(target, "action/uuid/@value");
102 Document result = XMLUtils.newDocument(); 99 Document result = XMLUtils.newDocument();
103 try { 100 try {
104 if (this.current != null) { 101 if (this.current != null) {
105 String transitionName = this.readTransitionName(target); 102 String transitionName = this.readTransitionName(target);
106 log.debug("Transitionsname: " + transitionName); 103 log.debug("Transitionsname: " + transitionName);
110 107
111 try { 108 try {
112 Transition nextStep = this.transitions 109 Transition nextStep = this.transitions
113 .get(transitionName); 110 .get(transitionName);
114 // 2.Ergebnisse Berechnen 111 // 2.Ergebnisse Berechnen
115 this.current.advance(uuid, context.getMeta()); 112 this.current.advance(super.identifier, context.getMeta());
116 // 3. Ergebnisse Übergeben 113 // 3. Ergebnisse Übergeben
117 nextStep.putInputData(this.current.getInputData(), 114 nextStep.putInputData(this.current.getInputData(),
118 uuid); 115 super.identifier);
119 // 4. Umschalten auf neue Transistion 116 // 4. Umschalten auf neue Transistion
120 this.current = nextStep; 117 this.current = nextStep;
121 result = new ArtifactXMLUtilities() 118 result = new ArtifactXMLUtilities()
122 .createSuccessReport("Advance success", 119 .createSuccessReport("Advance success",
123 XMLUtils.newDocument()); 120 XMLUtils.newDocument());
207 public Document feed(Document target, CallContext context) { 204 public Document feed(Document target, CallContext context) {
208 log.debug("GNVArtifactBase.feed"); 205 log.debug("GNVArtifactBase.feed");
209 Document result = XMLUtils.newDocument(); 206 Document result = XMLUtils.newDocument();
210 try { 207 try {
211 if (this.current != null) { 208 if (this.current != null) {
212 this.uuid = Config.getStringXPath(target,"action/uuid/@value");
213 Collection<InputData> inputData = this.parseInputData(target, 209 Collection<InputData> inputData = this.parseInputData(target,
214 "/action/data/input"); 210 "/action/data/input");
215 if (!inputData.isEmpty()){ 211 if (!inputData.isEmpty()){
216 this.current.putInputData(inputData, uuid); 212 this.current.putInputData(inputData, super.identifier);
217 result = new ArtifactXMLUtilities().createSuccessReport( 213 result = new ArtifactXMLUtilities().createSuccessReport(
218 "Feed success", XMLUtils.newDocument()); 214 "Feed success", XMLUtils.newDocument());
219 }else{ 215 }else{
220 String msg = "No Inputdata given. Please select at least one Entry."; 216 String msg = "No Inputdata given. Please select at least one Entry.";
221 log.warn(msg); 217 log.warn(msg);
461 CallContext context) throws IOException { 457 CallContext context) throws IOException {
462 log.debug("TGNVArtifactBase.out"); 458 log.debug("TGNVArtifactBase.out");
463 try { 459 try {
464 460
465 if (current != null && current instanceof OutputTransition) { 461 if (current != null && current instanceof OutputTransition) {
466 this.uuid = Config.getStringXPath(format,"action/uuid/@value");
467 ((OutputTransition) current) 462 ((OutputTransition) current)
468 .out(this.readOutputType(format), this.parseInputData( 463 .out(this.readOutputType(format), this.parseInputData(
469 format, "/action/out/params/input"), 464 format, "/action/out/params/input"),
470 outputStream, uuid, context.getMeta()); 465 outputStream, super.identifier, context.getMeta());
471 } 466 }
472 } catch (TransitionException e) { 467 } catch (TransitionException e) {
473 log.error(e, e); 468 log.error(e, e);
474 throw new IOException(e.getMessage()); 469 throw new IOException(e.getMessage());
475 } 470 }

http://dive4elements.wald.intevation.org