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