Show
Ignore:
Timestamp:
09/04/10 22:05:44 (21 months ago)
Author:
ffray
Message:

Added navigateTo-elements to auth-constraints allowing to create
conditional navigation-cases.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-0.13.x/pfixcore/src/de/schlund/pfixcore/auth/AuthConstraintImpl.java

    r3553 r5341  
    1818package de.schlund.pfixcore.auth; 
    1919 
     20import java.util.LinkedList; 
     21import java.util.List; 
     22 
     23import de.schlund.pfixcore.auth.conditions.NavigationCase; 
    2024import de.schlund.pfixcore.workflow.Context; 
    2125 
     
    2832 
    2933    private Condition condition; 
    30     private String authPage; 
     34    private String defaultAuthPage; 
    3135    private String id; 
     36 
     37    private List<NavigationCase> navigation = new LinkedList<NavigationCase>(); 
    3238 
    3339    public AuthConstraintImpl(String id) { 
    3440        this.id = id; 
     41    } 
     42     
     43    public void addNavigationCase(NavigationCase navigationCase) { 
     44        navigation.add(navigationCase); 
     45    } 
     46 
     47    public List<NavigationCase> getNavigation() { 
     48        return navigation; 
    3549    } 
    3650 
     
    4761    } 
    4862 
    49     public void setAuthPage(String authPage) { 
    50         this.authPage = authPage; 
     63    public String getDefaultAuthPage() { 
     64        return defaultAuthPage; 
    5165    } 
    5266 
    53     public String getAuthPage() { 
    54         return authPage; 
     67    public void setDefaultAuthPage(String authPage) { 
     68        this.defaultAuthPage = authPage; 
     69    } 
     70 
     71    public String getAuthPage(Context context) { 
     72        for (NavigationCase navcase : navigation) { 
     73            if (navcase.evaluate(context)) { 
     74                return navcase.getPage(); 
     75            } 
     76        } 
     77        return defaultAuthPage; 
    5578    } 
    5679 
     
    7295        sb.append("{"); 
    7396        sb.append("id=" + id); 
    74         sb.append(",authpage=" + authPage); 
     97        sb.append(",authpage=" + defaultAuthPage); 
    7598        sb.append("}"); 
    7699        sb.append("[");