01: /*
02: * $Id: AtomicActivityVisitor.java,v 1.3 2004/12/09 12:34:31 kowap Exp $
03: *
04: * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
05: * Berne University of Applied Sciences
06: * School of Engineering and Information Technology
07: * All rights reserved.
08: */
09: 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.3 $, $Date: 2004/12/09 12:34:31 $
26: */
27: public abstract class AtomicActivityVisitor extends
28: AbstractBPELElementVisitor {
29:
30: /**
31: * Visit the process, i.e. ask the root <code>Activity</code> to accept
32: * this <code>Visitor</code>.
33: */
34: public void visit(Process process) {
35: Activity rootActivity = process.getActivity();
36: if (rootActivity != null) {
37: rootActivity.accept(this );
38: }
39: }
40:
41: /**
42: * Traverse all activities within a <code>Flow</code> activity.
43: */
44: public void visit(Flow flow) {
45: List activities = flow.getActivities();
46: if (activities != null) {
47: for (Iterator iter = activities.iterator(); iter.hasNext();) {
48: Activity activity = (Activity) iter.next();
49: activity.accept(this );
50: }
51: }
52: }
53:
54: /**
55: * Traverse the only activity of a <code>Scope</code>.
56: */
57: public void visit(Scope scope) {
58: Activity activity = scope.getActivity();
59: if (activity != null) {
60: activity.accept(this );
61: }
62: }
63:
64: /**
65: * Traverse all activities within a <code>Sequence</code> activity.
66: */
67: public void visit(Sequence sequence) {
68: List activities = sequence.getActivities();
69: if (activities != null) {
70: for (Iterator iter = activities.iterator(); iter.hasNext();) {
71: Activity activity = (Activity) iter.next();
72: activity.accept(this);
73: }
74: }
75: }
76: }
|