BAForExceptionHandling.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 » BAForExceptionHandling.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: BAForExceptionHandling.java,v 1.5 2007/05/03 21:58:18 mlipp Exp $
 *
 * $Log: BAForExceptionHandling.java,v $
 * Revision 1.5  2007/05/03 21:58:18  mlipp
 * Internal refactoring for making better use of local EJBs.
 *
 * Revision 1.4  2006/12/14 16:05:51  drmlipp
 * Changed handling of conditions in exception transitions.
 *
 * Revision 1.3  2006/09/29 12:32:08  drmlipp
 * Consistently using WfMOpen as projct name now.
 *
 * Revision 1.2  2005/01/05 21:29:22  mlipp
 * Added method to retrieve handled exceptions.
 *
 * Revision 1.1.1.1  2004/08/18 15:17:38  drmlipp
 * Update to 1.2
 *
 * Revision 1.2  2004/05/09 18:42:59  lipp
 * Finished process instantiation restructuring.
 *
 * Revision 1.1  2004/05/06 19:39:18  lipp
 * Restructured block activity handling.
 *
 */
package de.danet.an.workflow.domain;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.rmi.RemoteException;

import de.danet.an.workflow.api.Activity.JoinAndSplitMode;
import de.danet.an.workflow.omgcore.WfExecutionObject.State;

/**
 * This class provides a representation of a block activity for
 * exception handling. Block activities are not really instantiated;
 * nevertheless we need a representation for transition management as
 * they can be the source of an exception.
 *
 * @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
 * @version $Revision: 1.5 $
 */
public class BAForExceptionHandling extends BlockActivity
    implements Serializable {

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

    private List definedExceptions = new ArrayList ();
    private State state = RunningState.RUNNING;
    private Collection predecessors = null;
    
    /**
     * Creates an instance of <code>BAForExceptionHandling</code>
     * with all attributes initialized to given values.
     * @param key block activity key
     */
    public BAForExceptionHandling (String key) {
  super (key);
    }

    /**
     * Update the properties of the block activity for handling of a
     * specific exception.
     * @param dls the deadlines defined for this block activity
     * @param state the state to assume
     * @param pres the predecessors from an execution thread point of
     * view
     */
    public void update (List dls, State state, Collection pres) {
  for (Iterator i = dls.iterator (); i.hasNext ();) {
      Deadline dl = (Deadline)i.next ();
      definedExceptions.add (dl.getExceptionName());
  }
  predecessors = pres;
    }

    /**
     * Return the predecessors passed to the constructor.
     * @return the predecessors
     */
    public Collection predecessors() {
  return predecessors;
    }
    
    /* Comment copied from interface. */
    public State typedState () {
  return state;
    }

    /* Comment copied from interface. */
    public JoinAndSplitMode splitMode() {
  return JoinAndSplitMode.AND;
    }

    /**
     * Return string representation for debugging purposes.
     * @return a string representation.
     */
    public String toString() {
        return "BAForExceptionHandling[" + key() + "]";
    }
}
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.