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.InquiryView; |
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 InquiryViewTypeServiceImpl implements ViewTypeService { |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public String getViewTypeName() { |
39 | 0 | return ViewType.INQUIRY; |
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 | InquiryView inquiryView = (InquiryView) view; |
49 | |
|
50 | 0 | parameters.put(UifParameters.VIEW_NAME, inquiryView.getViewName()); |
51 | 0 | parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, inquiryView.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 | |
else { |
74 | 0 | throw new RuntimeException("Parameter '" + UifParameters.DATA_OBJECT_CLASS_NAME |
75 | |
+ "' must be given to find views of type: " + getViewTypeName()); |
76 | |
} |
77 | |
|
78 | 0 | return parameters; |
79 | |
} |
80 | |
|
81 | |
} |