@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; }
@Override public FlowCallNode getFlowCall(Flow targetFlow) { FacesContext facesContext = null; for (Map.Entry<String, FlowCallNode> entry : _flowCallsMap.entrySet()) { if (facesContext == null) { facesContext = FacesContext.getCurrentInstance(); } String calledDocumentId = entry.getValue().getCalledFlowDocumentId(facesContext); String calledFlowId = entry.getValue().getCalledFlowId(facesContext); if (targetFlow.getDefiningDocumentId().equals(calledDocumentId) && targetFlow.getId().equals(calledFlowId) ) { return entry.getValue(); } } return null; }
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 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 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; }
@Override public void doBeforeExitFlow(FacesContext facesContext, Flow flow) { String flowMapKey = FlowUtils.getFlowMapKey(facesContext, flow); String fullToken = FLOW_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + flowMapKey; 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.clear(); } else { map = (Map<Object, Object>) facesContext.getExternalContext(). getSessionMap().get(fullToken); if (map != null) { map.clear(); } } // Remove the map from session facesContext.getExternalContext().getSessionMap().remove(fullToken); // Reset current flow scope map facesContext.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; }
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 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 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); Map<Object, Object> map = null; if (flow != null) { String mapKey = CURRENT_FLOW_SCOPE_MAP+SEPARATOR_CHAR+ flow.getDefiningDocumentId()+SEPARATOR_CHAR+flow.getId(); map = (Map<Object, Object>) facesContext.getAttributes().get(mapKey); if (map == null) { String flowMapKey = FlowUtils.getFlowMapKey(facesContext, flow); //String fullToken = FLOW_SESSION_MAP_SUBKEY_PREFIX + SEPARATOR_CHAR + flowMapKey; //map = createOrRestoreMap(facesContext, fullToken); map = new FlowScopeMap(this, flowMapKey); facesContext.getAttributes().put(mapKey, map); } } return map; }
@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; }