ingo@106: package de.intevation.flys.artifacts.transitions;
ingo@106: 
ingo@354: import org.w3c.dom.Node;
ingo@354: 
ingo@354: import de.intevation.artifacts.Artifact;
ingo@354: 
ingo@107: import de.intevation.artifactdatabase.state.State;
ingo@107: import de.intevation.artifactdatabase.transition.Transition;
ingo@106: 
ingo@354: 
ingo@106: /**
ingo@106:  * The default implementation of a <code>Transition</code>.
ingo@106:  *
ingo@106:  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
ingo@106:  */
ingo@106: public class DefaultTransition implements Transition {
ingo@106: 
ingo@106:     /** The ID of the current state */
ingo@106:     protected String from;
ingo@106: 
ingo@106:     /** The ID of the target state */
ingo@106:     protected String to;
ingo@106: 
ingo@106: 
ingo@106:     /**
ingo@106:      * The default constructor.
ingo@106:      */
ingo@106:     public DefaultTransition() {
ingo@106:     }
ingo@106: 
ingo@106: 
ingo@106:     /**
ingo@106:      * The default constructor.
ingo@106:      *
ingo@106:      * @param from The current state.
ingo@106:      * @param to The target state.
ingo@106:      */
ingo@106:     public DefaultTransition(String from, String to) {
ingo@106:         this.from = from;
ingo@106:         this.to   = to;
ingo@106:     }
ingo@106: 
ingo@106: 
ingo@354:     public void init(Node config) {
ingo@354:         // nothing to do in the default transition
ingo@354:     }
ingo@354: 
ingo@354: 
ingo@106:     /**
ingo@106:      * Returns the current state ID.
ingo@106:      *
ingo@106:      * @return the current state ID.
ingo@106:      */
ingo@106:     public String getFrom() {
ingo@106:         return from;
ingo@106:     }
ingo@106: 
ingo@106: 
ingo@106:     /**
ingo@106:      * Returns the target state ID.
ingo@106:      *
ingo@106:      * @return the target state ID.
ingo@106:      */
ingo@106:     public String getTo() {
ingo@106:         return to;
ingo@106:     }
ingo@106: 
ingo@106: 
ingo@106:     /**
ingo@106:      * Set the current state ID.
ingo@106:      *
felix@3269:      * @param from current state ID.
ingo@106:      */
ingo@106:     public void setFrom(String from) {
ingo@106:         this.from = from;
ingo@106:     }
ingo@106: 
ingo@106: 
ingo@106:     /**
ingo@106:      * Set the target state ID.
ingo@106:      *
ingo@106:      * @param to the target state ID.
ingo@106:      */
ingo@106:     public void setTo(String to) {
ingo@106:         this.to = to;
ingo@106:     }
ingo@106: 
ingo@106: 
ingo@106:     /**
ingo@354:      * Determines if its valid to step from state <i>a</i> of an artifact
ingo@354:      * <i>artifact</i> to state <i>b</i>. This method always returns true - no
ingo@354:      * validation takes place.
ingo@106:      *
ingo@354:      * @param artifact The owner artifact of state a and b.
ingo@354:      * @param a The current state.
ingo@354:      * @param b The target state.
ingo@106:      *
ingo@354:      * @return true, if it is valid to step from a to b, otherwise false.
ingo@106:      */
ingo@354:     public boolean isValid(Artifact artifact, State a, State b) {
ingo@106:         return true;
ingo@106:     }
ingo@106: }
ingo@106: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :