1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.inquiry; |
17 | |
|
18 | |
import java.util.List; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import org.kuali.rice.kns.bo.BusinessObject; |
22 | |
import org.kuali.rice.kns.bo.ParameterDetailType; |
23 | |
import org.kuali.rice.kns.datadictionary.DataDictionaryException; |
24 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public class ParameterDetailTypeInquirableImpl extends KualiInquirableImpl { |
34 | |
|
35 | |
private static final String PARAMETER_DETAIL_TYPE_CODE = "parameterDetailTypeCode"; |
36 | |
private static final String PARAMETER_NAMESPACE_CODE = "parameterNamespaceCode"; |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
@Override |
44 | |
public BusinessObject getBusinessObject(Map fieldValues) { |
45 | 0 | BusinessObject result = super.getBusinessObject(fieldValues); |
46 | |
|
47 | 0 | if (result == null) { |
48 | |
|
49 | 0 | String parameterDetailTypeCode = (String)fieldValues.get(PARAMETER_DETAIL_TYPE_CODE); |
50 | 0 | String parameterNamespaceCode = (String)fieldValues.get(PARAMETER_NAMESPACE_CODE); |
51 | |
|
52 | 0 | if (parameterDetailTypeCode == null) throw new RuntimeException(PARAMETER_DETAIL_TYPE_CODE + |
53 | |
" is a required key for this inquiry"); |
54 | 0 | if (parameterNamespaceCode == null) throw new RuntimeException(PARAMETER_NAMESPACE_CODE + |
55 | |
" is a required key for this inquiry"); |
56 | |
|
57 | |
List<ParameterDetailType> components; |
58 | |
try { |
59 | 0 | components = KNSServiceLocator.getParameterServerService().getNonDatabaseComponents(); |
60 | 0 | } catch (DataDictionaryException ex) { |
61 | 0 | throw new RuntimeException( |
62 | |
"Problem parsing data dictionary during full load required for inquiry to function: " + |
63 | |
ex.getMessage(), ex); |
64 | 0 | } |
65 | |
|
66 | 0 | for (ParameterDetailType pdt : components) { |
67 | 0 | if (parameterDetailTypeCode.equals(pdt.getParameterDetailTypeCode()) && |
68 | |
parameterNamespaceCode.equals(pdt.getParameterNamespaceCode())) { |
69 | 0 | result = pdt; |
70 | 0 | break; |
71 | |
} |
72 | |
} |
73 | |
} |
74 | |
|
75 | 0 | return result; |
76 | |
} |
77 | |
|
78 | |
} |