1    package com.instantbank.servicing.control.web;
2    
3    import java.util.HashMap;
4    
5    /**
6     *  Associated Structure to request url.
7     *
8     * @author Instant-bank (Consuelo Franky)
9     * @created September 2002
10    */
11   public class URLMapping {
12   
13     private String url;
14     private boolean useRequestHandler = false;
15     private boolean useFlowHandler = false;
16     private String flowHandler = null;
17     private String requestHandler = null;
18     private HashMap resultMappings;
19     private String screen;
20   
21   
22     /**
23      *  constructor
24      *
25      * @param url url associated to request
26      * @param screen normal output screen
27      */
28     public URLMapping(String url, String screen) {
29       this.url = url;
30       this.screen = screen;
31     }
32   
33   
34     /**
35      *  constructor
36      *
37      * @param url url associated to request
38      * @param screen normal output screen
39      * @param useRequestHandler signals if it uses request handler
40      * @param useFlowHandler signals if it uses flow handler
41      * @param requestHandler name of request handler class
42      * @param flowHandler name of flow handler class
43      * @param resultMappings hasMap of possible output screens
44      */
45     public URLMapping(String url, String screen, boolean useRequestHandler,
46                       boolean useFlowHandler, String requestHandler,
47                       String flowHandler, HashMap resultMappings) {
48       this.url = url;
49       this.flowHandler = flowHandler;
50       this.requestHandler = requestHandler;
51       this.useRequestHandler = useRequestHandler;
52       this.useFlowHandler = useFlowHandler;
53       this.resultMappings = resultMappings;
54       this.screen = screen;
55     }
56   
57   
58     // get methods :
59   
60     /**
61      *  get useFlowHandler attribute
62      *
63      * @return value of useFlowHandler attribute
64      */
65     public boolean useFlowHandler() {
66       return useFlowHandler;
67     }
68   
69   
70     /**
71      *  get useRequestHandler attribute
72      *
73      * @return value of useRequestHandler attribute
74      */
75     public boolean useRequestHandler() {
76       return useRequestHandler;
77     }
78   
79   
80     /**
81      *  Gets the requestHandler attribute of the URLMapping object
82      *
83      * @return The requestHandler value
84      */
85     public String getRequestHandler() {
86       return requestHandler;
87     }
88   
89   
90     /**
91      *  Gets the flowHandler attribute of the URLMapping object
92      *
93      * @return The flowHandler value
94      */
95     public String getFlowHandler() {
96       return flowHandler;
97     }
98   
99   
100    /**
101     *  Gets the screen attribute of the URLMapping object
102     *
103     * @return The screen value
104     */
105    public String getScreen() {
106      return screen;
107    }
108  
109  
110    /**
111     *  Gets the resultScreen attribute of the URLMapping object
112     *
113     * @param key name of parameter
114     * @return The resultScreen value
115     */
116    public String getResultScreen(String key) {
117      if(resultMappings != null) {
118        return (String)resultMappings.get(key);
119      }
120      else {
121        return null;
122      }
123    }
124  
125  
126    /**
127     *  Gets the resultMappings attribute of the URLMapping object
128     *
129     * @return The resultMappings value
130     */
131    public HashMap getResultMappings() {
132      return resultMappings;
133    }
134  
135  
136  
137    /**
138     *  textual representation of URLMapping structure
139     *
140     * @return text
141     */
142    public String toString() {
143      return "[URLMapping: url=" + url +
144        ", useRequestHandler=" + useRequestHandler +
145        ", useFlowHandler=" + useFlowHandler +
146        ", requestHandler=" + requestHandler +
147        ", flowHandler=" + flowHandler +
148        ", resultMappings=" + resultMappings +
149        "]";
150    }
151  }
152  
153