001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.planning.ldm.plan;
028:
029: import java.io.IOException;
030: import java.io.ObjectInputStream;
031: import java.io.ObjectOutputStream;
032:
033: import org.cougaar.core.mts.MessageAddress;
034: import org.cougaar.core.util.UID;
035:
036: /** TaskRescind implementation
037: * TaskRescind allows a task to be rescinded from the Plan.
038: *
039: **/
040:
041: public class TaskRescindImpl extends PlanningDirectiveImpl implements
042: TaskRescind, NewTaskRescind {
043:
044: private UID taskUID = null;
045: private boolean deleted; // Signifies that the task being rescinded is deleted.
046:
047: /** @param src
048: * @param dest
049: * @param t
050: **/
051: public TaskRescindImpl(MessageAddress src, MessageAddress dest,
052: Plan plan, Task t) {
053: super .setSource(src);
054: super .setDestination(dest);
055: super .setPlan(plan);
056: taskUID = t.getUID();
057: deleted = t.isDeleted();
058: }
059:
060: public TaskRescindImpl(MessageAddress src, MessageAddress dest,
061: Plan plan, UID tuid, boolean deleted) {
062: super .setSource(src);
063: super .setDestination(dest);
064: super .setPlan(plan);
065: this .taskUID = tuid;
066: this .deleted = deleted;
067: }
068:
069: /**
070: * Returns the task to be rescinded
071: */
072:
073: public UID getTaskUID() {
074: return taskUID;
075: }
076:
077: /**
078: * Sets the task to be rescinded
079: * @deprecated
080: */
081:
082: public void setTask(Task atask) {
083: taskUID = atask.getUID();
084: }
085:
086: /**
087: * Sets the task UID to be rescinded
088: * @deprecated
089: */
090: public void setTaskUID(UID tuid) {
091: taskUID = tuid;
092: }
093:
094: public void setDeleted(boolean newDeleted) {
095: deleted = newDeleted;
096: }
097:
098: public boolean isDeleted() {
099: return deleted;
100: }
101:
102: private void writeObject(ObjectOutputStream stream)
103: throws IOException {
104: stream.defaultWriteObject();
105: }
106:
107: private void readObject(ObjectInputStream stream)
108: throws ClassNotFoundException, IOException {
109: stream.defaultReadObject();
110: }
111:
112: public String toString() {
113: return "<TaskRescind for " + taskUID + ">";
114: }
115:
116: }
|