1
2
3
4
5
6
7
8
9 package bexee.model;
10
11 import java.util.Iterator;
12 import java.util.List;
13
14 import bexee.model.activity.Activity;
15 import bexee.model.activity.Flow;
16 import bexee.model.activity.Scope;
17 import bexee.model.activity.Sequence;
18 import bexee.model.process.Process;
19
20 /***
21 * This is an abstact visitor which should be used as a superclass for all
22 * visitors which wish to visit basic activities only.
23 *
24 * @author Pawel Kowalski
25 * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:10 $
26 */
27 public abstract class AtomicActivityVisitor extends AbstractBPELElementVisitor {
28
29 /***
30 * Visit the process, i.e. ask the root <code>Activity</code> to accept
31 * this <code>Visitor</code>.
32 */
33 public void visit(Process process) {
34 Activity rootActivity = process.getActivity();
35 if (rootActivity != null) {
36 rootActivity.accept(this);
37 }
38 }
39
40 /***
41 * Traverse all activities within a <code>Flow</code> activity.
42 */
43 public void visit(Flow flow) {
44 List activities = flow.getActivities();
45 if (activities != null) {
46 for (Iterator iter = activities.iterator(); iter.hasNext();) {
47 Activity activity = (Activity) iter.next();
48 activity.accept(this);
49 }
50 }
51 }
52
53 /***
54 * Traverse the only activity of a <code>Scope</code>.
55 */
56 public void visit(Scope scope) {
57 Activity activity = scope.getActivity();
58 if (activity != null) {
59 activity.accept(this);
60 }
61 }
62
63 /***
64 * Traverse all activities within a <code>Sequence</code> activity.
65 */
66 public void visit(Sequence sequence) {
67 List activities = sequence.getActivities();
68 if (activities != null) {
69 for (Iterator iter = activities.iterator(); iter.hasNext();) {
70 Activity activity = (Activity) iter.next();
71 activity.accept(this);
72 }
73 }
74 }
75 }