private Set<NavigationCase> convertNavigationCasesToAPI(NavigationRule rule) { Collection<? extends org.apache.myfaces.config.element.NavigationCase> configCases = rule.getNavigationCases(); Set<NavigationCase> apiCases = new HashSet<NavigationCase>(configCases.size()); for(org.apache.myfaces.config.element.NavigationCase configCase : configCases) { if(configCase.getRedirect() != null) { String includeViewParamsAttribute = configCase.getRedirect().getIncludeViewParams(); boolean includeViewParams = false; // default value is false if (includeViewParamsAttribute != null) { includeViewParams = new Boolean(includeViewParamsAttribute); } apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(),configCase.getRedirect().getViewParams(),true,includeViewParams)); } else { apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(),null,false,false)); } } return apiCases; }
private NavigationCase calcMatchingNavigationCase(List casesList, String actionRef, String outcome) { for (int i = 0, size = casesList.size(); i < size; i++) { NavigationCase caze = (NavigationCase)casesList.get(i); String cazeOutcome = caze.getFromOutcome(); String cazeActionRef = caze.getFromAction(); if ((cazeOutcome == null || cazeOutcome.equals(outcome)) && (cazeActionRef == null || cazeActionRef.equals(actionRef))) { return caze; } } return null; }
/** * Returns the view ID that would be created for the given action and outcome */ public String getViewId(FacesContext context, String fromAction, String outcome) { return this.getNavigationCase(context, fromAction, outcome).getToViewId(); }
!isEmptyString(flowSwitch.getDefaultOutcome().getFromOutcome())) if (ELText.isLiteral(flowSwitch.getDefaultOutcome().getFromOutcome())) node.setDefaultOutcome(flowSwitch.getDefaultOutcome().getFromOutcome()); facesContext.getELContext(), flowSwitch.getDefaultOutcome().getFromOutcome(), Object.class)); nodeCase.setFromOutcome(navCase.getFromOutcome()); if (!isEmptyString(navCase.getIf())) facesContext.getELContext(), navCase.getIf(), Object.class)); !isEmptyString(flowReturn.getNavigationCase().getFromOutcome())) if (ELText.isLiteral(flowReturn.getNavigationCase().getFromOutcome())) node.setFromOutcome(flowReturn.getNavigationCase().getFromOutcome()); facesContext.getELContext(), flowReturn.getNavigationCase().getFromOutcome(), Object.class));
" toViewId =" + navigationCase.getToViewId() + " redirect=" + navigationCase.isRedirect()); if (navigationCase.isRedirect() && (!PortletUtil.isPortletRequest(facesContext))) String redirectPath = viewHandler.getActionURL(facesContext, navigationCase.getToViewId()); String newViewId = navigationCase.getToViewId(); UIViewRoot viewRoot = viewHandler.createView(facesContext, newViewId); facesContext.setViewRoot(viewRoot);
private static void validateNavRule(NavigationRule navRule, List<String> list, String ctxPath){ String fromId = navRule.getFromViewId(); String filePath = ctxPath + fromId; if(fromId != null && ! "*".equals(fromId) && ! new File(filePath).exists()) { list.add("File for navigation 'from id' does not exist " + filePath); } for (NavigationCase caze : navRule.getNavigationCases()) { String toViewPath = ctxPath + caze.getToViewId(); if(!new File(toViewPath).exists()) { list.add("File for navigation 'to id' does not exist " + toViewPath); } } }
private Set<NavigationCase> convertNavigationCasesToAPI(NavigationRule rule) { Collection<? extends org.apache.myfaces.config.element.NavigationCase> configCases = rule.getNavigationCases(); Set<NavigationCase> apiCases = new HashSet<NavigationCase>(configCases.size()); for(org.apache.myfaces.config.element.NavigationCase configCase : configCases) { if(configCase.getRedirect() != null) { String includeViewParamsAttribute = configCase.getRedirect().getIncludeViewParams(); boolean includeViewParams = false; // default value is false if (includeViewParamsAttribute != null) { includeViewParams = new Boolean(includeViewParamsAttribute); } apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(),configCase.getRedirect().getViewParams(),true,includeViewParams)); } else { apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(),null,false,false)); } } return apiCases; }
private static void validateNavRule(NavigationRule navRule, List<String> list, String ctxPath){ String fromId = navRule.getFromViewId(); String filePath = ctxPath + fromId; if(fromId != null && ! "*".equals(fromId) && ! new File(filePath).exists()) list.add("File for navigation 'from id' does not exist " + filePath); Collection cases = navRule.getNavigationCases(); Iterator iterator = cases.iterator(); while(iterator.hasNext()){ NavigationCase caze = (NavigationCase) iterator.next(); String toViewPath = ctxPath + caze.getToViewId(); if(! new File(toViewPath).exists()) list.add("File for navigation 'to id' does not exist " + toViewPath); } }
if(configCase.getRedirect() != null) String includeViewParamsAttribute = configCase.getRedirect().getIncludeViewParams(); boolean includeViewParams = false; // default value is false if (includeViewParamsAttribute != null) configCase.getFromAction(), configCase.getFromOutcome(),configCase.getIf(), configCase.getToViewId(), configCase.getRedirect().getViewParams(),true,includeViewParams)); configCase.getFromAction(), configCase.getFromOutcome(),configCase.getIf(), configCase.getToViewId(),null,false,false));
private static void validateNavRule(NavigationRule navRule, List<String> list, String ctxPath){ String fromId = navRule.getFromViewId(); String filePath = ctxPath + fromId; if(fromId != null && ! "*".equals(fromId) && ! new File(filePath).exists()) { list.add("File for navigation 'from id' does not exist " + filePath); } for (NavigationCase caze : navRule.getNavigationCases()) { String toViewPath = ctxPath + caze.getToViewId(); if(!new File(toViewPath).exists()) { list.add("File for navigation 'to id' does not exist " + toViewPath); } } }
private Set<NavigationCase> convertNavigationCasesToAPI(NavigationRule rule) { Collection<? extends org.apache.myfaces.config.element.NavigationCase> configCases = rule.getNavigationCases(); Set<NavigationCase> apiCases = new HashSet<NavigationCase>(configCases.size()); for(org.apache.myfaces.config.element.NavigationCase configCase : configCases) { if(configCase.getRedirect() != null) { String includeViewParamsAttribute = configCase.getRedirect().getIncludeViewParams(); boolean includeViewParams = false; // default value is false if (includeViewParamsAttribute != null) { includeViewParams = Boolean.valueOf(includeViewParamsAttribute); } apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(), configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(), configCase.getRedirect().getViewParams(),true,includeViewParams)); } else { apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(), configCase.getFromOutcome(),configCase.getIf(), configCase.getToViewId(),null,false,false)); } } return apiCases; }
URL toViewPath = ctx.getResource(caze.getToViewId()); list.add("File for navigation 'from id' does not exist " + caze.getToViewId());