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