comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 207:d87347142702

Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3 gnv-artifacts/trunk@263 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 23 Oct 2009 08:50:50 +0000
parents 734ac082c8d1
children a33d59f5791a
comparison
equal deleted inserted replaced
206:01ac348ac4a4 207:d87347142702
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;
68 /** 70 /**
69 * The current Transition 71 * The current Transition
70 */ 72 */
71 protected Transition current = null; 73 protected Transition current = null;
72 74
94 * de.intevation.artifacts.CallContext) 96 * de.intevation.artifacts.CallContext)
95 */ 97 */
96 @Override 98 @Override
97 public Document advance(Document target, CallContext context) { 99 public Document advance(Document target, CallContext context) {
98 log.debug("GNVArtifactBase.advance"); 100 log.debug("GNVArtifactBase.advance");
99 String uuid = Config.getStringXPath(target, "action/uuid/@value"); 101 this.uuid = Config.getStringXPath(target, "action/uuid/@value");
100 Document result = XMLUtils.newDocument(); 102 Document result = XMLUtils.newDocument();
101 try { 103 try {
102 if (this.current != null) { 104 if (this.current != null) {
103 String transitionName = this.readTransitionName(target); 105 String transitionName = this.readTransitionName(target);
104 log.debug("Transitionsname: " + transitionName); 106 log.debug("Transitionsname: " + transitionName);
110 Transition nextStep = this.transitions 112 Transition nextStep = this.transitions
111 .get(transitionName); 113 .get(transitionName);
112 // 2.Ergebnisse Berechnen 114 // 2.Ergebnisse Berechnen
113 this.current.advance(uuid, context.getMeta()); 115 this.current.advance(uuid, context.getMeta());
114 // 3. Ergebnisse Übergeben 116 // 3. Ergebnisse Übergeben
115 nextStep.setDescibeData(this.current
116 .getDescibeData());
117 nextStep.putInputData(this.current.getInputData(), 117 nextStep.putInputData(this.current.getInputData(),
118 uuid); 118 uuid);
119 // 4. Umschalten auf neue Transistion 119 // 4. Umschalten auf neue Transistion
120 this.current = nextStep; 120 this.current = nextStep;
121 result = new ArtifactXMLUtilities() 121 result = new ArtifactXMLUtilities()
207 public Document feed(Document target, CallContext context) { 207 public Document feed(Document target, CallContext context) {
208 log.debug("GNVArtifactBase.feed"); 208 log.debug("GNVArtifactBase.feed");
209 Document result = XMLUtils.newDocument(); 209 Document result = XMLUtils.newDocument();
210 try { 210 try {
211 if (this.current != null) { 211 if (this.current != null) {
212 String uuid = Config.getStringXPath(target, 212 this.uuid = Config.getStringXPath(target,"action/uuid/@value");
213 "action/uuid/@value");
214 Collection<InputData> inputData = this.parseInputData(target, 213 Collection<InputData> inputData = this.parseInputData(target,
215 "/action/data/input"); 214 "/action/data/input");
216 if (!inputData.isEmpty()){ 215 if (!inputData.isEmpty()){
217 this.current.putInputData(inputData, uuid); 216 this.current.putInputData(inputData, uuid);
218 result = new ArtifactXMLUtilities().createSuccessReport( 217 result = new ArtifactXMLUtilities().createSuccessReport(
273 } 272 }
274 273
275 } 274 }
276 } 275 }
277 276
278 protected Document createDescibeOutput(CallMeta callMeta) { 277 protected Document createDescibeOutput(CallMeta callMeta, String uuid) {
279 log.debug("GNVArtifactBase.createDescibeOutput"); 278 log.debug("GNVArtifactBase.createDescibeOutput");
280 Document document = XMLUtils.newDocument(); 279 Document document = XMLUtils.newDocument();
281 Element rootNode = this.createRootNode(document); 280 Element rootNode = this.createRootNode(document);
282 this.createHeader(rootNode, document, "describe"); 281 this.createHeader(rootNode, document, "describe");
283 this.createOutputs(rootNode, document); 282 this.createOutputs(rootNode, document);
284 this.createCurrentState(rootNode, document); 283 this.createCurrentState(rootNode, document);
285 this.createReachableStates(rootNode, document); 284 this.createReachableStates(rootNode, document);
286 this.createModel(rootNode, document); 285 this.createModel(rootNode, document);
287 this.createUserInterface(rootNode, document, callMeta); 286 this.createUserInterface(rootNode, document, callMeta, uuid);
288 return document; 287 return document;
289 } 288 }
290 289
291 protected Element createRootNode(Document document) { 290 protected Element createRootNode(Document document) {
292 Element rootNode = xmlUtilities.createArtifactElement(document, 291 Element rootNode = xmlUtilities.createArtifactElement(document,
358 } 357 }
359 parent.appendChild(modelNode); 358 parent.appendChild(modelNode);
360 } 359 }
361 360
362 protected void createUserInterface(Element parent, Document document, 361 protected void createUserInterface(Element parent, Document document,
363 CallMeta callMeta) { 362 CallMeta callMeta, String uuid) {
364 Element uiNode = xmlUtilities.createArtifactElement(document, "ui"); 363 Element uiNode = xmlUtilities.createArtifactElement(document, "ui");
365 364
366 if (this.current != null) { 365 if (this.current != null) {
367 this.current.describe(document, uiNode, callMeta); 366 this.current.describe(document, uiNode, callMeta, uuid);
368 } 367 }
369 368
370 parent.appendChild(uiNode); 369 parent.appendChild(uiNode);
371 } 370 }
372 371
462 CallContext context) throws IOException { 461 CallContext context) throws IOException {
463 log.debug("TGNVArtifactBase.out"); 462 log.debug("TGNVArtifactBase.out");
464 try { 463 try {
465 464
466 if (current != null && current instanceof OutputTransition) { 465 if (current != null && current instanceof OutputTransition) {
467 String uuid = Config.getStringXPath(format, 466 this.uuid = Config.getStringXPath(format,"action/uuid/@value");
468 "action/uuid/@value");
469 ((OutputTransition) current) 467 ((OutputTransition) current)
470 .out(this.readOutputType(format), this.parseInputData( 468 .out(this.readOutputType(format), this.parseInputData(
471 format, "/action/out/params/input"), 469 format, "/action/out/params/input"),
472 outputStream, uuid, context.getMeta()); 470 outputStream, uuid, context.getMeta());
473 } 471 }

http://dive4elements.wald.intevation.org