KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > JoinNodes


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.workflow;
6
7 import com.opensymphony.workflow.spi.Step;
8
9 import java.util.*;
10
11
12 /**
13  * DOCUMENT ME!
14  *
15  * @author $author$
16  * @version $Revision: 1.2 $
17  */

18 public class JoinNodes {
19     //~ Instance fields ////////////////////////////////////////////////////////
20

21     private Collection steps;
22     private DummyStep dummy = new DummyStep();
23
24     //~ Constructors ///////////////////////////////////////////////////////////
25

26     public JoinNodes(Collection steps) {
27         this.steps = steps;
28     }
29
30     //~ Methods ////////////////////////////////////////////////////////////////
31

32     public Step getStep(int stepId) {
33         for (Iterator iterator = steps.iterator(); iterator.hasNext();) {
34             Step step = (Step) iterator.next();
35
36             if (step.getStepId() == stepId) {
37                 return step;
38             }
39         }
40
41         // no match, not ready to join ...
42
// ... so return a dummy step that is always false
43
return dummy;
44     }
45
46     //~ Inner Classes //////////////////////////////////////////////////////////
47

48     public class DummyStep implements Step {
49         public int getActionId() {
50             return -1;
51         }
52
53         public String JavaDoc getCaller() {
54             return null;
55         }
56
57         public Date getDueDate() {
58             return null;
59         }
60
61         public long getEntryId() {
62             return -1;
63         }
64
65         public Date getFinishDate() {
66             return null;
67         }
68
69         public long getId() {
70             return -1;
71         }
72
73         public String JavaDoc getOwner() {
74             return null;
75         }
76
77         public long[] getPreviousStepIds() {
78             return new long[0];
79         }
80
81         public Date getStartDate() {
82             return null;
83         }
84
85         public String JavaDoc getStatus() {
86             return null;
87         }
88
89         public int getStepId() {
90             return -1;
91         }
92     }
93 }
94
Popular Tags