1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.uif.service.impl; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import org.kuali.rice.kns.uif.UifConstants; |
22 | |
import org.kuali.rice.kns.uif.UifConstants.ViewType; |
23 | |
import org.kuali.rice.kns.uif.UifParameters; |
24 | |
import org.kuali.rice.kns.uif.container.LookupView; |
25 | |
import org.kuali.rice.kns.uif.container.View; |
26 | |
import org.kuali.rice.kns.uif.service.ViewTypeService; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public class LookupViewTypeServiceImpl implements ViewTypeService { |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public String getViewTypeName() { |
39 | 0 | return ViewType.LOOKUP; |
40 | |
} |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
public Map<String, String> getParametersFromView(View view) { |
46 | 0 | Map<String, String> parameters = new HashMap<String, String>(); |
47 | |
|
48 | 0 | LookupView lookupView = (LookupView) view; |
49 | |
|
50 | 0 | parameters.put(UifParameters.VIEW_NAME, lookupView.getViewName()); |
51 | 0 | parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, lookupView.getDataObjectClassName().getName()); |
52 | |
|
53 | 0 | return parameters; |
54 | |
} |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
public Map<String, String> getParametersFromRequest(Map<String, String> requestParameters) { |
60 | 0 | Map<String, String> parameters = new HashMap<String, String>(); |
61 | |
|
62 | 0 | if (requestParameters.containsKey(UifParameters.VIEW_NAME)) { |
63 | 0 | parameters.put(UifParameters.VIEW_NAME, requestParameters.get(UifParameters.VIEW_NAME)); |
64 | |
} |
65 | |
else { |
66 | 0 | parameters.put(UifParameters.VIEW_NAME, UifConstants.DEFAULT_VIEW_NAME); |
67 | |
} |
68 | |
|
69 | 0 | if (requestParameters.containsKey(UifParameters.DATA_OBJECT_CLASS_NAME)) { |
70 | 0 | parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, |
71 | |
requestParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME)); |
72 | |
} |
73 | |
|
74 | 0 | return parameters; |
75 | |
} |
76 | |
|
77 | |
} |