@Override public FlowCallNode getFlowCall(Flow targetFlow) { String targetFlowId = targetFlow.getId(); if (!hasBeenInitialized) { FacesContext context = FacesContext.getCurrentInstance(); this.init(context); } FlowCallNode result = _facesFlowCallsByTargetFlowId.get(targetFlowId); return result; }
@Override public FlowCallNode getFlowCall(Flow targetFlow) { String targetFlowId = targetFlow.getId(); if (!hasBeenInitialized) { FacesContext context = FacesContext.getCurrentInstance(); this.init(context); } FlowCallNode result = _facesFlowCallsByTargetFlowId.get(targetFlowId); return result; }
@Override public FlowCallNode getFlowCall(Flow targetFlow) { String targetFlowId = targetFlow.getId(); if (!hasBeenInitialized) { FacesContext context = FacesContext.getCurrentInstance(); this.init(context); } FlowCallNode result = _facesFlowCallsByTargetFlowId.get(targetFlowId); return result; }
@Override public FlowCallNode getFlowCall(Flow targetFlow) { String targetFlowId = targetFlow.getId(); if (!hasBeenInitialized) { FacesContext context = FacesContext.getCurrentInstance(); this.init(context); } FlowCallNode result = _facesFlowCallsByTargetFlowId.get(targetFlowId); return result; }
private String resolveStartNodeOutcome(Flow targetFlow) { String outcomeToGo; if (targetFlow.getStartNodeId() == null) { // In faces-config javadoc says: // "If there is no <start-node> element declared, it // is assumed to be <flowName>.xhtml." outcomeToGo = "/" + targetFlow.getId()+ "/" + targetFlow.getId() + ".xhtml"; } else { outcomeToGo = targetFlow.getStartNodeId(); } return outcomeToGo; }
@Override public void doAfterEnterFlow(FacesContext facesContext, Flow flow) { // Reset current flow scope map String mapKey = CURRENT_FLOW_SCOPE_MAP+SEPARATOR_CHAR+ flow.getDefiningDocumentId()+SEPARATOR_CHAR+flow.getId(); facesContext.getAttributes().remove(mapKey); }
private NavigationInfo getNavigationInfo(FacesContext context, String toFlowDocumentId, String flowId) { NavigationInfo result = null; assert(null != navigationMaps); result = navigationMaps.get(toFlowDocumentId + flowId); if (null == result) { FlowHandler fh = context.getApplication().getFlowHandler(); if (null != fh) { Flow currentFlow = fh.getCurrentFlow(context); if (null != currentFlow) { result = navigationMaps.get(currentFlow.getDefiningDocumentId() + currentFlow.getId()); } } } return result; }
private Set<String> getWildCardMatchList(FacesContext context) { Set<String> result = Collections.emptySet(); NavigationInfo info = null; FlowHandler fh = context.getApplication().getFlowHandler(); if (null != fh) { Flow currentFlow = fh.getCurrentFlow(context); if (null != currentFlow) { info = navigationMaps.get(currentFlow.getDefiningDocumentId() + currentFlow.getId()); } } if (null == info) { info = navigationMaps.get(ROOT_NAVIGATION_MAP_ID); } if (null != info.ruleSet && null != info.ruleSet.wildcardMatchList) { result = info.ruleSet.wildcardMatchList; } return result; }
private NavigationInfo getNavigationInfo(FacesContext context, String toFlowDocumentId, String flowId) { NavigationInfo result = null; assert (null != navigationMaps); result = navigationMaps.get(toFlowDocumentId + flowId); if (null == result) { FlowHandler fh = context.getApplication().getFlowHandler(); if (null != fh) { Flow currentFlow = fh.getCurrentFlow(context); if (null != currentFlow) { result = navigationMaps.get(currentFlow.getDefiningDocumentId() + currentFlow.getId()); } } } return result; }
private Set<String> getWildCardMatchList(FacesContext context) { Set<String> result = Collections.emptySet(); NavigationInfo info = null; FlowHandler fh = context.getApplication().getFlowHandler(); if (null != fh) { Flow currentFlow = fh.getCurrentFlow(context); if (null != currentFlow) { info = navigationMaps.get(currentFlow.getDefiningDocumentId() + currentFlow.getId()); } } if (null == info) { info = navigationMaps.get(ROOT_NAVIGATION_MAP_ID); } if (null != info.ruleSet && null != info.ruleSet.wildcardMatchList) { result = info.ruleSet.wildcardMatchList; } return result; }
private NavigationInfo getNavigationInfo(FacesContext context, String toFlowDocumentId, String flowId) { NavigationInfo result = null; assert (null != navigationMaps); result = navigationMaps.get(toFlowDocumentId + flowId); if (null == result) { FlowHandler fh = context.getApplication().getFlowHandler(); if (null != fh) { Flow currentFlow = fh.getCurrentFlow(context); if (null != currentFlow) { result = navigationMaps.get(currentFlow.getDefiningDocumentId() + currentFlow.getId()); } } } return result; }
private Set<String> getWildCardMatchList(FacesContext context) { Set<String> result = Collections.emptySet(); NavigationInfo info = null; FlowHandler fh = context.getApplication().getFlowHandler(); if (null != fh) { Flow currentFlow = fh.getCurrentFlow(context); if (null != currentFlow) { info = navigationMaps.get(currentFlow.getDefiningDocumentId() + currentFlow.getId()); } } if (null == info) { info = navigationMaps.get(ROOT_NAVIGATION_MAP_ID); } if (null != info.ruleSet && null != info.ruleSet.wildcardMatchList) { result = info.ruleSet.wildcardMatchList; } return result; }
private NavigationInfo getNavigationInfo(FacesContext context, String toFlowDocumentId, String flowId) { NavigationInfo result = null; assert (null != navigationMaps); result = navigationMaps.get(toFlowDocumentId + flowId); if (null == result) { FlowHandler fh = context.getApplication().getFlowHandler(); if (null != fh) { Flow currentFlow = fh.getCurrentFlow(context); if (null != currentFlow) { result = navigationMaps.get(currentFlow.getDefiningDocumentId() + currentFlow.getId()); } } } return result; }
private static int getFlowIndex(FacesContext facesContext, Flow flow) { List<Flow> list = FlowHandlerImpl.getActiveFlows(facesContext, facesContext.getApplication().getFlowHandler()); FlowReference flowRef = new FlowReference(flow.getDefiningDocumentId(), flow.getId()); int flowIndex = 0; for (Flow f : list) { FlowReference fr = new FlowReference(f.getDefiningDocumentId(), f.getId()); if (flowRef.equals(fr)) { flowIndex++; } } return flowIndex; }
@Override public boolean isActive(FacesContext context, String definingDocumentId, String id) { Util.notNull("context", context); Util.notNull("definingDocumentId", definingDocumentId); Util.notNull("id", id); boolean result = false; FlowDeque<Flow> flowStack = getFlowStack(context); for (Flow cur : flowStack) { if (id.equals(cur.getId()) && definingDocumentId.equals(cur.getDefiningDocumentId())) { result = true; break; } } return result; }
@Override public boolean isActive(FacesContext context, String definingDocumentId, String id) { Util.notNull("context", context); Util.notNull("definingDocumentId", definingDocumentId); Util.notNull("id", id); boolean result = false; FlowDeque<Flow> flowStack = getFlowStack(context); for (Flow cur : flowStack) { if (id.equals(cur.getId()) && definingDocumentId.equals(cur.getDefiningDocumentId())) { result = true; break; } } return result; }
@Override public void doAfterEnterFlow(FacesContext context, Flow flow) { BeanManager beanManager = getBeanManager(context); if (beanManager != null) { FlowScopeBeanHolder beanHolder = CDIUtils.lookup(beanManager, FlowScopeBeanHolder.class); beanHolder.createCurrentFlowScope(context); } String mapKey = CURRENT_FLOW_SCOPE_MAP+SEPARATOR_CHAR+ flow.getDefiningDocumentId()+SEPARATOR_CHAR+flow.getId(); context.getAttributes().remove(mapKey); }
@Override public void doBeforeExitFlow(FacesContext context, Flow flow) { BeanManager beanManager = getBeanManager(context); if (beanManager != null) { FlowScopeBeanHolder beanHolder = CDIUtils.lookup(beanManager, FlowScopeBeanHolder.class); beanHolder.destroyCurrentFlowScope(context); } String mapKey = CURRENT_FLOW_SCOPE_MAP+SEPARATOR_CHAR+ flow.getDefiningDocumentId()+SEPARATOR_CHAR+flow.getId(); context.getAttributes().remove(mapKey); }
@Override public boolean isActive(FacesContext context, String definingDocumentId, String id) { Util.notNull("context", context); Util.notNull("definingDocumentId", definingDocumentId); Util.notNull("id", id); boolean result = false; FlowDeque<Flow> flowStack = getFlowStack(context); for (Flow cur : flowStack) { if (id.equals(cur.getId()) && definingDocumentId.equals(cur.getDefiningDocumentId())) { result = true; break; } } return result; }
@Override public Map<Object, Object> getCurrentFlowScope(FacesContext facesContext) { Flow flow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext); if (flow != null) { String mapKey = CURRENT_FLOW_SCOPE_MAP+SEPARATOR_CHAR+ flow.getDefiningDocumentId()+SEPARATOR_CHAR+flow.getId(); Map<Object, Object> map = (Map<Object, Object>) facesContext.getAttributes().get( mapKey); if (map == null) { map = new FlowScopeMap(getBeanManager(), FlowUtils.getFlowMapKey(facesContext, flow)); facesContext.getAttributes().put(mapKey, map); } return map; } return null; }