Object session = context.getExternalContext().getSession(false);
if (session == null)
{
return Collections.emptyList();
}
ClientWindow clientWindow = context.getExternalContext().getClientWindow();
if (clientWindow == null)
{
return Collections.emptyList();
}
if ( Boolean.TRUE.equals(context.getAttributes().get(RETURN_MODE)) )
{
// Use the standard form
FlowHandler fh = context.getApplication().getFlowHandler();
Flow curFlow = fh.getCurrentFlow(context);
if (curFlow != null)
{
List<Flow> activeFlows = new ArrayList<Flow>();
while (curFlow != null)
{
activeFlows.add(curFlow);
fh.pushReturnMode(context);
curFlow = fh.getCurrentFlow(context);
}
for (int i = 0; i < activeFlows.size(); i++)
{
fh.popReturnMode(context);
}
return activeFlows;
}
else
{
return Collections.emptyList();
}
}
else
{
Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
String currentFlowMapKey = CURRENT_FLOW_STACK + clientWindow.getId();
List<_FlowContextualInfo> currentFlowStack = (List<_FlowContextualInfo>) sessionMap.get(currentFlowMapKey);
if (currentFlowStack == null)
{
return Collections.emptyList();