1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.uif.service.impl; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import org.kuali.rice.krad.uif.UifConstants; |
22 | |
import org.kuali.rice.krad.uif.UifConstants.ViewType; |
23 | |
import org.kuali.rice.krad.uif.UifParameters; |
24 | |
import org.kuali.rice.krad.uif.util.ViewModelUtils; |
25 | |
import org.kuali.rice.krad.uif.service.ViewTypeService; |
26 | |
import org.springframework.beans.PropertyValues; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public class InquiryViewTypeServiceImpl implements ViewTypeService { |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public ViewType getViewTypeName() { |
39 | 0 | return ViewType.INQUIRY; |
40 | |
} |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
public Map<String, String> getParametersFromViewConfiguration(PropertyValues propertyValues) { |
46 | 0 | Map<String, String> parameters = new HashMap<String, String>(); |
47 | |
|
48 | 0 | String viewName = ViewModelUtils.getStringValFromPVs(propertyValues, UifParameters.VIEW_NAME); |
49 | 0 | String dataObjectClassName = ViewModelUtils.getStringValFromPVs(propertyValues, |
50 | |
UifParameters.DATA_OBJECT_CLASS_NAME); |
51 | |
|
52 | 0 | parameters.put(UifParameters.VIEW_NAME, viewName); |
53 | 0 | parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, dataObjectClassName); |
54 | |
|
55 | 0 | return parameters; |
56 | |
} |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
public Map<String, String> getParametersFromRequest(Map<String, String> requestParameters) { |
62 | 0 | Map<String, String> parameters = new HashMap<String, String>(); |
63 | |
|
64 | 0 | if (requestParameters.containsKey(UifParameters.VIEW_NAME)) { |
65 | 0 | parameters.put(UifParameters.VIEW_NAME, requestParameters.get(UifParameters.VIEW_NAME)); |
66 | |
} |
67 | |
else { |
68 | 0 | parameters.put(UifParameters.VIEW_NAME, UifConstants.DEFAULT_VIEW_NAME); |
69 | |
} |
70 | |
|
71 | 0 | if (requestParameters.containsKey(UifParameters.DATA_OBJECT_CLASS_NAME)) { |
72 | 0 | parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, |
73 | |
requestParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME)); |
74 | |
} |
75 | |
else { |
76 | 0 | throw new RuntimeException("Parameter '" + UifParameters.DATA_OBJECT_CLASS_NAME |
77 | |
+ "' must be given to find views of type: " + getViewTypeName()); |
78 | |
} |
79 | |
|
80 | 0 | return parameters; |
81 | |
} |
82 | |
|
83 | |
} |