1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.control;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
21 import org.kuali.rice.krad.uif.view.View;
22 import org.kuali.rice.krad.uif.component.Component;
23 import org.kuali.rice.krad.uif.field.InputField;
24
25
26
27
28
29
30
31 @BeanTag(name = "kimGroupControl", parent = "Uif-KimGroupControl")
32 public class GroupControl extends TextControl {
33 private static final long serialVersionUID = 5598459655735440981L;
34
35 private String namespaceCodePropertyName;
36 private String groupIdPropertyName;
37
38 public GroupControl() {
39 super();
40 }
41
42 @Override
43 public void performApplyModel(View view, Object model, Component parent) {
44 super.performApplyModel(view, model, parent);
45
46 if (!(parent instanceof InputField)) {
47 return;
48 }
49
50 InputField field = (InputField) parent;
51
52 if (StringUtils.isNotBlank(groupIdPropertyName)) {
53 field.getAdditionalHiddenPropertyNames().add(groupIdPropertyName);
54 }
55
56 if (StringUtils.isBlank(field.getQuickfinder().getDataObjectClassName())) {
57 field.getQuickfinder().setDataObjectClassName("org.kuali.rice.kim.impl.group.GroupBo");
58 }
59
60 if (field.getQuickfinder().getFieldConversions().isEmpty()) {
61 if (StringUtils.isNotBlank(groupIdPropertyName)) {
62 field.getQuickfinder().getFieldConversions().put("id", groupIdPropertyName);
63 }
64
65 field.getQuickfinder().getFieldConversions().put("name", field.getPropertyName());
66
67 if (StringUtils.isNotBlank(namespaceCodePropertyName)) {
68 field.getQuickfinder().getFieldConversions().put("namespaceCode", namespaceCodePropertyName);
69 }
70 }
71
72 if (field.getQuickfinder().getLookupParameters().isEmpty()) {
73 if (StringUtils.isNotBlank(namespaceCodePropertyName)) {
74 field.getQuickfinder().getLookupParameters().put(namespaceCodePropertyName, "namespaceCode");
75 }
76 }
77 }
78
79
80
81
82
83
84 @BeanTagAttribute(name="namespaceCodePropertyName")
85 public String getNamespaceCodePropertyName() {
86 return namespaceCodePropertyName;
87 }
88
89
90
91
92
93
94 public void setNamespaceCodePropertyName(String namespaceCodePropertyName) {
95 this.namespaceCodePropertyName = namespaceCodePropertyName;
96 }
97
98
99
100
101
102
103 @BeanTagAttribute(name="groupIdPropertyName")
104 public String getGroupIdPropertyName() {
105 return groupIdPropertyName;
106 }
107
108
109
110
111
112
113 public void setGroupIdPropertyName(String groupIdPropertyName) {
114 this.groupIdPropertyName = groupIdPropertyName;
115 }
116 }