1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.workflow.core;
18
19
20 import java.util.EmptyStackException;
21 import org.apache.commons.workflow.Block;
22 import org.apache.commons.workflow.BlockState;
23 import org.apache.commons.workflow.Context;
24 import org.apache.commons.workflow.Descriptor;
25 import org.apache.commons.workflow.Iterator;
26 import org.apache.commons.workflow.Step;
27 import org.apache.commons.workflow.StepException;
28 import org.apache.commons.workflow.base.BaseBlock;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 public class WhileNotStep extends WhileStep {
44
45
46
47
48
49
50
51
52 public WhileNotStep() {
53
54 super();
55
56 }
57
58
59
60
61
62
63
64 public WhileNotStep(String id) {
65
66 this(id, null);
67
68 }
69
70
71
72
73
74
75
76
77 public WhileNotStep(String id, Descriptor descriptor) {
78
79 super();
80 setId(id);
81 if (descriptor != null)
82 addDescriptor(descriptor);
83
84 }
85
86
87
88
89
90
91
92
93 public String toString() {
94
95 StringBuffer sb = new StringBuffer("<core:whileAny");
96 if (getId() != null) {
97 sb.append(" id=\"");
98 sb.append(getId());
99 sb.append("\"");
100 }
101 sb.append(">");
102 Descriptor descriptors[] = findDescriptors();
103 for (int i = 0; i < descriptors.length; i++)
104 sb.append(descriptors[i]);
105 Step steps[] = getSteps();
106 for (int i = 0; i < steps.length; i++)
107 sb.append(steps[i]);
108 sb.append("</core:whileAny>");
109 return (sb.toString());
110
111 }
112
113
114
115
116
117
118
119
120
121
122
123 protected boolean evaluate(Context context) {
124
125 boolean condition = true;
126 Descriptor descriptors[] = findDescriptors();
127 for (int i = 0; i < descriptors.length; i++) {
128 if (descriptors[i] == null)
129 continue;
130 if (!descriptors[i].positive(context))
131 condition = false;
132 }
133 return (!condition);
134
135 }
136
137
138 }