| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.kuali.rice.kns.datadictionary; |
| 17 |
|
|
| 18 |
|
import java.util.ArrayList; |
| 19 |
|
import java.util.HashMap; |
| 20 |
|
import java.util.List; |
| 21 |
|
import java.util.Map; |
| 22 |
|
|
| 23 |
|
import org.apache.commons.lang.StringUtils; |
| 24 |
|
import org.kuali.rice.kns.bo.BusinessObject; |
| 25 |
|
import org.kuali.rice.kns.datadictionary.exception.AttributeValidationException; |
| 26 |
|
import org.kuali.rice.kns.datadictionary.exception.DuplicateEntryException; |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
|
|
|
| 0% |
Uncovered Elements: 123 (123) |
Complexity: 41 |
Complexity Density: 0.59 |
|
| 53 |
|
public class MaintainableCollectionDefinition extends MaintainableItemDefinition implements CollectionDefinitionI{ |
| 54 |
|
private static final long serialVersionUID = -5617868782623587053L; |
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
protected Class<? extends BusinessObject> businessObjectClass; |
| 60 |
|
|
| 61 |
|
protected Class<? extends BusinessObject> sourceClassName; |
| 62 |
|
protected String summaryTitle; |
| 63 |
|
protected String attributeToHighlightOnDuplicateKey; |
| 64 |
|
|
| 65 |
|
protected boolean includeAddLine = true; |
| 66 |
|
protected boolean includeMultipleLookupLine = true; |
| 67 |
|
private boolean alwaysAllowCollectionDeletion = false; |
| 68 |
|
|
| 69 |
|
protected Map<String,MaintainableFieldDefinition> maintainableFieldMap = new HashMap<String, MaintainableFieldDefinition>(); |
| 70 |
|
protected Map<String,MaintainableCollectionDefinition> maintainableCollectionMap = new HashMap<String, MaintainableCollectionDefinition>(); |
| 71 |
|
protected Map<String,MaintainableFieldDefinition> summaryFieldMap = new HashMap<String, MaintainableFieldDefinition>(); |
| 72 |
|
protected Map<String,MaintainableFieldDefinition> duplicateIdentificationFieldMap = new HashMap<String, MaintainableFieldDefinition>(); |
| 73 |
|
protected List<MaintainableFieldDefinition> maintainableFields = new ArrayList<MaintainableFieldDefinition>(); |
| 74 |
|
protected List<MaintainableCollectionDefinition> maintainableCollections = new ArrayList<MaintainableCollectionDefinition>(); |
| 75 |
|
protected List<MaintainableFieldDefinition> summaryFields = new ArrayList<MaintainableFieldDefinition>(); |
| 76 |
|
protected List<MaintainableFieldDefinition> duplicateIdentificationFields = new ArrayList<MaintainableFieldDefinition>(); |
| 77 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 78 |
0
|
public MaintainableCollectionDefinition() {}... |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
@return |
| 84 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 85 |
0
|
public Class<? extends BusinessObject> getBusinessObjectClass() {... |
| 86 |
0
|
return businessObjectClass; |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 92 |
0
|
public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass) {... |
| 93 |
0
|
if (businessObjectClass == null) { |
| 94 |
0
|
throw new IllegalArgumentException("invalid (null) businessObjectClass"); |
| 95 |
|
} |
| 96 |
|
|
| 97 |
0
|
this.businessObjectClass = businessObjectClass; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
@return |
| 102 |
|
|
| 103 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 104 |
0
|
public List<MaintainableFieldDefinition> getMaintainableFields() {... |
| 105 |
0
|
return maintainableFields; |
| 106 |
|
} |
| 107 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 108 |
0
|
public List<? extends FieldDefinitionI> getFields() {... |
| 109 |
0
|
return maintainableFields; |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
| 114 |
|
|
| 115 |
|
@see |
| 116 |
|
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
| 117 |
0
|
public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {... |
| 118 |
0
|
if (!DataDictionary.isCollectionPropertyOf(rootBusinessObjectClass, getName())) { |
| 119 |
0
|
throw new AttributeValidationException("unable to find collection named '" + getName() + "' in rootBusinessObjectClass '" + rootBusinessObjectClass.getName() + "' (" + "" + ")"); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
0
|
if (dissallowDuplicateKey()) { |
| 123 |
0
|
if (!DataDictionary.isPropertyOf(businessObjectClass, attributeToHighlightOnDuplicateKey)) { |
| 124 |
0
|
throw new AttributeValidationException("unable to find attribute named '" + attributeToHighlightOnDuplicateKey + "'in businessObjectClass '" + businessObjectClass.getName() + "' of collection '" + getName() + "' in rootBusinessObjectClass '" + rootBusinessObjectClass.getName() + "' (" + "" + ")"); |
| 125 |
|
} |
| 126 |
|
} |
| 127 |
|
|
| 128 |
0
|
for (MaintainableFieldDefinition maintainableField : maintainableFields ) { |
| 129 |
0
|
maintainableField.completeValidation(businessObjectClass, null); |
| 130 |
|
} |
| 131 |
|
|
| 132 |
0
|
for (MaintainableCollectionDefinition maintainableCollection : maintainableCollections ) { |
| 133 |
0
|
maintainableCollection.completeValidation(businessObjectClass, null); |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
@see |
| 148 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 149 |
0
|
public String toString() {... |
| 150 |
0
|
return "MaintainableCollectionDefinition for " + getName(); |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 154 |
0
|
public Class<? extends BusinessObject> getSourceClassName() {... |
| 155 |
0
|
return sourceClassName; |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
|
| 159 |
|
|
| 160 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 161 |
0
|
public void setSourceClassName(Class<? extends BusinessObject> sourceClass) {... |
| 162 |
0
|
this.sourceClassName = sourceClass; |
| 163 |
|
} |
| 164 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 165 |
0
|
public boolean getIncludeAddLine() {... |
| 166 |
0
|
return includeAddLine; |
| 167 |
|
} |
| 168 |
|
|
| 169 |
|
|
| 170 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 171 |
0
|
public void setIncludeAddLine(boolean includeAddLine) {... |
| 172 |
0
|
this.includeAddLine = includeAddLine; |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
|
| 176 |
|
@return |
| 177 |
|
|
| 178 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 179 |
0
|
public List<MaintainableCollectionDefinition> getMaintainableCollections() {... |
| 180 |
0
|
return maintainableCollections; |
| 181 |
|
} |
| 182 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 183 |
0
|
public List<? extends CollectionDefinitionI> getCollections() {... |
| 184 |
0
|
return maintainableCollections; |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
|
| 188 |
|
|
| 189 |
|
@return |
| 190 |
|
|
| 191 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 192 |
0
|
public List<? extends FieldDefinitionI> getSummaryFields() {... |
| 193 |
0
|
return summaryFields; |
| 194 |
|
} |
| 195 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 196 |
0
|
public boolean hasSummaryField(String key) {... |
| 197 |
0
|
return summaryFieldMap.containsKey(key); |
| 198 |
|
} |
| 199 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 200 |
0
|
public boolean isIncludeMultipleLookupLine() {... |
| 201 |
0
|
return includeMultipleLookupLine; |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 205 |
0
|
public void setIncludeMultipleLookupLine(boolean includeMultipleLookupLine) {... |
| 206 |
0
|
this.includeMultipleLookupLine = includeMultipleLookupLine; |
| 207 |
|
} |
| 208 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 209 |
0
|
public String getSummaryTitle() {... |
| 210 |
0
|
return summaryTitle; |
| 211 |
|
} |
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 216 |
0
|
public void setSummaryTitle(String overrideSummaryName) {... |
| 217 |
0
|
this.summaryTitle = overrideSummaryName; |
| 218 |
|
} |
| 219 |
|
|
| 220 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 221 |
0
|
public String getAttributeToHighlightOnDuplicateKey() {... |
| 222 |
0
|
return attributeToHighlightOnDuplicateKey; |
| 223 |
|
} |
| 224 |
|
|
| 225 |
|
|
| 226 |
|
|
| 227 |
|
|
| 228 |
|
|
| 229 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 230 |
0
|
public void setAttributeToHighlightOnDuplicateKey(String attributeToHighlightOnDuplicate) {... |
| 231 |
0
|
this.attributeToHighlightOnDuplicateKey = attributeToHighlightOnDuplicate; |
| 232 |
|
} |
| 233 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 234 |
0
|
public boolean dissallowDuplicateKey() {... |
| 235 |
0
|
return StringUtils.isNotBlank(getAttributeToHighlightOnDuplicateKey()); |
| 236 |
|
} |
| 237 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 238 |
0
|
public List<MaintainableFieldDefinition> getDuplicateIdentificationFields() {... |
| 239 |
0
|
return duplicateIdentificationFields; |
| 240 |
|
} |
| 241 |
|
|
| 242 |
|
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 243 |
0
|
public void setMaintainableFields(List<MaintainableFieldDefinition> maintainableFields) {... |
| 244 |
0
|
maintainableFieldMap.clear(); |
| 245 |
0
|
for ( MaintainableFieldDefinition maintainableField : maintainableFields ) { |
| 246 |
0
|
if (maintainableField == null) { |
| 247 |
0
|
throw new IllegalArgumentException("invalid (null) maintainableField"); |
| 248 |
|
} |
| 249 |
|
|
| 250 |
0
|
String fieldName = maintainableField.getName(); |
| 251 |
0
|
if (maintainableFieldMap.containsKey(fieldName)) { |
| 252 |
0
|
throw new DuplicateEntryException("duplicate fieldName entry for field '" + fieldName + "'"); |
| 253 |
|
} |
| 254 |
|
|
| 255 |
0
|
maintainableFieldMap.put(fieldName, maintainableField); |
| 256 |
|
} |
| 257 |
0
|
this.maintainableFields = maintainableFields; |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 261 |
0
|
public void setMaintainableCollections(List<MaintainableCollectionDefinition> maintainableCollections) {... |
| 262 |
0
|
maintainableCollectionMap.clear(); |
| 263 |
0
|
for (MaintainableCollectionDefinition maintainableCollection : maintainableCollections ) { |
| 264 |
0
|
if (maintainableCollection == null) { |
| 265 |
0
|
throw new IllegalArgumentException("invalid (null) maintainableCollection"); |
| 266 |
|
} |
| 267 |
|
|
| 268 |
0
|
String fieldName = maintainableCollection.getName(); |
| 269 |
0
|
if (maintainableCollectionMap.containsKey(fieldName)) { |
| 270 |
0
|
throw new DuplicateEntryException("duplicate fieldName entry for field '" + fieldName + "'"); |
| 271 |
|
} |
| 272 |
|
|
| 273 |
0
|
maintainableCollectionMap.put(fieldName, maintainableCollection); |
| 274 |
|
} |
| 275 |
0
|
this.maintainableCollections = maintainableCollections; |
| 276 |
|
} |
| 277 |
|
|
| 278 |
|
|
| 279 |
|
|
| 280 |
|
|
| 281 |
|
|
| 282 |
|
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 283 |
0
|
public void setSummaryFields(List<MaintainableFieldDefinition> summaryFields) {... |
| 284 |
0
|
summaryFieldMap.clear(); |
| 285 |
0
|
for (MaintainableFieldDefinition summaryField : summaryFields ) { |
| 286 |
0
|
if (summaryField == null) { |
| 287 |
0
|
throw new IllegalArgumentException("invalid (null) summaryField"); |
| 288 |
|
} |
| 289 |
|
|
| 290 |
0
|
String fieldName = summaryField.getName(); |
| 291 |
0
|
if (summaryFieldMap.containsKey(fieldName)) { |
| 292 |
0
|
throw new DuplicateEntryException("duplicate fieldName entry for field '" + fieldName + "'"); |
| 293 |
|
} |
| 294 |
|
|
| 295 |
0
|
summaryFieldMap.put(fieldName, summaryField); |
| 296 |
|
} |
| 297 |
0
|
this.summaryFields = summaryFields; |
| 298 |
|
} |
| 299 |
|
|
| 300 |
|
|
| 301 |
|
|
| 302 |
|
|
| 303 |
|
|
| 304 |
|
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 305 |
0
|
public void setDuplicateIdentificationFields(List<MaintainableFieldDefinition> duplicateIdentificationFields) {... |
| 306 |
0
|
duplicateIdentificationFieldMap.clear(); |
| 307 |
0
|
for (MaintainableFieldDefinition identifierField : duplicateIdentificationFields) { |
| 308 |
0
|
if (identifierField == null) { |
| 309 |
0
|
throw new IllegalArgumentException("invalid (null) identifierField"); |
| 310 |
|
} |
| 311 |
|
|
| 312 |
0
|
String fieldName = identifierField.getName(); |
| 313 |
0
|
if (duplicateIdentificationFieldMap.containsKey(fieldName)) { |
| 314 |
0
|
throw new DuplicateEntryException("duplicate fieldName entry for field '" + fieldName + "'"); |
| 315 |
|
} |
| 316 |
|
|
| 317 |
0
|
duplicateIdentificationFieldMap.put(fieldName, identifierField); |
| 318 |
|
} |
| 319 |
0
|
this.duplicateIdentificationFields = duplicateIdentificationFields; |
| 320 |
|
} |
| 321 |
|
|
| 322 |
|
|
| 323 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 324 |
0
|
public boolean isAlwaysAllowCollectionDeletion() {... |
| 325 |
0
|
return this.alwaysAllowCollectionDeletion; |
| 326 |
|
} |
| 327 |
|
|
| 328 |
|
|
| 329 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 330 |
0
|
public void setAlwaysAllowCollectionDeletion(... |
| 331 |
|
boolean alwaysAllowCollectionDeletion) { |
| 332 |
0
|
this.alwaysAllowCollectionDeletion = alwaysAllowCollectionDeletion; |
| 333 |
|
} |
| 334 |
|
|
| 335 |
|
} |