Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BaseStep |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 1999-2001,2004 The Apache Software Foundation. | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | package org.apache.commons.workflow.base; | |
18 | ||
19 | ||
20 | import org.apache.commons.workflow.Activity; | |
21 | import org.apache.commons.workflow.Context; | |
22 | import org.apache.commons.workflow.Owner; | |
23 | import org.apache.commons.workflow.Step; | |
24 | import org.apache.commons.workflow.StepException; | |
25 | ||
26 | ||
27 | /** | |
28 | * <p><strong>BaseStep</strong> is a convenient base class for more sophisticated | |
29 | * <code>Step</code> implementations. It includes management of the static | |
30 | * relationships of Steps to each other, and to their owning Activity, but | |
31 | * requires the implementation to provide an <code>execute()</code> method. | |
32 | * | |
33 | * @version $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $ | |
34 | * @author Craig R. McClanahan | |
35 | */ | |
36 | ||
37 | 0 | public abstract class BaseStep implements Step { |
38 | ||
39 | ||
40 | // ----------------------------------------------------- Instance Variables | |
41 | ||
42 | ||
43 | /** | |
44 | * The unique identifier (within this Activity) of this Step. | |
45 | */ | |
46 | 0 | protected String id = null; |
47 | ||
48 | ||
49 | /** | |
50 | * The next Step in our associated Activity. | |
51 | */ | |
52 | 0 | protected Step nextStep = null; |
53 | ||
54 | ||
55 | /** | |
56 | * The Activity or Block that owns this Step. | |
57 | */ | |
58 | 0 | protected Owner owner = null; |
59 | ||
60 | ||
61 | ||
62 | /** | |
63 | * The previous Step in our associated Activity. | |
64 | */ | |
65 | 0 | protected Step previousStep = null; |
66 | ||
67 | ||
68 | ||
69 | // ------------------------------------------------------------- Properties | |
70 | ||
71 | ||
72 | /** | |
73 | * Return the unique identifier (within this Activity or Block) | |
74 | * of this Step. | |
75 | */ | |
76 | public String getId() { | |
77 | ||
78 | 0 | return (this.id); |
79 | ||
80 | } | |
81 | ||
82 | ||
83 | /** | |
84 | * Set the unique identifier (within this Activity or Block) | |
85 | * of this Step. | |
86 | * | |
87 | * @param id The new unique identifier | |
88 | */ | |
89 | public void setId(String id) { | |
90 | ||
91 | 0 | this.id = id; |
92 | ||
93 | 0 | } |
94 | ||
95 | ||
96 | /** | |
97 | * Return the next Step in our associated Activity or Block. | |
98 | */ | |
99 | public Step getNextStep() { | |
100 | ||
101 | 0 | return (this.nextStep); |
102 | ||
103 | } | |
104 | ||
105 | ||
106 | /** | |
107 | * Set the next Step in our associated Activity or Block. | |
108 | * | |
109 | * @param nextStep The new next Step | |
110 | */ | |
111 | public void setNextStep(Step nextStep) { | |
112 | ||
113 | 0 | this.nextStep = nextStep; |
114 | ||
115 | 0 | } |
116 | ||
117 | ||
118 | /** | |
119 | * Return the Activity or Block that owns this Step. | |
120 | */ | |
121 | public Owner getOwner() { | |
122 | ||
123 | 0 | return (this.owner); |
124 | ||
125 | } | |
126 | ||
127 | ||
128 | /** | |
129 | * Set the Activity or Block that owns this Step. | |
130 | * | |
131 | * @param owner The new owning Activity or Block | |
132 | */ | |
133 | public void setOwner(Owner owner) { | |
134 | ||
135 | 0 | this.owner = owner; |
136 | ||
137 | 0 | } |
138 | ||
139 | ||
140 | /** | |
141 | * Return the previous Step in our associated Activity or Block. | |
142 | */ | |
143 | public Step getPreviousStep() { | |
144 | ||
145 | 0 | return (this.previousStep); |
146 | ||
147 | } | |
148 | ||
149 | ||
150 | /** | |
151 | * Set the previous Step in our associated Activity or Block. | |
152 | * | |
153 | * @param previousStep The new previous Step | |
154 | */ | |
155 | public void setPreviousStep(Step previousStep) { | |
156 | ||
157 | 0 | this.previousStep = previousStep; |
158 | ||
159 | 0 | } |
160 | ||
161 | ||
162 | // --------------------------------------------------------- Public Methods | |
163 | ||
164 | ||
165 | /** | |
166 | * Perform the executable actions related to this Step, in the context of | |
167 | * the specified Context. | |
168 | * | |
169 | * @param context The Context that is tracking our execution state | |
170 | * | |
171 | * @exception StepException if a processing error has occurred | |
172 | */ | |
173 | public abstract void execute(Context context) throws StepException; | |
174 | ||
175 | ||
176 | } |