001package org.andromda.cartridges.jbpm.metafacades;
002
003import org.andromda.cartridges.jbpm.JBpmProfile;
004import org.andromda.metafacades.uml.ActivityGraphFacade;
005import org.andromda.metafacades.uml.GuardFacade;
006
007/**
008 * MetafacadeLogic implementation for org.andromda.cartridges.jbpm.metafacades.JBpmTransition.
009 *
010 * @see org.andromda.cartridges.jbpm.metafacades.JBpmTransition
011 */
012public class JBpmTransitionLogicImpl
013        extends JBpmTransitionLogic
014{
015    private static final long serialVersionUID = 34L;
016    /**
017     * @param metaObject
018     * @param context
019     */
020    public JBpmTransitionLogicImpl(Object metaObject, String context)
021    {
022        super(metaObject, context);
023    }
024
025    /**
026     * @see org.andromda.cartridges.jbpm.metafacades.JBpmTransitionLogic#handleIsContainedInBusinessProcess()
027     */
028    protected boolean handleIsContainedInBusinessProcess()
029    {
030        return this.getSource().getStateMachine() instanceof ActivityGraphFacade &&
031                ((ActivityGraphFacade)this.getSource().getStateMachine()).getUseCase() instanceof JBpmProcessDefinition;
032    }
033
034    /**
035     * @see org.andromda.cartridges.jbpm.metafacades.JBpmTransitionLogic#handleGetCondition()
036     */
037    protected String handleGetCondition()
038    {
039        String decision = null;
040
041        final GuardFacade guard = this.getGuard();
042        if (guard != null)
043        {
044            decision = guard.getBody();
045        }
046
047        return decision;
048    }
049
050    /**
051     * @see org.andromda.cartridges.jbpm.metafacades.JBpmTransitionLogic#handleIsTaskNode()
052     */
053    protected boolean handleIsTaskNode()
054    {
055        return hasStereotype(JBpmProfile.STEREOTYPE_TASK);
056    }
057}