Refine search
@Override public void clientWindowTransition(FacesContext context) { Map<String, String> requestParamMap = context.getExternalContext().getRequestParameterMap(); String toFlowDocumentId = requestParamMap.get(TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME); String flowId = requestParamMap.get(FLOW_ID_REQUEST_PARAM_NAME); if (null != toFlowDocumentId) { // don't use *this*, due to decoration FlowHandler fh = context.getApplication().getFlowHandler(); Flow sourceFlow = fh.getCurrentFlow(context); Flow targetFlow = null; FlowCallNode flowCallNode = null; // if this is not a return... if (null != flowId && !FlowHandler.NULL_FLOW.equals(toFlowDocumentId)) { targetFlow = fh.getFlow(context, toFlowDocumentId, flowId); if (null != targetFlow && null != sourceFlow) { flowCallNode = sourceFlow.getFlowCall(targetFlow); } } else { String maxReturnDepthStr = requestParamMap.get(FLOW_RETURN_DEPTH_PARAM_NAME); int maxReturnDepth = Integer.valueOf(maxReturnDepthStr).intValue(); FlowDeque<Flow> flowStack = getFlowStack(context); flowStack.setMaxReturnDepth(context, maxReturnDepth); } fh.transition(context, sourceFlow, targetFlow, flowCallNode, context.getViewRoot().getViewId()); } }
@Bean("flowScope") @ConditionalOnMissingBean(name = "flowScope") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.INTERFACES) public Map<Object, Object> flowScope() { return FacesContext.getCurrentInstance().getApplication().getFlowHandler().getCurrentFlowScope(); }
private CaseStruct findReturnMatch(FacesContext context, String fromAction, String outcome) { FlowHandler flowHandler = context.getApplication().getFlowHandler(); if (null == flowHandler) { return null; Flow currentFlow = flowHandler.getCurrentFlow(context); if (null != currentFlow) { String fromOutcome = returnNode.getFromOutcome(context); try { flowHandler.pushReturnMode(context); result = getViewId(context, fromAction, fromOutcome, FlowHandler.NULL_FLOW); Flow precedingFlow = flowHandler.getCurrentFlow(context); if (null != precedingFlow) { String toViewId = flowHandler.getLastDisplayedViewId(context); if (null != toViewId) { result = new CaseStruct(); result.viewId = toViewId; result.navCase = new NavigationCase(context.getViewRoot().getViewId(), fromAction, outcome, null, toViewId, FlowHandler.NULL_FLOW, null, false, false); flowHandler.popReturnMode(context);
Flow curFlow = fh.getCurrentFlow(facesContext); if (curFlow != null) fh.pushReturnMode(facesContext); curFlow = fh.getCurrentFlow(facesContext); fh.popReturnMode(facesContext);
ExternalContext extContext = context.getExternalContext(); ViewHandler viewHandler = Util.getViewHandler(context); assert (null != viewHandler); String viewIdBefore = context.getViewRoot().getViewId(); viewIdBefore = (null == viewIdBefore) ? "" : viewIdBefore; String viewIdAfter = caseStruct.navCase.getToViewId(context); viewIdAfter = (null == viewIdAfter) ? "" : viewIdAfter; // NOPMD isUIViewActionBroadcastAndViewdsDiffer = !viewIdBefore.equals(viewIdAfter); if (caseStruct.navCase.isRedirect() || isUIViewActionBroadcastAndViewdsDiffer) { Map<String, List<String>> parameters = caseStruct.navCase.getParameters(); parameters.put(TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, asList(NULL_FLOW)); parameters.put(FLOW_ID_REQUEST_PARAM_NAME, asList("")); FlowHandler flowHandler = context.getApplication().getFlowHandler(); updateRenderTargets(context, caseStruct.viewId); context.setViewRoot(newRoot); FlowHandler flowHandler = context.getApplication().getFlowHandler(); if (flowHandler != null && !isDidTransition(context)) { flowHandler.transition(context, caseStruct.currentFlow, caseStruct.newFlow, caseStruct.facesFlowCallNode, caseStruct.viewId); setDidTransition(context, false);
UIViewRoot viewRoot = facesContext.getViewRoot(); if (viewRoot != null) { if (LOGGER.isLoggable(FINE)) { LOGGER.fine("Found a pre created view in FacesContext"); facesContext.getViewRoot().setLocale(facesContext.getExternalContext().getRequestLocale()); FlowHandler flowHandler = facesContext.getApplication().getFlowHandler(); if (flowHandler != null) { flowHandler.clientWindowTransition(facesContext);
public static void configureAnnotatedFlows(FacesContext facesContext) { FacesFlowProviderFactory factory = FacesFlowProviderFactory.getFacesFlowProviderFactory(facesContext.getExternalContext()); FacesFlowProvider provider = factory.getFacesFlowProvider(facesContext.getExternalContext()); Iterator<Flow> it = provider.getAnnotatedFlows(facesContext); if (it != null) { if (it.hasNext()) { FacesConfigurator.enableDefaultWindowMode(facesContext); } while (it.hasNext()) { Flow flow = it.next(); if (flow instanceof FlowImpl) { ((FlowImpl)flow).freeze(); } facesContext.getApplication().getFlowHandler().addFlow(facesContext, flow); } } } }
} else { FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); ExternalContext extCtx = facesContext.getExternalContext(); switch (index) { case APPLICATION: case FLASH: context.setPropertyResolved(true); return facesContext.getExternalContext().getFlash(); case FACES_FLOW: FlowHandler flowHandler = facesContext.getApplication().getFlowHandler(); if (null != flowHandler) { Map<Object, Object> flowScope = flowHandler.getCurrentFlowScope(); if (null != flowScope) { context.setPropertyResolved(true); case RESOURCE: context.setPropertyResolved(true); return facesContext.getApplication().getResourceHandler(); case SESSION: context.setPropertyResolved(true); if (root != null) { context.setPropertyResolved(true); return facesContext.getViewRoot().getViewMap();
Application application = facesContext.getApplication(); ViewHandler viewHandler = application.getViewHandler(); UIViewRoot viewRoot = facesContext.getViewRoot(); RestoreViewSupport restoreViewSupport = getRestoreViewSupport(facesContext); viewRoot.setLocale(facesContext.getExternalContext().getRequestLocale()); if (viewRoot.isTransient()) checkViewProtection(facesContext, viewHandler, viewRoot.getViewId(), viewRoot); facesContext.getApplication().publishEvent(facesContext, PostClientWindowAndViewInitializedEvent.class, clientWindow); if (clientWindow != null) facesContext.getApplication().publishEvent(facesContext, PostClientWindowAndViewInitializedEvent.class, clientWindow); if (flowHandler != null) flowHandler.clientWindowTransition(facesContext);
UIViewRoot root = ctx.getViewRoot(); String viewId = (root != null ? root.getViewId() : null); FlowHandler fh = ctx.getApplication().getFlowHandler(); toFlowDocumentId = (null != caseStruct.navCase.getToFlowDocumentId()) ? caseStruct.navCase.getToFlowDocumentId() : toFlowDocumentId; } else if ( null != caseStruct && fh != null && fh.getCurrentFlow() != null) { String nodeId = convertToViewIdToFlowOrNodeId(ctx, caseStruct); FlowNode node = fh.getCurrentFlow().getNode(nodeId); if ( node != null) { caseStruct =null; FlowHandler flowHandler = ctx.getApplication().getFlowHandler(); if (null != flowHandler) { currentFlow = flowHandler.getCurrentFlow(ctx); if (null != currentFlow) { caseStruct = findRootNavigationMapAbandonedFlowMatch(ctx, viewId, fromAction, outcome, toFlowDocumentId);
FacesMessage m = MessageUtils.getExceptionMessage(key, params); m.setSeverity(FacesMessage.SEVERITY_WARN); context.addMessage(null, m); Map<String, Object> appMap = context.getExternalContext().getApplicationMap(); FlowHandler flowHandler = context.getApplication().getFlowHandler(); Flow currentFlow = null; Flow newFlow = null; currentFlow = flowHandler.getCurrentFlow(context); newFlow = currentFlow; flowDefiningDocumentId = null; result.navCase = new NavigationCase(currentViewId, fromAction, outcome, null, viewIdToTest, flowDefiningDocumentId, parameters, isRedirect, isIncludeViewParams);
assertNotReleased(); FacesContext facesContext = FacesContext.getCurrentInstance(); FlowScopeMapHelper mapHelper = new FlowScopeMapHelper(facesContext); T result = get(mapHelper, contextual); if (null == result) { FlowHandler flowHandler = facesContext.getApplication().getFlowHandler(); if (!flowHandler.isActive(facesContext, fbi.definingDocumentId, fbi.id)) { throw new ContextNotActiveException("Request to activate bean in flow '" + fbi + "', but that flow is not active.");
Flow currentFlow = flowHandler.getCurrentFlow(context); if (currentFlow == null) String currentLastDisplayedViewId = flowHandler.getLastDisplayedViewId(context); FlowNode node = currentFlow.getNode(fromOutcome); if (node instanceof ReturnNode) flowHandler.pushReturnMode(context); currentFlow = flowHandler.getCurrentFlow(context); i++; flowHandler.pushReturnMode(context); currentFlow = flowHandler.getCurrentFlow(context); i++; if (currentFlow == null) flowHandler.popReturnMode(context); flowHandler.transition(context, sourceFlow, targetFlow, null, context.getViewRoot().getViewId()); Flow targetFlow = flowHandler.getFlow(context, flowDocumentIdRequestParam, flowIdRequestParam); Flow currentFlow = null; FlowCallNode outboundCallNode = null; targetFlow = flowHandler.getFlow(context, calledFlowDocumentId, outboundCallNode.getCalledFlowId(context));
/** * <p class="changed_added_2_2">Convenience overload that calls {@link FacesContext#getCurrentInstance()} * and then calls through to {@link #getCurrentFlow(javax.faces.context.FacesContext)}. </p> * * @return the current {@code Flow} or {@code null} if no flow is active * * @since 2.2 */ public Flow getCurrentFlow() { return getCurrentFlow(FacesContext.getCurrentInstance()); }
private static Flow getCurrentFlow(FacesContext context) { FlowHandler flowHandler = context.getApplication().getFlowHandler(); if (null == flowHandler) { return null; } Flow result = flowHandler.getCurrentFlow(context); return result; }
String toFlowDocumentId) String viewId = facesContext.getViewRoot() != null ? facesContext.getViewRoot().getViewId() : null; NavigationCase navigationCase = getNavigationCommandFromGlobalNavigationCases( facesContext, viewId, navigationContext, fromAction, outcome); if (outcome != null && navigationCase == null) FlowHandler flowHandler = facesContext.getApplication().getFlowHandler(); List<Flow> activeFlows = FlowHandlerImpl.getActiveFlows(facesContext, flowHandler); if (flowHandler.isActive(facesContext, targetFlow.getDefiningDocumentId(), targetFlow.getId())) if (flowHandler.isActive(facesContext, targetFlow.getDefiningDocumentId(), targetFlow.getId()) && targetFlowCallNode == null) outcomeToGo = navigationCase.getToViewId(facesContext); checkNavCase = false;
Flow currentFlow = flowHandler.getCurrentFlow(context); Flow newFlow = null; FlowCallNode facesFlowCallNode = null; newFlow = flowHandler.getFlow(context, flowDocumentId, flowId); if (null != newFlow) { String startNodeId = newFlow.getStartNodeId(); flowHandler.transition(context, currentFlow, newFlow, facesFlowCallNode, startNodeId); result = getViewId(context, fromAction, startNodeId, toFlowDocumentId); } finally { flowHandler.transition(context, newFlow, currentFlow, null, outcome); setDidTransition(context, false); newFlow = flowHandler.getFlow(context, toFlowDocumentId, outcome); if (null != newFlow) { String startNodeId = newFlow.getStartNodeId(); flowHandler.transition(context, null, newFlow, null, startNodeId); result = getViewId(context, fromAction, startNodeId, toFlowDocumentId); } finally { flowHandler.transition(context, newFlow, null, null, outcome); setDidTransition(context, false);
public List<Flow> getActiveFlows(FacesContext context) Object session = context.getExternalContext().getSession(false); if (session == null) ClientWindow clientWindow = context.getExternalContext().getClientWindow(); if (clientWindow == null) if ( Boolean.TRUE.equals(context.getAttributes().get(RETURN_MODE)) ) FlowHandler fh = context.getApplication().getFlowHandler(); Flow curFlow = fh.getCurrentFlow(context); if (curFlow != null) fh.pushReturnMode(context); curFlow = fh.getCurrentFlow(context); fh.popReturnMode(context);
boolean match = false; for (NavigationCase cnc : caseSet) { String cncFromAction = cnc.getFromAction(); String cncFromOutcome = cnc.getFromOutcome(); boolean cncHasCondition = cnc.hasCondition(); String cncToViewId = cnc.getToViewId(ctx); toFlowDocumentId = (null != cnc.getToFlowDocumentId()) ? cnc.getToFlowDocumentId() : toFlowDocumentId; if (null != toFlowDocumentId) { FlowHandler fh = ctx.getApplication().getFlowHandler(); if (null != outcome) { result.isFlowEntryFromExplicitRule = null != fh.getFlow(ctx, toFlowDocumentId, convertToViewIdToFlowOrNodeId(ctx, result));
public void createCurrentFlowScope(FacesContext facesContext) { ClientWindow cw = facesContext.getExternalContext().getClientWindow(); String baseKey = cw.getId(); FlowHandler flowHandler = facesContext.getApplication().getFlowHandler(); Flow flow = flowHandler.getCurrentFlow(facesContext); String flowMapKey = FlowUtils.getFlowMapKey(facesContext, flow); List<String> activeFlowKeys = activeFlowMapKeys.get(baseKey); if (activeFlowKeys == null) { activeFlowKeys = new ArrayList<String>(); } activeFlowKeys.add(0, flowMapKey); activeFlowMapKeys.put(baseKey, activeFlowKeys); refreshClientWindow(facesContext); }