comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 58:f31343d80d53

Artifact.advance initial implementiert gnv-artifacts/trunk@40 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 08 Sep 2009 14:07:59 +0000
parents f01592cd6419
children 2c5d8f5bced1
comparison
equal deleted inserted replaced
57:f01592cd6419 58:f31343d80d53
70 */ 70 */
71 public GNVArtifactBase() { 71 public GNVArtifactBase() {
72 super(); 72 super();
73 } 73 }
74 74
75 /**
76 * @see de.intevation.artifactdatabase.DefaultArtifact#advance(org.w3c.dom.Document, java.lang.Object)
77 */
78 @Override
79 public Document advance(Document target, Object context) {
80 Document result = super.newDocument();
81 if (this.current != null){
82 String transitionName = this.readTransitionName(target);
83 if (this.current.isTransitionReachable(transitionName)){
84 // 1. Prüfung ob Transition valide ist
85 if (this.current.validate()){
86
87 try {
88 Transition nextStep = this.transitions.get(transitionName);
89 // 2.Ergebnisse Berechnen
90 this.current.advance();
91 // 3. Ergebnisse übergeben
92 nextStep.setDescibeData(this.current.getDescibeData());
93 // 4. Umschalten auf neue Transistion
94 this.current = nextStep;
95 } catch (TransitionException e) {
96 log.error(e,e);
97 // TODO: Errormmessage senden.
98 }
99
100 }else{
101 log.error("Advance nicht möglich, da die Bedingungen für den Übergang " +
102 "in den neuen Zustand noch nicht gegeben ist.");
103 // TODO: Errormmessage senden.
104 }
105
106 }else{
107 log.error("Transitionsübergang wird nicht unterstützt.");
108 // TODO: Errormmessage senden.
109 }
110 }else{
111 log.error("Kein Transitionsschritt aktiviert.");
112 // TODO: Errormmessage senden.
113 }
114 return result;
115 }
116
117 protected String readTransitionName(Document document) {
118 String returnValue = Config.getStringXPath(document, "action/target/@name");
119 return returnValue;
120 }
121
75 protected Node getConfigurationFragment(Document document){ 122 protected Node getConfigurationFragment(Document document){
76 log.debug("GNVArtifactBase.getConfigurationFragment"); 123 log.debug("GNVArtifactBase.getConfigurationFragment");
77 String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(XPATH_IDENTIFIER_REPLACE, this.name); 124 String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(XPATH_IDENTIFIER_REPLACE, this.name);
78 log.debug(xpathQuery); 125 log.debug(xpathQuery);
79 return Config.getNodeXPath(document,xpathQuery); 126 return Config.getNodeXPath(document,xpathQuery);

http://dive4elements.wald.intevation.org