01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow;
06:
07: import com.opensymphony.workflow.spi.Step;
08:
09: import java.util.*;
10:
11: /**
12: * DOCUMENT ME!
13: *
14: * @author $author$
15: * @version $Revision: 1.3 $
16: */
17: public class JoinNodes {
18: //~ Instance fields ////////////////////////////////////////////////////////
19:
20: private Collection steps;
21: private DummyStep dummy = new DummyStep();
22:
23: //~ Constructors ///////////////////////////////////////////////////////////
24:
25: public JoinNodes(Collection steps) {
26: this .steps = steps;
27: }
28:
29: //~ Methods ////////////////////////////////////////////////////////////////
30:
31: public Step getStep(int stepId) {
32: for (Iterator iterator = steps.iterator(); iterator.hasNext();) {
33: Step step = (Step) iterator.next();
34:
35: if (step.getStepId() == stepId) {
36: return step;
37: }
38: }
39:
40: // no match, not ready to join ...
41: // ... so return a dummy step that is always false
42: return dummy;
43: }
44:
45: //~ Inner Classes //////////////////////////////////////////////////////////
46:
47: private static class DummyStep implements Step {
48: public int getActionId() {
49: return -1;
50: }
51:
52: public String getCaller() {
53: return null;
54: }
55:
56: public Date getDueDate() {
57: return null;
58: }
59:
60: public long getEntryId() {
61: return -1;
62: }
63:
64: public Date getFinishDate() {
65: return null;
66: }
67:
68: public long getId() {
69: return -1;
70: }
71:
72: public String getOwner() {
73: return null;
74: }
75:
76: public long[] getPreviousStepIds() {
77: return new long[0];
78: }
79:
80: public Date getStartDate() {
81: return null;
82: }
83:
84: public String getStatus() {
85: return null;
86: }
87:
88: public int getStepId() {
89: return -1;
90: }
91: }
92: }
|