001package org.andromda.cartridges.bpm4struts.metafacades;
002
003import java.util.Collection;
004import org.andromda.metafacades.uml.PseudostateFacade;
005
006
007/**
008 * MetafacadeLogic implementation.
009 *
010 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsActivityGraph
011 * @author Bob Fields
012 */
013public class StrutsActivityGraphLogicImpl
014    extends StrutsActivityGraphLogic
015{
016    private static final long serialVersionUID = 34L;
017    /**
018     * @param metaObject
019     * @param context
020     */
021    public StrutsActivityGraphLogicImpl(
022        Object metaObject,
023        String context)
024    {
025        super(metaObject, context);
026    }
027
028    /**
029     * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsActivityGraphLogic#handleGetFirstAction()
030     */
031    protected Object handleGetFirstAction()
032    {
033        Object firstAction = null;
034        final Collection initialStates = getInitialStates();
035        if (!initialStates.isEmpty())
036        {
037            final PseudostateFacade initialState = (PseudostateFacade)initialStates.iterator().next();
038            final Collection outgoings = initialState.getOutgoings();
039            firstAction = (outgoings.isEmpty()) ? null : outgoings.iterator().next();
040        }
041        return firstAction;
042    }
043}