ImplCompleteAuditEvent.java :  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » workflow » domain » Java Open Source

Java Open Source » Workflow Engines » wfmopen 2.1.1 
wfmopen 2.1.1 » de » danet » an » workflow » domain » ImplCompleteAuditEvent.java
/*
 * This file is part of the WfMOpen project.
 * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: ImplCompleteAuditEvent.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
 *
 * $Log: ImplCompleteAuditEvent.java,v $
 * Revision 1.2  2006/09/29 12:32:08  drmlipp
 * Consistently using WfMOpen as projct name now.
 *
 * Revision 1.1.1.1  2003/06/30 20:05:15  drmlipp
 * Initial import
 *
 * Revision 1.2  2003/06/27 08:51:45  lipp
 * Fixed copyright/license information.
 *
 * Revision 1.1  2003/05/07 10:46:06  lipp
 * Renamed some classes/methods to imply both tool and sub-process
 * implementations.
 *
 * Revision 1.2  2002/10/03 19:01:28  lipp
 * Fixed documentation errors.
 *
 * Revision 1.1  2002/10/02 20:54:40  lipp
 * Event handling partially reorganized.
 *
 */
package de.danet.an.workflow.domain;

import de.danet.an.workflow.omgcore.WfAuditEvent;

/**
 * This class provides provides an internal event that is fired
 * when a tool has completed its work on a activity.
 *
 * @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
 * @version $Revision: 1.2 $
 */

public class ImplCompleteAuditEvent extends DefaultAuditEvent {

    /** Event type tool completed. */
    public static final String TOOL_COMPLETE = "toolComplete";

    private int completedTool;
    
    /**
     * Creates a new <code>ImplCompleteAuditEvent</code> assigning the
     * given attributes.
     * @param baseInfo a <code>WfAuditEvent</code> containing further
     * information for the event.
     * @param toolIdx index of the tool that has completed.
     * @throws IllegalArgumentException in case of an illegal event 
     * type in <code>baseInfo</code>.
     */
    public ImplCompleteAuditEvent (WfAuditEvent baseInfo, int toolIdx)
  throws IllegalArgumentException {
  super (baseInfo);

  // check event type
        if (!eventType().equals(TOOL_COMPLETE)) {
      throw new IllegalArgumentException
    ("Event type is '" + eventType() + "' must be '"
     + TOOL_COMPLETE + "'");
  }
  completedTool = toolIdx;
    }

    /**
     * Creates a new <code>ImplCompleteAuditEvent</code> with the
     * given source and all other attributes copied from the given
     * event.
     * @param source the value for the source attribute.
     * @param baseInfo a <code>ImplCompleteAuditEvent</code>
     * containing further information for the event.
     */
    private ImplCompleteAuditEvent
  (Object source, ImplCompleteAuditEvent baseInfo) {
  super (source, baseInfo);
        // specialized attributes
  completedTool = baseInfo.completedTool;
    }
    
    /**
     * Return a new audit event object with the source attribute
     * replaced with the given object.
     * @param source the new source attribute.
     * @return the new audit event.
     */
    public DefaultAuditEvent replaceSource (Object source) {
  return new ImplCompleteAuditEvent (source, this);
    }
    
    /**
     * Returns the current value of the attribute
     * <code>completedTool</code>.
     * @return the current value of the attribute.
     */
    public int completedTool(){
  return completedTool;
    }

    /**
     * Returns a textual representation of the event.
     * @return the textual representation
     */
    public String toString() {
  return "ToolCompleteAuditEvent[" + super.toString() 
      + ", completedTool=" + completedTool + "]";
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.