001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: ImplCompleteAuditEvent.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
021: *
022: * $Log: ImplCompleteAuditEvent.java,v $
023: * Revision 1.2 2006/09/29 12:32:08 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.1 2003/06/30 20:05:15 drmlipp
027: * Initial import
028: *
029: * Revision 1.2 2003/06/27 08:51:45 lipp
030: * Fixed copyright/license information.
031: *
032: * Revision 1.1 2003/05/07 10:46:06 lipp
033: * Renamed some classes/methods to imply both tool and sub-process
034: * implementations.
035: *
036: * Revision 1.2 2002/10/03 19:01:28 lipp
037: * Fixed documentation errors.
038: *
039: * Revision 1.1 2002/10/02 20:54:40 lipp
040: * Event handling partially reorganized.
041: *
042: */
043: package de.danet.an.workflow.domain;
044:
045: import de.danet.an.workflow.omgcore.WfAuditEvent;
046:
047: /**
048: * This class provides provides an internal event that is fired
049: * when a tool has completed its work on a activity.
050: *
051: * @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
052: * @version $Revision: 1.2 $
053: */
054:
055: public class ImplCompleteAuditEvent extends DefaultAuditEvent {
056:
057: /** Event type tool completed. */
058: public static final String TOOL_COMPLETE = "toolComplete";
059:
060: private int completedTool;
061:
062: /**
063: * Creates a new <code>ImplCompleteAuditEvent</code> assigning the
064: * given attributes.
065: * @param baseInfo a <code>WfAuditEvent</code> containing further
066: * information for the event.
067: * @param toolIdx index of the tool that has completed.
068: * @throws IllegalArgumentException in case of an illegal event
069: * type in <code>baseInfo</code>.
070: */
071: public ImplCompleteAuditEvent(WfAuditEvent baseInfo, int toolIdx)
072: throws IllegalArgumentException {
073: super (baseInfo);
074:
075: // check event type
076: if (!eventType().equals(TOOL_COMPLETE)) {
077: throw new IllegalArgumentException("Event type is '"
078: + eventType() + "' must be '" + TOOL_COMPLETE + "'");
079: }
080: completedTool = toolIdx;
081: }
082:
083: /**
084: * Creates a new <code>ImplCompleteAuditEvent</code> with the
085: * given source and all other attributes copied from the given
086: * event.
087: * @param source the value for the source attribute.
088: * @param baseInfo a <code>ImplCompleteAuditEvent</code>
089: * containing further information for the event.
090: */
091: private ImplCompleteAuditEvent(Object source,
092: ImplCompleteAuditEvent baseInfo) {
093: super (source, baseInfo);
094: // specialized attributes
095: completedTool = baseInfo.completedTool;
096: }
097:
098: /**
099: * Return a new audit event object with the source attribute
100: * replaced with the given object.
101: * @param source the new source attribute.
102: * @return the new audit event.
103: */
104: public DefaultAuditEvent replaceSource(Object source) {
105: return new ImplCompleteAuditEvent(source, this );
106: }
107:
108: /**
109: * Returns the current value of the attribute
110: * <code>completedTool</code>.
111: * @return the current value of the attribute.
112: */
113: public int completedTool() {
114: return completedTool;
115: }
116:
117: /**
118: * Returns a textual representation of the event.
119: * @return the textual representation
120: */
121: public String toString() {
122: return "ToolCompleteAuditEvent[" + super .toString()
123: + ", completedTool=" + completedTool + "]";
124: }
125: }
|