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.uif.view.View;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.field.InputField;
22
23
24
25
26
27
28
29 public class GroupControl extends TextControl {
30 private static final long serialVersionUID = 5598459655735440981L;
31
32 private String namespaceCodePropertyName;
33 private String groupIdPropertyName;
34
35 public GroupControl() {
36 super();
37 }
38
39 @Override
40 public void performApplyModel(View view, Object model, Component parent) {
41 super.performApplyModel(view, model, parent);
42
43 if (!(parent instanceof InputField)) {
44 return;
45 }
46
47 InputField field = (InputField) parent;
48
49 if (StringUtils.isNotBlank(groupIdPropertyName)) {
50 field.getHiddenPropertyNames().add(groupIdPropertyName);
51 }
52
53 if (StringUtils.isBlank(field.getFieldLookup().getDataObjectClassName())) {
54 field.getFieldLookup().setDataObjectClassName("org.kuali.rice.kim.impl.group.GroupBo");
55 }
56
57 if (field.getFieldLookup().getFieldConversions().isEmpty()) {
58 if (StringUtils.isNotBlank(groupIdPropertyName)) {
59 field.getFieldLookup().getFieldConversions().put("id", groupIdPropertyName);
60 }
61
62 field.getFieldLookup().getFieldConversions().put("name", field.getPropertyName());
63
64 if (StringUtils.isNotBlank(namespaceCodePropertyName)) {
65 field.getFieldLookup().getFieldConversions().put("namespaceCode", namespaceCodePropertyName);
66 }
67 }
68
69 if (field.getFieldLookup().getLookupParameters().isEmpty()) {
70 if (StringUtils.isNotBlank(namespaceCodePropertyName)) {
71 field.getFieldLookup().getLookupParameters().put(namespaceCodePropertyName, "namespaceCode");
72 }
73 }
74 }
75
76
77
78
79
80
81 public String getNamespaceCodePropertyName() {
82 return namespaceCodePropertyName;
83 }
84
85
86
87
88
89
90 public void setNamespaceCodePropertyName(String namespaceCodePropertyName) {
91 this.namespaceCodePropertyName = namespaceCodePropertyName;
92 }
93
94
95
96
97
98
99 public String getGroupIdPropertyName() {
100 return groupIdPropertyName;
101 }
102
103
104
105
106
107
108 public void setGroupIdPropertyName(String groupIdPropertyName) {
109 this.groupIdPropertyName = groupIdPropertyName;
110 }
111 }