1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.util; |
20 | |
|
21 | |
import java.util.Collection; |
22 | |
import java.util.HashSet; |
23 | |
import java.util.Set; |
24 | |
import org.apache.myfaces.config.element.NavigationRule; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | public final class NavigationUtils |
31 | |
{ |
32 | |
public static Set<javax.faces.application.NavigationCase> convertNavigationCasesToAPI(NavigationRule rule) |
33 | |
{ |
34 | 0 | Collection<? extends org.apache.myfaces.config.element.NavigationCase> configCases = |
35 | |
rule.getNavigationCases(); |
36 | 0 | Set<javax.faces.application.NavigationCase> apiCases = |
37 | |
new HashSet<javax.faces.application.NavigationCase>(configCases.size()); |
38 | |
|
39 | 0 | for(org.apache.myfaces.config.element.NavigationCase configCase : configCases) |
40 | |
{ |
41 | 0 | if(configCase.getRedirect() != null) |
42 | |
{ |
43 | 0 | String includeViewParamsAttribute = configCase.getRedirect().getIncludeViewParams(); |
44 | 0 | boolean includeViewParams = false; |
45 | 0 | if (includeViewParamsAttribute != null) |
46 | |
{ |
47 | 0 | includeViewParams = Boolean.valueOf(includeViewParamsAttribute); |
48 | |
} |
49 | 0 | apiCases.add(new javax.faces.application.NavigationCase(rule.getFromViewId(), |
50 | |
configCase.getFromAction(), |
51 | |
configCase.getFromOutcome(),configCase.getIf(), |
52 | |
configCase.getToViewId(), |
53 | |
configCase.getRedirect().getViewParams(),true,includeViewParams)); |
54 | 0 | } |
55 | |
else |
56 | |
{ |
57 | 0 | apiCases.add(new javax.faces.application.NavigationCase(rule.getFromViewId(), |
58 | |
configCase.getFromAction(), |
59 | |
configCase.getFromOutcome(),configCase.getIf(), |
60 | |
configCase.getToViewId(),null,false,false)); |
61 | |
} |
62 | 0 | } |
63 | |
|
64 | 0 | return apiCases; |
65 | |
} |
66 | |
} |