1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.datadictionary; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.krad.bo.BusinessObject; |
20 | |
import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
public class InactivationBlockingDefinition extends DataDictionaryDefinitionBase implements InactivationBlockingMetadata { |
29 | |
private static final long serialVersionUID = -8765429636173190984L; |
30 | |
|
31 | |
protected Class<? extends BusinessObject> blockingReferenceBusinessObjectClass; |
32 | |
protected String blockedReferencePropertyName; |
33 | |
protected Class<? extends BusinessObject> blockedBusinessObjectClass; |
34 | |
protected String inactivationBlockingDetectionServiceBeanName; |
35 | |
protected String relationshipLabel; |
36 | |
protected Class<? extends BusinessObject> businessObjectClass; |
37 | |
|
38 | 0 | public InactivationBlockingDefinition() { |
39 | 0 | } |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
@SuppressWarnings("unchecked") |
47 | |
public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) { |
48 | 0 | if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) { |
49 | 0 | if (StringUtils.isBlank(blockedReferencePropertyName)) { |
50 | |
|
51 | 0 | throw new AttributeValidationException("inactivationBlockingDetectionServiceBeanName and blockedReferencePropertyName can't both be blank in InactivationBlockingDefinition for class " + |
52 | |
rootBusinessObjectClass.getClass().getName()); |
53 | |
} |
54 | |
} |
55 | 0 | if (getBlockedBusinessObjectClass() == null) { |
56 | 0 | throw new AttributeValidationException("Unable to determine blockedReferenceBusinessObjectClass in InactivationBlockingDefinition for class " + |
57 | |
rootBusinessObjectClass.getClass().getName()); |
58 | |
} |
59 | 0 | if (!BusinessObject.class.isAssignableFrom(getBlockedBusinessObjectClass())) { |
60 | 0 | throw new AttributeValidationException("InactivationBlockingDefinitions must block a reference of type BusinessObject. Class name: " + |
61 | |
rootBusinessObjectClass.getClass().getName() + " blockedReferencePropertyName " + blockedReferencePropertyName + |
62 | |
" class that should have been a BusinessObject: " + getBlockedBusinessObjectClass()); |
63 | |
} |
64 | 0 | } |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
public String getBlockedReferencePropertyName() { |
72 | 0 | return this.blockedReferencePropertyName; |
73 | |
} |
74 | |
|
75 | |
public void setBlockedReferencePropertyName(String blockedReferencePropertyName) { |
76 | 0 | this.blockedReferencePropertyName = blockedReferencePropertyName; |
77 | 0 | } |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
public Class<? extends BusinessObject> getBlockedBusinessObjectClass() { |
85 | 0 | return this.blockedBusinessObjectClass; |
86 | |
} |
87 | |
|
88 | |
public void setBlockedBusinessObjectClass(Class<? extends BusinessObject> blockedBusinessObjectClass) { |
89 | 0 | this.blockedBusinessObjectClass = blockedBusinessObjectClass; |
90 | 0 | } |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
public String getInactivationBlockingDetectionServiceBeanName() { |
98 | 0 | return this.inactivationBlockingDetectionServiceBeanName; |
99 | |
} |
100 | |
|
101 | |
public void setInactivationBlockingDetectionServiceBeanName(String inactivationBlockingDetectionServiceImpl) { |
102 | 0 | this.inactivationBlockingDetectionServiceBeanName = inactivationBlockingDetectionServiceImpl; |
103 | 0 | } |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
public Class<? extends BusinessObject> getBlockingReferenceBusinessObjectClass() { |
111 | 0 | return this.blockingReferenceBusinessObjectClass; |
112 | |
} |
113 | |
|
114 | |
public void setBlockingReferenceBusinessObjectClass(Class<? extends BusinessObject> blockingReferenceBusinessObjectClass) { |
115 | 0 | this.blockingReferenceBusinessObjectClass = blockingReferenceBusinessObjectClass; |
116 | 0 | } |
117 | |
|
118 | |
public String getRelationshipLabel() { |
119 | 0 | return this.relationshipLabel; |
120 | |
} |
121 | |
|
122 | |
public void setRelationshipLabel(String relationshipLabel) { |
123 | 0 | this.relationshipLabel = relationshipLabel; |
124 | 0 | } |
125 | |
|
126 | |
public Class<? extends BusinessObject> getBusinessObjectClass() { |
127 | 0 | return this.businessObjectClass; |
128 | |
} |
129 | |
|
130 | |
public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass) { |
131 | 0 | this.businessObjectClass = businessObjectClass; |
132 | 0 | } |
133 | |
|
134 | |
@Override |
135 | |
public String toString() { |
136 | 0 | return "InactivationBlockingDefinition: blockedClass=" + blockedBusinessObjectClass.getName() |
137 | |
+ " /blockingReferenceProperty=" + blockedReferencePropertyName |
138 | |
+ " /blockingClass=" + blockingReferenceBusinessObjectClass.getName(); |
139 | |
} |
140 | |
} |