CaseStruct result = null;
FlowHandler flowHandler = context.getApplication().getFlowHandler();
if (null == flowHandler) {
return null;
}
Flow currentFlow = flowHandler.getCurrentFlow(context);
if (null != currentFlow) {
// If so, see if the outcome is one of this flow's
// faces-flow-return nodes.
ReturnNode returnNode = currentFlow.getReturns().get(outcome);
if (null != returnNode) {
String fromOutcome = returnNode.getFromOutcome(context);
try {
flowHandler.pushReturnMode(context);
result = getViewId(context, fromAction, fromOutcome, FlowHandler.NULL_FLOW);
// We are in a return node, but no result can be found from that
// node. Show the last displayed viewId from the preceding flow.
if (null == result) {
Flow precedingFlow = flowHandler.getCurrentFlow(context);
if (null != precedingFlow) {
String toViewId = flowHandler.getLastDisplayedViewId(context);
if (null != toViewId) {
result = new CaseStruct();
result.viewId = toViewId;