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