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