1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.kim.type; |
17 | |
|
18 | |
import org.apache.commons.lang.ClassUtils; |
19 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
20 | |
import org.kuali.rice.core.api.util.ClassLoaderUtils; |
21 | |
import org.kuali.rice.krad.bo.BusinessObject; |
22 | |
import org.kuali.rice.krad.datadictionary.AttributeDefinition; |
23 | |
import org.kuali.rice.krad.datadictionary.exception.ClassValidationException; |
24 | |
|
25 | |
import java.util.Map; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
@Deprecated |
32 | 0 | final class KimAttributeDefinition extends AttributeDefinition { |
33 | |
private static final long serialVersionUID = 7006569761728813805L; |
34 | |
|
35 | |
protected Map<String, String> lookupInputPropertyConversions; |
36 | |
protected Map<String, String> lookupReturnPropertyConversions; |
37 | |
protected String lookupBoClass; |
38 | |
protected String sortCode; |
39 | |
protected String kimAttrDefnId; |
40 | |
protected String kimTypeId; |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
public String getSortCode() { |
46 | 0 | return this.sortCode; |
47 | |
} |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
public void setSortCode(String sortCode) { |
54 | 0 | this.sortCode = sortCode; |
55 | 0 | } |
56 | |
|
57 | |
public String getKimAttrDefnId() { |
58 | 0 | return this.kimAttrDefnId; |
59 | |
} |
60 | |
|
61 | |
public void setKimAttrDefnId(String kimAttrDefnId) { |
62 | 0 | this.kimAttrDefnId = kimAttrDefnId; |
63 | 0 | } |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
public String getKimTypeId() { |
69 | 0 | return this.kimTypeId; |
70 | |
} |
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
public void setKimTypeId(String kimTypeId) { |
76 | 0 | this.kimTypeId = kimTypeId; |
77 | 0 | } |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
public Map<String, String> getLookupInputPropertyConversions() { |
84 | 0 | return this.lookupInputPropertyConversions; |
85 | |
} |
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
public void setLookupInputPropertyConversions(Map<String, String> lookupInputPropertyConversions) { |
92 | 0 | this.lookupInputPropertyConversions = lookupInputPropertyConversions; |
93 | 0 | } |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
public Map<String, String> getLookupReturnPropertyConversions() { |
99 | 0 | return this.lookupReturnPropertyConversions; |
100 | |
} |
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
public void setLookupReturnPropertyConversions(Map<String, String> lookupReturnPropertyConversions) { |
107 | 0 | this.lookupReturnPropertyConversions = lookupReturnPropertyConversions; |
108 | 0 | } |
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
public String toString() { |
114 | 0 | return new ToStringBuilder( this ) |
115 | |
.append( "name", getName() ) |
116 | |
.append( "label", getLabel() ) |
117 | |
.append( "lookupBoClass", this.lookupBoClass ) |
118 | |
.append( "required", isRequired() ) |
119 | |
.append( "lookupInputPropertyConversions", this.lookupInputPropertyConversions ) |
120 | |
.append( "lookupReturnPropertyConversions", this.lookupReturnPropertyConversions ) |
121 | |
.toString(); |
122 | |
} |
123 | |
|
124 | |
public String getLookupBoClass() { |
125 | 0 | return this.lookupBoClass; |
126 | |
} |
127 | |
|
128 | |
public void setLookupBoClass(String lookupBoClass) { |
129 | 0 | this.lookupBoClass = lookupBoClass; |
130 | 0 | } |
131 | |
|
132 | |
public boolean isHasLookupBoDefinition() { |
133 | 0 | return true; |
134 | |
} |
135 | |
|
136 | |
|
137 | |
@SuppressWarnings("unchecked") |
138 | |
@Override |
139 | |
public void completeValidation(Class rootObjectClass, Class otherObjectClass) { |
140 | 0 | if (lookupBoClass != null) { |
141 | |
try { |
142 | 0 | Class lookupBoClassObject = ClassUtils.getClass(ClassLoaderUtils.getDefaultClassLoader(), getLookupBoClass()); |
143 | 0 | if (!BusinessObject.class.isAssignableFrom(lookupBoClassObject)) { |
144 | 0 | throw new ClassValidationException("lookupBoClass is not a valid instance of " + BusinessObject.class.getName() + " instead was: " + lookupBoClassObject.getName()); |
145 | |
} |
146 | 0 | } catch (ClassNotFoundException e) { |
147 | 0 | throw new ClassValidationException("lookupBoClass could not be found: " + getLookupBoClass(), e); |
148 | 0 | } |
149 | |
} |
150 | 0 | super.completeValidation(rootObjectClass, otherObjectClass); |
151 | 0 | } |
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
} |