1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.student.enrollment.class2.appointment.keyvalue; |
18 | |
|
19 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
20 | |
import org.kuali.rice.core.api.util.ConcreteKeyValue; |
21 | |
import org.kuali.rice.core.api.util.KeyValue; |
22 | |
import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase; |
23 | |
import org.kuali.rice.krad.uif.view.ViewModel; |
24 | |
import org.kuali.student.core.enumerationmanagement.dto.EnumeratedValueInfo; |
25 | |
import org.kuali.student.core.enumerationmanagement.service.EnumerationManagementService; |
26 | |
import org.kuali.student.mock.utilities.TestHelper; |
27 | |
import org.kuali.student.r2.common.constants.CommonServiceConstants; |
28 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
29 | |
|
30 | |
import javax.xml.namespace.QName; |
31 | |
import java.io.Serializable; |
32 | |
import java.util.ArrayList; |
33 | |
import java.util.List; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | 0 | public class SlotRuleForAppWindowKeyValuesFinder extends UifKeyValuesFinderBase implements Serializable { |
41 | |
private transient EnumerationManagementService enumerationService; |
42 | |
private Object object; |
43 | |
private String enumerationKey; |
44 | |
|
45 | |
public String getEnumerationKey() { |
46 | 0 | return enumerationKey; |
47 | |
} |
48 | |
public void setEnumerationKey(String enumerationKey){ |
49 | 0 | this.enumerationKey = enumerationKey; |
50 | 0 | } |
51 | |
|
52 | |
@Override |
53 | |
|
54 | |
|
55 | |
|
56 | |
public List<KeyValue> getKeyValues(ViewModel model) { |
57 | |
|
58 | 0 | List<KeyValue> keyValues = new ArrayList<KeyValue>(); |
59 | |
|
60 | |
|
61 | 0 | ContextInfo context = TestHelper.getContext1(); |
62 | |
|
63 | |
try { |
64 | 0 | List<EnumeratedValueInfo> slotRuleTypeCodes = getEnumerationService().getEnumeratedValues(getEnumerationKey(),null,null,null); |
65 | 0 | if(slotRuleTypeCodes!=null) { |
66 | 0 | for (EnumeratedValueInfo slotRuleTypeCode : slotRuleTypeCodes) { |
67 | 0 | ConcreteKeyValue keyValue = new ConcreteKeyValue(); |
68 | 0 | keyValue.setKey(slotRuleTypeCode.getValue()); |
69 | 0 | keyValue.setValue(slotRuleTypeCode.getAbbrevValue()); |
70 | 0 | keyValues.add(keyValue); |
71 | 0 | } |
72 | |
} |
73 | 0 | } catch (Exception e) { |
74 | 0 | e.printStackTrace(); |
75 | 0 | } |
76 | |
|
77 | 0 | return keyValues; |
78 | |
} |
79 | |
|
80 | |
|
81 | |
public EnumerationManagementService getEnumerationService() { |
82 | 0 | if(enumerationService == null) { |
83 | 0 | enumerationService = GlobalResourceLoader.getService(new QName(CommonServiceConstants.REF_OBJECT_URI_GLOBAL_PREFIX+"enumerationmanagement", "EnumerationManagementService")); |
84 | |
} |
85 | 0 | return this.enumerationService; |
86 | |
} |
87 | |
} |