if (forward != null)
{
final Collection forwardParameters = forward.getForwardParameters();
for (final Iterator parameterIterator = forwardParameters.iterator(); parameterIterator.hasNext();)
{
final ModelElementFacade forwardParameter = (ModelElementFacade) parameterIterator.next();
formFieldMap.put(forwardParameter.getName(), forwardParameter);
}
}
}
// add page variables for all pages/final-states targetted
// also add the fields of the target page's actions (for preloading)
final Collection forwards = getActionForwards();
for (final Iterator iterator = forwards.iterator(); iterator.hasNext();)
{
final StrutsForward forward = (StrutsForward) iterator.next();
final StateVertexFacade target = forward.getTarget();
if (target instanceof StrutsJsp)
{
final StrutsJsp jsp = (StrutsJsp) target;
final Collection pageVariables = jsp.getPageVariables();
for (final Iterator pageVariableIterator = pageVariables.iterator(); pageVariableIterator.hasNext();)
{
final ModelElementFacade facade = (ModelElementFacade) pageVariableIterator.next();
formFieldMap.put(facade.getName(), facade);
}
final Collection allActionParameters = jsp.getAllActionParameters();
for (final Iterator actionParameterIterator = allActionParameters.iterator();
actionParameterIterator.hasNext();)
{
final ModelElementFacade facade = (ModelElementFacade) actionParameterIterator.next();
formFieldMap.put(facade.getName(), facade);
}
}
else if (target instanceof StrutsFinalState)
{
// only add these if there is no parameter recorded yet with the same name
final Collection forwardParameters = forward.getForwardParameters();
for (final Iterator forwardParameterIterator = forwardParameters.iterator();
forwardParameterIterator.hasNext();)
{
final ModelElementFacade facade = (ModelElementFacade) forwardParameterIterator.next();
if (!formFieldMap.containsKey(facade.getName()))
{
formFieldMap.put(facade.getName(), facade);
}
}
}
}
// we do the action parameters in the end because they are allowed to overwrite existing properties
final Collection actionParameters = getActionParameters();
for (final Iterator actionParameterIterator = actionParameters.iterator(); actionParameterIterator.hasNext();)
{
final ModelElementFacade facade = (ModelElementFacade) actionParameterIterator.next();
formFieldMap.put(facade.getName(), facade);
}
return new ArrayList(formFieldMap.values());
}