org.andromda.metafacades.uml14.FrontEndViewLogicImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of andromda-metafacades-uml14 Show documentation
Show all versions of andromda-metafacades-uml14 Show documentation
The UML 1.4 metafacades. This is the set of UML 1.4 metafacades
implementations. These implement the common UML metafacades.
The newest version!
package org.andromda.metafacades.uml14;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.andromda.metafacades.uml.ActivityGraphFacade;
import org.andromda.metafacades.uml.EventFacade;
import org.andromda.metafacades.uml.FrontEndAction;
import org.andromda.metafacades.uml.FrontEndParameter;
import org.andromda.metafacades.uml.FrontEndUseCase;
import org.andromda.metafacades.uml.ModelElementFacade;
import org.andromda.metafacades.uml.StateMachineFacade;
import org.andromda.metafacades.uml.TransitionFacade;
import org.andromda.metafacades.uml.UMLProfile;
import org.andromda.metafacades.uml.UseCaseFacade;
/**
* MetafacadeLogic implementation for org.andromda.metafacades.uml.FrontEndView.
*
* @see org.andromda.metafacades.uml.FrontEndView
* @author Bob Fields
*/
public class FrontEndViewLogicImpl
extends FrontEndViewLogic
{
private static final long serialVersionUID = 3878476296052353951L;
/**
* @param metaObject
* @param context
*/
public FrontEndViewLogicImpl(
Object metaObject,
String context)
{
super(metaObject, context);
}
/**
* @see org.andromda.metafacades.uml.FrontEndView#isFrontEndView()
*/
@Override
protected boolean handleIsFrontEndView()
{
return this.hasStereotype(UMLProfile.STEREOTYPE_FRONT_END_VIEW);
}
// TODO StrutsFinalStateLogicImpl uses getIncomings instead of getOutgoings - why?
/* Moved to StateVertexFacade
* @see org.andromda.metafacades.uml.FrontEndView#getActions()
@Override
protected List handleGetActions()
{
final List actions = new ArrayList();
final Collection outgoing = getOutgoings();
for (final Iterator iterator = outgoing.iterator(); iterator.hasNext();)
{
final Object object = iterator.next();
if (object instanceof FrontEndAction)
{
actions.add((FrontEndAction)object);
}
}
return actions;
}
*/
/**
* @see org.andromda.metafacades.uml.FrontEndView#getUseCase()
*/
@Override
protected FrontEndUseCase handleGetUseCase()
{
UseCaseFacade useCase = null;
final StateMachineFacade graphContext = this.getStateMachine();
if (graphContext instanceof ActivityGraphFacade)
{
useCase = ((ActivityGraphFacade)graphContext).getUseCase();
if (!(useCase instanceof FrontEndUseCase))
{
useCase = null;
}
}
return (FrontEndUseCase)useCase;
}
/**
* Override to create the package of the view.
*
* @see org.andromda.metafacades.uml14.ModelElementFacadeLogic#handleGetPackageName()
*/
@Override
public String handleGetPackageName()
{
String packageName = null;
final StateMachineFacade graphContext = this.getStateMachine();
if (graphContext instanceof ActivityGraphFacade)
{
final UseCaseFacade graphUseCase = ((ActivityGraphFacade)graphContext).getUseCase();
if (graphUseCase instanceof FrontEndUseCase)
{
final FrontEndUseCase useCase = (FrontEndUseCase)graphUseCase;
packageName = useCase.getPackageName();
}
}
return packageName;
}
/**
* @see org.andromda.metafacades.uml.FrontEndView#getVariables()
*/
@Override
protected List handleGetVariables()
{
final Map variablesMap = new LinkedHashMap();
final Collection incoming = getIncomings();
for (final Iterator iterator = incoming.iterator(); iterator.hasNext();)
{
final TransitionFacade transition = (TransitionFacade)iterator.next();
final EventFacade trigger = transition.getTrigger();
if (trigger != null)
{
for (final Iterator parameterIterator = trigger.getParameters().iterator(); parameterIterator.hasNext();)
{
final ModelElementFacade modelElement = (ModelElementFacade)parameterIterator.next();
variablesMap.put(modelElement.getName(), modelElement);
}
}
}
return new ArrayList(variablesMap.values());
}
/**
* @see org.andromda.metafacades.uml.FrontEndView#getAllActionParameters()
*/
@Override
protected List handleGetAllActionParameters()
{
final List actionParameters = new ArrayList();
final Collection actions = this.getActions();
for (final Iterator iterator = actions.iterator(); iterator.hasNext();)
{
final FrontEndAction action = iterator.next();
actionParameters.addAll(action.getParameters());
}
return actionParameters;
}
/**
* @see org.andromda.metafacades.uml.FrontEndView#getAllFormFields()
*/
@Override
protected List handleGetAllFormFields()
{
final List actionParameters = new ArrayList();
final Collection actions = getActions();
for (final Iterator iterator = actions.iterator(); iterator.hasNext();)
{
final FrontEndAction action = iterator.next();
actionParameters.addAll(action.getParameters());
}
return actionParameters;
}
/**
* @see org.andromda.metafacades.uml.FrontEndView#getTables()
*/
@Override
protected List handleGetTables()
{
final List variables = new ArrayList(this.getVariables());
for (final Iterator iterator = variables.iterator(); iterator.hasNext();)
{
final FrontEndParameter parameter = iterator.next();
if (!parameter.isTable())
{
iterator.remove();
}
}
return variables;
}
/**
* @return Outgoings FrontEndActions
* @see org.andromda.metafacades.uml.FrontEndView#getActions()
*/
@Override
protected List handleGetActions()
{
final List actions = new ArrayList();
final Collection outgoings = getOutgoings();
for (final Iterator iterator = outgoings.iterator(); iterator.hasNext();)
{
final TransitionFacade object = iterator.next();
if (object instanceof FrontEndAction)
{
actions.add((FrontEndAction)object);
}
}
// TODO StrutsFinalStateLogicImpl uses getIncomings INSTEAD OF getOutgoings - why?
/*final Collection incomings = getIncomings();
for (final Iterator iterator = incomings.iterator(); iterator.hasNext();)
{
final TransitionFacade object = iterator.next();
if (object instanceof FrontEndAction)
{
actions.add((FrontEndAction)object);
}
}*/
return actions;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy