001package org.andromda.metafacades.uml14;
002
003import java.util.Collection;
004import java.util.Iterator;
005import org.andromda.utils.StringUtilsHelper;
006import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
007import org.omg.uml.foundation.core.ModelElement;
008import org.omg.uml.behavioralelements.usecases.UseCase;
009
010/**
011 * Metaclass facade implementation.
012 * @author Bob Fields
013 */
014public class UseCaseFacadeLogicImpl
015    extends UseCaseFacadeLogic
016{
017    private static final long serialVersionUID = 2563683138479430934L;
018
019    /**
020     * @param metaObject
021     * @param context
022     */
023    public UseCaseFacadeLogicImpl(
024        UseCase metaObject,
025        String context)
026    {
027        super(metaObject, context);
028    }
029
030    /**
031     * @see org.andromda.metafacades.uml14.ModelElementFacadeLogic#handleGetName()
032     */
033    protected String handleGetName()
034    {
035        return StringUtilsHelper.toSingleLine(super.handleGetName());
036    }
037
038    /**
039     * @see org.andromda.metafacades.uml14.UseCaseFacadeLogic#handleGetFirstActivityGraph()
040     */
041    protected ActivityGraph handleGetFirstActivityGraph()
042    {
043        ActivityGraph activityGraph = null;
044
045        for (final Iterator iterator = metaObject.getOwnedElement().iterator();
046            iterator.hasNext() && activityGraph == null;)
047        {
048            final ModelElement modelElement = (ModelElement)iterator.next();
049            if (modelElement instanceof ActivityGraph)
050            {
051                activityGraph = (ActivityGraph)modelElement;
052            }
053        }
054
055        return activityGraph;
056    }
057
058    /**
059     * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
060     */
061    public Object getValidationOwner()
062    {
063        return getPackage();
064    }
065
066    /**
067     * @see org.andromda.metafacades.uml.UseCaseFacade#getExtensionPoints()
068     */
069    @Override
070    protected Collection handleGetExtensionPoints()
071    {
072        return metaObject.getExtensionPoint();
073    }
074
075    /**
076     * @see org.andromda.metafacades.uml.UseCaseFacade#getExtends()
077     */
078    @Override
079    protected Collection handleGetExtends()
080    {
081        return metaObject.getExtend();
082    }
083
084    /**
085     * @see org.andromda.metafacades.uml.UseCaseFacade#getIncludes()
086     */
087    @Override
088    protected Collection handleGetIncludes()
089    {
090        return metaObject.getInclude();
091    }
092}