use of org.finra.herd.model.jpa.BusinessObjectDefinitionTagEntity in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testDeleteBusinessObjectDefinitionTagLowerCaseParameters.
@Test
public void testDeleteBusinessObjectDefinitionTagLowerCaseParameters() {
// Create a business object definition tag key.
BusinessObjectDefinitionTagKey businessObjectDefinitionTagKey = new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE));
// Create and persist a business object definition tag entity.
BusinessObjectDefinitionTagEntity businessObjectDefinitionTagEntity = businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE));
// Validate that this business object definition tag exists.
assertNotNull(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(businessObjectDefinitionTagKey));
// Delete this business object definition tag using lower case parameter values.
BusinessObjectDefinitionTag result = businessObjectDefinitionTagService.deleteBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase()), new TagKey(TAG_TYPE.toLowerCase(), TAG_CODE.toLowerCase())));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionTag(businessObjectDefinitionTagEntity.getId(), businessObjectDefinitionTagKey), result);
// Ensure that this business object definition tag is no longer there.
assertNull(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(businessObjectDefinitionTagKey));
}
use of org.finra.herd.model.jpa.BusinessObjectDefinitionTagEntity in project herd by FINRAOS.
the class BusinessObjectDefinitionHelperTest method testProcessTagSearchScoreMultiplierTagsEmpty.
@Test
public void testProcessTagSearchScoreMultiplierTagsEmpty() {
// Create a business object definition entity
final BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, businessObjectDefinitionServiceTestHelper.getNewAttributes2());
// Associate business object definition entity with no tag entities
List<BusinessObjectDefinitionTagEntity> businessObjectDefinitionTagEntities = new ArrayList<>();
businessObjectDefinitionEntity.setBusinessObjectDefinitionTags(businessObjectDefinitionTagEntities);
// Call the method under test
businessObjectDefinitionHelper.processTagSearchScoreMultiplier(businessObjectDefinitionEntity);
// Validate the result
assertEquals(businessObjectDefinitionEntity.getTagSearchScoreMultiplier(), BigDecimal.ONE.setScale(3, RoundingMode.HALF_UP));
}
use of org.finra.herd.model.jpa.BusinessObjectDefinitionTagEntity in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceImpl method deleteBusinessObjectDefinitionTag.
@NamespacePermission(fields = "#businessObjectDefinitionTagKey.businessObjectDefinitionKey.namespace", permissions = { NamespacePermissionEnum.WRITE_DESCRIPTIVE_CONTENT, NamespacePermissionEnum.WRITE })
@Override
public BusinessObjectDefinitionTag deleteBusinessObjectDefinitionTag(BusinessObjectDefinitionTagKey businessObjectDefinitionTagKey) {
// Validate and trim the business object definition tag key.
validateBusinessObjectDefinitionTagKey(businessObjectDefinitionTagKey);
// Retrieve and ensure that a business object definition tag exists.
BusinessObjectDefinitionTagEntity businessObjectDefinitionTagEntity = getBusinessObjectDefinitionTagEntity(businessObjectDefinitionTagKey);
// Delete this business object format.
businessObjectDefinitionTagDao.delete(businessObjectDefinitionTagEntity);
// Notify the search index that a business object definition must be updated.
searchIndexUpdateHelper.modifyBusinessObjectDefinitionInSearchIndex(businessObjectDefinitionDaoHelper.getBusinessObjectDefinitionEntity(businessObjectDefinitionTagKey.getBusinessObjectDefinitionKey()), SEARCH_INDEX_UPDATE_TYPE_UPDATE);
// Create and return the business object definition tag object from the deleted entity.
return createBusinessObjectDefinitionTagFromEntity(businessObjectDefinitionTagEntity);
}
Aggregations