tim@52: /** tim@52: * tim@52: */ tim@52: package de.intevation.gnv.transition; tim@52: tim@52: import java.util.ArrayList; tim@52: import java.util.Collection; tim@52: tim@52: import org.apache.log4j.Logger; tim@52: import org.w3c.dom.Document; tim@52: import org.w3c.dom.Node; tim@52: import org.w3c.dom.NodeList; tim@52: tim@52: import de.intevation.artifactdatabase.Config; tim@52: import de.intevation.gnv.artifacts.GNVArtifactBase; tim@52: tim@52: /** tim@52: * @author Tim Englich tim@52: * tim@52: */ tim@52: public abstract class TransitionBase implements Transition { tim@52: /** tim@52: * the logger, used to log exceptions and additonaly information tim@52: */ tim@52: private static Logger log = Logger.getLogger(GNVArtifactBase.class); tim@52: tim@52: private String id = null; tim@52: tim@53: private String description = null; tim@53: tim@53: tim@53: tim@52: protected String queryID = null; tim@52: tim@52: private Collection reachableTransitions = null; tim@52: tim@52: private Transition parent = null; tim@52: /** tim@52: * Constructor tim@52: */ tim@52: public TransitionBase() { tim@52: super(); tim@52: } tim@52: tim@52: /** tim@52: * @see de.intevation.gnv.transition.Transition#getID() tim@52: */ tim@52: public String getID() { tim@52: return this.id; tim@52: } tim@53: tim@53: /** tim@53: * @see de.intevation.gnv.transition.Transition#getDescription() tim@53: */ tim@53: public String getDescription() { tim@53: return this.description; tim@53: } tim@53: tim@52: /** tim@52: * @see de.intevation.gnv.transition.Transition#reachableTransitions() tim@52: */ tim@52: public Collection reachableTransitions() { tim@52: return this.reachableTransitions; tim@52: } tim@52: tim@52: /** tim@52: * @see de.intevation.gnv.transition.Transition#setup(org.w3c.dom.Node) tim@52: */ tim@52: public void setup(Node configuration) { tim@52: tim@52: this.id = Config.getStringXPath(configuration,"@id"); tim@53: this.description = Config.getStringXPath(configuration,"@descriptionb"); tim@53: tim@52: log.info("Transition-ID = "+ this.id); tim@52: NodeList nodes = Config.getNodeSetXPath(configuration,"reachableTransitions/transition"); tim@52: this.reachableTransitions = new ArrayList(nodes.getLength()); tim@52: for (int i = 0 ; i < nodes.getLength(); i++){ tim@52: String reachableTransition = nodes.item(i).getTextContent(); tim@52: log.info("ReachableTransition ==> "+ reachableTransition); tim@52: this.reachableTransitions.add(reachableTransition); tim@52: tim@52: } tim@52: this.queryID = Config.getStringXPath(configuration,"queryID"); tim@52: log.info("QueryID ==>"+ this.queryID); tim@52: tim@52: } tim@52: tim@52: /** tim@52: * @see de.intevation.gnv.transition.Transition#getParent() tim@52: */ tim@52: public Transition getParent() { tim@52: return this.parent; tim@52: } tim@52: tim@52: /** tim@52: * @see de.intevation.gnv.transition.Transition#setParent(de.intevation.gnv.transition.Transition) tim@52: */ tim@52: public void setParent(Transition transition) { tim@52: this.parent = transition; tim@52: } tim@52: }