added unit test cases to controller and services - Minor test fix
@@ -1315,8 +1315,7 @@ public class BusinessObjectFormatServiceImpl implements BusinessObjectFormatServ
// Process the list of attribute definitions to determine that business object definition attribute entities should be created, updated, or deleted.
List<BusinessObjectDataAttributeDefinitionEntity> createdAttributeDefinitionEntities = new ArrayList<>();
List<BusinessObjectDataAttributeDefinitionEntity> retainedAttributeDefinitionEntities = new ArrayList<>();
- if (!CollectionUtils.isEmpty(attributeDefinitions))
- {
+
for (AttributeDefinition attributeDefinition : attributeDefinitions)
{
// Use a "lowercase" attribute name for case insensitivity.
@@ -1342,13 +1341,12 @@ public class BusinessObjectFormatServiceImpl implements BusinessObjectFormatServ
businessObjectFormatEntity.getAttributeDefinitions().add(businessObjectDataAttributeDefinitionEntity);
businessObjectDataAttributeDefinitionEntity.setBusinessObjectFormat(businessObjectFormatEntity);
businessObjectDataAttributeDefinitionEntity.setName(attributeDefinition.getName());
- businessObjectDataAttributeDefinitionEntity.setPublish(attributeDefinition.isPublish());
+ businessObjectDataAttributeDefinitionEntity.setPublish(BooleanUtils.isTrue(attributeDefinition.isPublish()));
// Add this entity to the list of the newly created business object definition attribute entities.
createdAttributeDefinitionEntities.add(businessObjectDataAttributeDefinitionEntity);
}
}
- }
// Remove any of the currently existing attribute entities that did not get onto the retained entities list.
businessObjectFormatEntity.getAttributeDefinitions().retainAll(retainedAttributeDefinitionEntities);
@@ -1365,9 +1363,7 @@ public class BusinessObjectFormatServiceImpl implements BusinessObjectFormatServ
private void validateAndTrimBusinessObjectFormatAttributeDefinitionsHelper(List<AttributeDefinition> attributeDefinitions)
{
Assert.notNull(attributeDefinitions, "A business object format attribute definitions list is required.");
- // Validate attribute definitions if they are specified.
- if (!CollectionUtils.isEmpty(attributeDefinitions))
- {
+
Map<String, AttributeDefinition> attributeDefinitionNameValidationMap = new HashMap<>();
for (AttributeDefinition attributeDefinition : attributeDefinitions)
{
@@ -1384,4 +1380,3 @@ public class BusinessObjectFormatServiceImpl implements BusinessObjectFormatServ
}
}
}
-}
