1 | /* |
---|
2 | * To change this template, choose Tools | Templates |
---|
3 | * and open the template in the editor. |
---|
4 | */ |
---|
5 | package eu.clarin.cmdi.vlo; |
---|
6 | |
---|
7 | import java.util.Iterator; |
---|
8 | import java.util.Map; |
---|
9 | import java.util.Set; |
---|
10 | import org.apache.wicket.Session; |
---|
11 | import org.apache.wicket.request.mapper.parameter.PageParameters; |
---|
12 | |
---|
13 | /** |
---|
14 | * VLO web page parameters |
---|
15 | * |
---|
16 | * @author keeloo |
---|
17 | */ |
---|
18 | public class VloPageParameters extends PageParameters { |
---|
19 | |
---|
20 | public VloPageParameters (){ |
---|
21 | // needs to be here because of the other constructor |
---|
22 | super (); |
---|
23 | // add the theme parameter |
---|
24 | // ... |
---|
25 | } |
---|
26 | |
---|
27 | public VloPageParameters (PageParameters parameters){ |
---|
28 | // store the parameters as VloPageParameters |
---|
29 | } |
---|
30 | |
---|
31 | public org.apache.wicket.PageParameters convert (){ |
---|
32 | |
---|
33 | org.apache.wicket.PageParameters param; |
---|
34 | |
---|
35 | // needs to be implemented |
---|
36 | |
---|
37 | // present the page parameters in the old style |
---|
38 | |
---|
39 | param = null; |
---|
40 | |
---|
41 | return param; |
---|
42 | } |
---|
43 | |
---|
44 | /** |
---|
45 | * Take in old style parameters. |
---|
46 | * |
---|
47 | * |
---|
48 | * not being used at the moment; use code in the previous method |
---|
49 | * |
---|
50 | * @param param |
---|
51 | * @return |
---|
52 | */ |
---|
53 | public VloPageParameters convert (org.apache.wicket.PageParameters param){ |
---|
54 | |
---|
55 | // move page parameters in array of objects |
---|
56 | Set <Map.Entry<String,Object>> entries; |
---|
57 | entries = param.entrySet(); |
---|
58 | |
---|
59 | // iterate over the set, and put entries in new page parameters |
---|
60 | VloPageParameters VloPageParameters; |
---|
61 | VloPageParameters = new VloPageParameters (); |
---|
62 | for (Iterator<Map.Entry<String, Object>> it = entries.iterator(); it.hasNext();) { |
---|
63 | Map.Entry<String, Object> entry = it.next(); |
---|
64 | VloPageParameters.add(entry.getKey(), entry.getValue()); |
---|
65 | } |
---|
66 | |
---|
67 | return VloPageParameters; |
---|
68 | } |
---|
69 | |
---|
70 | /** |
---|
71 | * |
---|
72 | * @param PersistentParameters parameters concerning theme and other |
---|
73 | * non query related parameters. These parameters are to kept in the URL |
---|
74 | * during the session. |
---|
75 | */ |
---|
76 | public void merge(PageParameters parameters) { |
---|
77 | |
---|
78 | // get a themed session from the current thread |
---|
79 | VloSession themedSession; |
---|
80 | themedSession = (VloSession)Session.get(); |
---|
81 | |
---|
82 | // get the parameters associated with the session |
---|
83 | PageParameters persistentParameters; |
---|
84 | persistentParameters = themedSession.getVloSessionPageParameters(); |
---|
85 | |
---|
86 | // merge the parameters with the persistent ones and return the result |
---|
87 | |
---|
88 | // ... |
---|
89 | |
---|
90 | } |
---|
91 | } |
---|