1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.jes.jobscheduler.impl.groovy;
12
13
14 /*** Represents the status of an activity (step) in the workflow.
15 * its a pretty dumb bean.
16 * @author Noel Winstanley nw@jb.man.ac.uk 26-Jul-2004
17 *
18 */
19 public class ActivityStatus {
20
21 /*** Construct a new ActivityStatus
22 *
23 */
24 public ActivityStatus() {
25 super();
26 }
27
28 protected String key;
29 protected Status status = Status.UNSTARTED;
30 protected Vars env = new Vars();
31
32 /*** Access the environment of bindings in scope for this activity.
33 * @return Returns the env. defaults to an empty set of bindings.
34 */
35 public Vars getEnv() {
36 return this.env;
37 }
38 /*** set the environment of bindings available to this activity */
39 public void setEnv(Vars env) {
40 this.env = env;
41 }
42
43
44 /***
45 * @return Returns the key.
46 */
47 public String getKey() {
48 return this.key;
49 }
50 /***
51 * @param key The key to set.
52 */
53 public void setKey(String key) {
54 this.key = key;
55 }
56 /*** access the execution status this activity is currently in
57 * @return Returns the status. defaults to {@link Status#UNSTARTED}
58 */
59 public Status getStatus() {
60 return this.status;
61 }
62 /*** set the execution status of this activity.
63 * @param status The status to set.
64 */
65 public void setStatus(Status status) {
66 this.status = status;
67 }
68 public String toString() {
69 StringBuffer buffer = new StringBuffer();
70 buffer.append("[ActivityStatus:");
71 buffer.append(" key: ");
72 buffer.append(key);
73 buffer.append(" status: ");
74 buffer.append(status);
75 buffer.append(" env: ");
76 buffer.append(env);
77 buffer.append("]");
78 return buffer.toString();
79 }
80 /***
81 * Returns <code>true</code> if this <code>ActivityStatus</code> is the same as the o argument.
82 *
83 * @return <code>true</code> if this <code>ActivityStatus</code> is the same as the o argument.
84 */
85 public boolean equals(Object o) {
86 if (this == o) {
87 return true;
88 }
89 if (o == null) {
90 return false;
91 }
92 if (o.getClass() != getClass()) {
93 return false;
94 }
95 ActivityStatus castedObj = (ActivityStatus) o;
96 return ((this.key == null ? castedObj.key == null : this.key
97 .equals(castedObj.key))
98 && (this.status == null ? castedObj.status == null : this.status
99 .equals(castedObj.status)) && (this.env == null
100 ? castedObj.env == null
101 : this.env.equals(castedObj.env)));
102 }
103 /***
104 * Override hashCode.
105 *
106 * @return the Objects hashcode.
107 */
108 public int hashCode() {
109 int hashCode = 1;
110 hashCode = 31 * hashCode + (key == null ? 0 : key.hashCode());
111 hashCode = 31 * hashCode + (status == null ? 0 : status.hashCode());
112 hashCode = 31 * hashCode + (env == null ? 0 : env.hashCode());
113 return hashCode;
114 }
115 }
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145