01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Taskoption.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.scheduler;
09:
10: import com.uwyn.rife.site.Validation;
11: import com.uwyn.rife.site.ValidationRuleNotNull;
12: import com.uwyn.rife.site.ValidationRuleRange;
13:
14: public class Taskoption extends Validation implements Cloneable {
15: private int mTaskId = -1;
16: private String mName = null;
17: private String mValue = null;
18:
19: public Taskoption() {
20: }
21:
22: protected void activateValidation() {
23: addRule(new ValidationRuleRange("taskId", new Integer(0), null));
24: addRule(new ValidationRuleNotNull("name"));
25: addRule(new ValidationRuleNotNull("value"));
26: }
27:
28: public void setTaskId(int taskid) {
29: mTaskId = taskid;
30: }
31:
32: public int getTaskId() {
33: return mTaskId;
34: }
35:
36: public void setName(String name) {
37: if (null == name && 0 == name.length())
38: throw new IllegalArgumentException("name can't be empty.");
39:
40: mName = name;
41: }
42:
43: public String getName() {
44: return mName;
45: }
46:
47: public void setValue(String value) {
48: mValue = value;
49: }
50:
51: public String getValue() {
52: return mValue;
53: }
54:
55: public Taskoption clone() throws CloneNotSupportedException {
56: return (Taskoption) super .clone();
57: }
58:
59: public boolean equals(Object object) {
60: Taskoption other_taskoption = (Taskoption) object;
61:
62: if (null != other_taskoption
63: && other_taskoption.getTaskId() == getTaskId()
64: && other_taskoption.getName().equals(getName())
65: && other_taskoption.getValue().equals(getValue())) {
66: return true;
67: }
68:
69: return false;
70: }
71: }
|