001package org.andromda.cartridges.jsf.metafacades;
002
003import org.andromda.metafacades.uml.FrontEndUseCase;
004import org.andromda.metafacades.uml.UMLProfile;
005
006/**
007 * MetafacadeLogic implementation for org.andromda.cartridges.jsf.metafacades.JSFFinalState.
008 *
009 * @see org.andromda.cartridges.jsf.metafacades.JSFFinalState
010 */
011public class JSFFinalStateLogicImpl
012    extends JSFFinalStateLogic
013{
014    private static final long serialVersionUID = 34L;
015    /**
016     * @param metaObject
017     * @param context
018     */
019    public JSFFinalStateLogicImpl(Object metaObject, String context)
020    {
021        super(metaObject, context);
022    }
023
024    /**
025     * @return fullPath
026     * @see org.andromda.cartridges.jsf.metafacades.JSFFinalState#getPath()
027     */
028    protected String handleGetPath()
029    {
030        String fullPath = null;
031
032        FrontEndUseCase useCase = this.getTargetUseCase();
033        if (useCase == null)
034        {
035            // - perhaps this final state links outside of the UML model
036            final Object taggedValue = this.findTaggedValue(UMLProfile.TAGGEDVALUE_EXTERNAL_HYPERLINK);
037            if (taggedValue == null)
038            {
039                String name = getName();
040                if (name != null && (name.startsWith("/") || name.startsWith("http://") || name.startsWith("file:")))
041                {
042                    fullPath = name;
043                }
044            }
045            else
046            {
047                fullPath = String.valueOf(taggedValue);
048            }
049        }
050        else if (useCase instanceof JSFUseCase)
051        {
052            fullPath = ((JSFUseCase)useCase).getPath();
053        }
054
055        return fullPath;
056    }
057}