comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/DefaultTransition.java @ 3814:8083f6384023

merged flys-artifacts/pre2.6-2012-01-04
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:56 +0200
parents 542f280d72c3
children b2ea89a665bc
comparison
equal deleted inserted replaced
1491:2a00f4849738 3814:8083f6384023
1 package de.intevation.flys.artifacts.transitions;
2
3 import org.w3c.dom.Node;
4
5 import de.intevation.artifacts.Artifact;
6
7 import de.intevation.artifactdatabase.state.State;
8 import de.intevation.artifactdatabase.transition.Transition;
9
10
11 /**
12 * The default implementation of a <code>Transition</code>.
13 *
14 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
15 */
16 public class DefaultTransition implements Transition {
17
18 /** The ID of the current state */
19 protected String from;
20
21 /** The ID of the target state */
22 protected String to;
23
24
25 /**
26 * The default constructor.
27 */
28 public DefaultTransition() {
29 }
30
31
32 /**
33 * The default constructor.
34 *
35 * @param from The current state.
36 * @param to The target state.
37 */
38 public DefaultTransition(String from, String to) {
39 this.from = from;
40 this.to = to;
41 }
42
43
44 public void init(Node config) {
45 // nothing to do in the default transition
46 }
47
48
49 /**
50 * Returns the current state ID.
51 *
52 * @return the current state ID.
53 */
54 public String getFrom() {
55 return from;
56 }
57
58
59 /**
60 * Returns the target state ID.
61 *
62 * @return the target state ID.
63 */
64 public String getTo() {
65 return to;
66 }
67
68
69 /**
70 * Set the current state ID.
71 *
72 * @param to the current state ID.
73 */
74 public void setFrom(String from) {
75 this.from = from;
76 }
77
78
79 /**
80 * Set the target state ID.
81 *
82 * @param to the target state ID.
83 */
84 public void setTo(String to) {
85 this.to = to;
86 }
87
88
89 /**
90 * Determines if its valid to step from state <i>a</i> of an artifact
91 * <i>artifact</i> to state <i>b</i>. This method always returns true - no
92 * validation takes place.
93 *
94 * @param artifact The owner artifact of state a and b.
95 * @param a The current state.
96 * @param b The target state.
97 *
98 * @return true, if it is valid to step from a to b, otherwise false.
99 */
100 public boolean isValid(Artifact artifact, State a, State b) {
101 return true;
102 }
103 }
104 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org