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 public InactivationBlockingDefinition() {
39 }
40
41
42
43
44
45
46 @SuppressWarnings("unchecked")
47 public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
48 if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) {
49 if (StringUtils.isBlank(blockedReferencePropertyName)) {
50
51 throw new AttributeValidationException("inactivationBlockingDetectionServiceBeanName and blockedReferencePropertyName can't both be blank in InactivationBlockingDefinition for class " +
52 rootBusinessObjectClass.getClass().getName());
53 }
54 }
55 if (getBlockedBusinessObjectClass() == null) {
56 throw new AttributeValidationException("Unable to determine blockedReferenceBusinessObjectClass in InactivationBlockingDefinition for class " +
57 rootBusinessObjectClass.getClass().getName());
58 }
59 if (!BusinessObject.class.isAssignableFrom(getBlockedBusinessObjectClass())) {
60 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 }
65
66
67
68
69
70
71 public String getBlockedReferencePropertyName() {
72 return this.blockedReferencePropertyName;
73 }
74
75 public void setBlockedReferencePropertyName(String blockedReferencePropertyName) {
76 this.blockedReferencePropertyName = blockedReferencePropertyName;
77 }
78
79
80
81
82
83
84 public Class<? extends BusinessObject> getBlockedBusinessObjectClass() {
85 return this.blockedBusinessObjectClass;
86 }
87
88 public void setBlockedBusinessObjectClass(Class<? extends BusinessObject> blockedBusinessObjectClass) {
89 this.blockedBusinessObjectClass = blockedBusinessObjectClass;
90 }
91
92
93
94
95
96
97 public String getInactivationBlockingDetectionServiceBeanName() {
98 return this.inactivationBlockingDetectionServiceBeanName;
99 }
100
101 public void setInactivationBlockingDetectionServiceBeanName(String inactivationBlockingDetectionServiceImpl) {
102 this.inactivationBlockingDetectionServiceBeanName = inactivationBlockingDetectionServiceImpl;
103 }
104
105
106
107
108
109
110 public Class<? extends BusinessObject> getBlockingReferenceBusinessObjectClass() {
111 return this.blockingReferenceBusinessObjectClass;
112 }
113
114 public void setBlockingReferenceBusinessObjectClass(Class<? extends BusinessObject> blockingReferenceBusinessObjectClass) {
115 this.blockingReferenceBusinessObjectClass = blockingReferenceBusinessObjectClass;
116 }
117
118 public String getRelationshipLabel() {
119 return this.relationshipLabel;
120 }
121
122 public void setRelationshipLabel(String relationshipLabel) {
123 this.relationshipLabel = relationshipLabel;
124 }
125
126 public Class<? extends BusinessObject> getBusinessObjectClass() {
127 return this.businessObjectClass;
128 }
129
130 public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass) {
131 this.businessObjectClass = businessObjectClass;
132 }
133
134 @Override
135 public String toString() {
136 return "InactivationBlockingDefinition: blockedClass=" + blockedBusinessObjectClass.getName()
137 + " /blockingReferenceProperty=" + blockedReferencePropertyName
138 + " /blockingClass=" + blockingReferenceBusinessObjectClass.getName();
139 }
140 }