All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.andromda.metafacades.emf.uml22.CallEventFacadeLogicImpl Maven / Gradle / Ivy

Go to download

The Eclipse EMF UML2 v2.X metafacades. This is the set of EMF UML2 2.X metafacades implementations. These implement the common UML metafacades for .uml model files.

The newest version!
package org.andromda.metafacades.emf.uml22;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.andromda.metafacades.uml.OperationFacade;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ActivityNode;
import org.eclipse.uml2.uml.CallOperationAction;
import org.eclipse.uml2.uml.Operation;

/**
 * MetafacadeLogic implementation for
 * org.andromda.metafacades.uml.CallEventFacade. UML1.4 Event is mapped to UML2
 * Activity (because UML2 Event doesn't contain parameters)
 *
 * @see org.andromda.metafacades.uml.CallEventFacade
 */
public class CallEventFacadeLogicImpl extends CallEventFacadeLogic
{
    private static final long serialVersionUID = 7223650138117667366L;

    /**
     * @param metaObject
     * @param context
     */
    public CallEventFacadeLogicImpl(final Activity metaObject,
            final String context)
    {
        super(metaObject, context);
    }

    /**
     * @see org.andromda.metafacades.uml.CallEventFacade#getOperation()
     */
    @Override
    protected OperationFacade handleGetOperation()
    {
        final Collection operations = this.getOperations();
        return operations.isEmpty() ? null : operations.iterator().next();
    }

    /**
     * @see org.andromda.metafacades.uml.CallEventFacade#getOperations()
     */
    @Override
    public List handleGetOperations()
    {
        // We get every operation from each CallOperationAction instance.
        final List operations = new ArrayList();
        final Collection nodes = this.metaObject.getNodes();
        for (final ActivityNode nextNode : nodes)
        {
            if (nextNode instanceof CallOperationAction)
            {
                final Operation operation = ((CallOperationAction) nextNode).getOperation();
                if (operation != null)
                {
                    operations.add(operation);
                }
            }
        }
        return operations;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy