//Source file: H:\\temp\\generated\\modTransf\\rules\\core\\ActionClauseList.java
package modTransf.rules.core;
import java.util.ArrayList;
import modTransf.engine.RuleContext;
import modTransf.engine.TransformationException;
import modTransf.engine.EngineLifeCycle;
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import modTransf.engine.EngineException;
/**
* A list of actions.
* <p>Titre : ModTransf V3</p>
* <p>Description : </p>
* <p>Copyright : Copyright (c) 2005</p>
* <p>Soci�t� : </p>
* @author Cedric Dumoulin
* @version 3.0
*/
public class ActionList extends ArrayList implements Action
{
public ActionList()
{
super();
}
public ActionList(Collection coll)
{
super(coll);
}
/**
* Check the type. It should be an Action.
* @param action Object
* @return boolean
*/
public boolean add( Object action )
{
return add((Action)action);
}
/**
* Add an action.
* @param action Action
* @return boolean
*/
public boolean add( Action action )
{
return super.add(action);
}
/**
* @param bean
* @param request
* @return Object
* @throws modTransf.TransformationException
*/
public Object execute(Object object, RuleContext request) throws TransformationException
{
Object res = null;
Action action = null;
try
{
Iterator iterator = iterator();
while(iterator.hasNext())
{
action = (Action) iterator.next();
res = action.execute(object, request);
} // end loop
}
catch( TransformationException ex )
{ // Add the stack trace.
// This allow to have a list of the calls to the method.
// This list is build only if an error occur.
ex.fillInStackTrace( (Object)action, object, "action");
throw ex;
}
catch( Exception ex )
{ // Add the stack trace.
// This allow to have a list of the calls to the method.
// This list is build only if an error occur.
TransformationException tex = new TransformationException(ex);
tex.fillInStackTrace( (Object)action, object, "action");
throw tex;
}
return res;
}
/**
* @param context
*/
public void engineStart(RuleContext context)
throws EngineException
{
Iterator iterator = iterator();
while( iterator.hasNext() )
{
((EngineLifeCycle)iterator.next()).engineStart( context );
} // end loop
}
/**
* @param context
*/
public void engineFinish(RuleContext context)
throws EngineException
{
Iterator iterator = iterator();
while( iterator.hasNext() )
{
((EngineLifeCycle)iterator.next()).engineFinish( context);
} // end loop
}
}