1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krms.impl.repository; |
17 | |
|
18 | |
import org.apache.cxf.common.util.StringUtils; |
19 | |
import org.kuali.rice.core.api.util.ConcreteKeyValue; |
20 | |
import org.kuali.rice.core.api.util.KeyValue; |
21 | |
import org.kuali.rice.krad.keyvalues.KeyValuesBase; |
22 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
23 | |
import org.kuali.rice.krad.service.KeyValuesService; |
24 | |
import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase; |
25 | |
import org.kuali.rice.krad.uif.view.ViewModel; |
26 | |
import org.kuali.rice.krad.web.form.MaintenanceForm; |
27 | |
import org.kuali.rice.krad.web.form.UifFormBase; |
28 | |
import org.kuali.rice.krms.impl.ui.AgendaEditor; |
29 | |
|
30 | |
import java.util.ArrayList; |
31 | |
import java.util.Collection; |
32 | |
import java.util.Collections; |
33 | |
import java.util.HashMap; |
34 | |
import java.util.List; |
35 | |
import java.util.Map; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | 0 | public class ContextTypeValuesFinder extends UifKeyValuesFinderBase { |
41 | |
|
42 | |
private boolean blankOption; |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
public boolean isBlankOption() { |
48 | 0 | return this.blankOption; |
49 | |
} |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
public void setBlankOption(boolean blankOption) { |
55 | 0 | this.blankOption = blankOption; |
56 | 0 | } |
57 | |
|
58 | |
@Override |
59 | |
public List<KeyValue> getKeyValues(ViewModel model) { |
60 | 0 | List<KeyValue> keyValues = new ArrayList<KeyValue>(); |
61 | |
|
62 | 0 | if(blankOption){ |
63 | 0 | keyValues.add(new ConcreteKeyValue("", "")); |
64 | |
} |
65 | |
|
66 | |
|
67 | 0 | KeyValuesService boService = KRADServiceLocator.getKeyValuesService(); |
68 | 0 | Map<String,Object> fieldValues = new HashMap<String, Object>(); |
69 | 0 | fieldValues.put("name", "CONTEXT"); |
70 | 0 | Collection<KrmsTypeBo> types = boService.findMatching(KrmsTypeBo.class, fieldValues); |
71 | |
|
72 | 0 | for (KrmsTypeBo type : types) { |
73 | 0 | keyValues.add(new ConcreteKeyValue(type.getId(), type.getName() + " [" + type.getNamespace() + "]")); |
74 | |
} |
75 | |
|
76 | 0 | return keyValues; |
77 | |
} |
78 | |
} |