DefaultAssignmentAuditEvent.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 » DefaultAssignmentAuditEvent.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: DefaultAssignmentAuditEvent.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
 *
 * $Log: DefaultAssignmentAuditEvent.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.8  2003/06/27 08:51:45  lipp
 * Fixed copyright/license information.
 *
 * Revision 1.7  2003/03/31 16:50:28  huaiyang
 * Logging using common-logging.
 *
 * Revision 1.6  2003/02/11 08:49:55  lipp
 * Shortened toString repr.
 *
 * Revision 1.5  2002/10/08 09:46:07  barzik
 * Releasing resources requires NULL setting as the new resource
 *
 * Revision 1.4  2002/10/02 11:27:07  barzik
 * bug fixes and more ...
 *
 * Revision 1.3  2002/10/01 16:06:00  lipp
 * Event queue activated.
 *
 * Revision 1.2  2002/10/01 11:03:14  barzik
 * add toString()
 *
 * Revision 1.1  2002/10/01 09:10:38  lipp
 * AuditEvent handling restructured.
 *
 * Revision 1.3  2002/10/01 06:45:23  barzik
 * no message
 *
 * Revision 1.2  2002/09/30 12:42:05  barzik
 * audit event handling using base event information
 *
 * Revision 1.1  2002/09/24 12:23:02  barzik
 * Initial implementation
 *
 */

package de.danet.an.workflow.domain;

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

/**
 * A <code>DefaultAssignmentAuditEvent</code> implements an audit record of 
 * assignment change information for either the status of an 
 * assignment change for a <code>WfActivity</code> or when an exisiting 
 * assignment is reassigned to another resource.
 */
public class DefaultAssignmentAuditEvent extends DefaultAuditEvent
    implements WfAssignmentAuditEvent {

    private static final org.apache.commons.logging.Log logger
      = org.apache.commons.logging.LogFactory.getLog 
  (DefaultAssignmentAuditEvent.class);

    /**
     * The attribute <code>oldResourceKey</code>. It identifies the
     * resource associated with the assignment before the change.
     * If the assignment was newly created, the value is <code>null</code>. 
     * Hence, setting the attribute is optional.
     */
    private String oldResourceKey = null;

    /**
     * The attribute <code>newResourceKey</code>. It identifies the
     * resource associated with the assignment after the change.
     * Setting the attribute is mandatory.
     */
    private String newResourceKey = null;

    /**
     * The attribute <code>oldResourceName</code>. It identifies the
     * resource's name associated with the assignment before the change.
     * If the assignment was newly created, the value is <code>null</code>. 
     * Hence, setting the attribute is optional.
     */
    private String oldResourceName = null;

    /**
     * The attribute <code>newResourceName</code>. It identifies the
     * resource's name associated with the assignment after the change.
     * Setting the attribute is mandatory.
     */
    private String newResourceName = null;

    /**
     * Creates a new <code>DefaultAssignmentAuditEvent</code>
     * assigning the given attributes.
     * @param baseInfo a <code>WfAuditEvent</code> containing further
     * information for the event.
     * @param oldResourceKey the attribute <code>oldResourceKey</code>.
     * @param newResourceKey the attribute <code>newResourceKey</code>.
     * @param oldResourceName the attribute <code>oldResourceName</code>.
     * @param newResourceName the attribute <code>newResourceName</code>.
     */
    public DefaultAssignmentAuditEvent(WfAuditEvent baseInfo,
               String oldResourceKey,
               String newResourceKey,
               String oldResourceName,
               String newResourceName) {
  // setup base attributes
  super(baseInfo);

        // specialized attributes
        this.oldResourceKey = oldResourceKey;
  this.newResourceKey = newResourceKey;
  this.oldResourceName = oldResourceName;
  this.newResourceName = newResourceName;
    }

    /**
     * Creates a new <code>DefaultAssignmentAuditEvent</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>DefaultAssignmentAuditEvent</code>
     * containing further information for the event.
     */
    private DefaultAssignmentAuditEvent
  (Object source, DefaultAssignmentAuditEvent baseInfo) {
  super (source, baseInfo);
        
        // specialized attributes
        oldResourceKey = baseInfo.oldResourceKey;
  newResourceKey = baseInfo.newResourceKey;
  oldResourceName = baseInfo.oldResourceName;
  newResourceName = baseInfo.newResourceName;
    }
    
    /**
     * 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 DefaultAssignmentAuditEvent (source, this);
    }

    /**
     * Returns the current value of the attribute 
     * <code>oldResourceKey</code>.
     * @return the current value of the attribute.
     */
    public String oldResourceKey(){
  return oldResourceKey;
    }

    /**
     * Returns the current value of the attribute 
     * <code>newResourceKey</code>.
     * @return the current value of the attribute.
     */
    public String newResourceKey(){
  return newResourceKey;
    }

    /**
     * Returns the current value of the attribute 
     * <code>oldResourceName</code>.
     * @return the current value of the attribute.
     */
    public String oldResourceName(){
  return oldResourceName;
    }

    /**
     * Returns the current value of the attribute 
     * <code>newResourceName</code>.
     * @return the current value of the attribute.
     */
    public String newResourceName(){
  return newResourceName;
    }

    /**
     * Returns a textual representation of the event.
     * @return the textual representation
     */
    public String toString() {
  String event = "WfAssignmentAuditEvent["; 
  return event + super.toString() 
      + ", oldResourceKey=" + oldResourceKey
      + ", newResourceKey=" + newResourceKey
      + ", oldResourceName=" + oldResourceName
      + ", newResourceName=" + newResourceName
      + "]";
    }
}
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.