use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceImpl method getBusinessObjectDefinitionTagsByBusinessObjectDefinition.
@Override
public BusinessObjectDefinitionTagKeys getBusinessObjectDefinitionTagsByBusinessObjectDefinition(BusinessObjectDefinitionKey businessObjectDefinitionKey) {
// Validate the business object definition key.
businessObjectDefinitionHelper.validateBusinessObjectDefinitionKey(businessObjectDefinitionKey);
// Get the business object definition entity and ensure it exists.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoHelper.getBusinessObjectDefinitionEntity(businessObjectDefinitionKey);
// Retrieve and return a list of business object definition tag keys.
return new BusinessObjectDefinitionTagKeys(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagsByBusinessObjectDefinitionEntity(businessObjectDefinitionEntity));
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceImpl method getBusinessObjectDefinitionTagsByTag.
@Override
public BusinessObjectDefinitionTagKeys getBusinessObjectDefinitionTagsByTag(TagKey tagKey) {
// Validate the tag key.
tagHelper.validateTagKey(tagKey);
// Get the tag entity and ensure it exists.
TagEntity tagEntity = tagDaoHelper.getTagEntity(tagKey);
// Create a list of tag entities along with all its children tags down the hierarchy up to maximum allowed tag nesting level.
List<TagEntity> tagEntities = new ArrayList<>();
tagEntities.add(tagEntity);
tagEntities.addAll(tagDaoHelper.getTagChildrenEntities(tagEntity));
// Retrieve and return a list of business object definition tag keys.
return new BusinessObjectDefinitionTagKeys(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagsByTagEntities(tagEntities));
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys in project herd by FINRAOS.
the class BusinessObjectDefinitionTagRestControllerTest method testGetBusinessObjectDefinitionTagsByTag.
@Test
public void testGetBusinessObjectDefinitionTagsByTag() {
TagKey tagKey = new TagKey(TAG_TYPE, TAG_CODE);
BusinessObjectDefinitionTagKey businessObjectDefinitionTagKey = new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE));
BusinessObjectDefinitionTagKeys businessObjectDefinitionTagKeys = new BusinessObjectDefinitionTagKeys(Arrays.asList(businessObjectDefinitionTagKey));
when(businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByTag(tagKey)).thenReturn(businessObjectDefinitionTagKeys);
// Get business object definition tags by tag.
BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagRestController.getBusinessObjectDefinitionTagsByTag(TAG_TYPE, TAG_CODE);
// Verify the external calls.
verify(businessObjectDefinitionTagService).getBusinessObjectDefinitionTagsByTag(tagKey);
verifyNoMoreInteractions(businessObjectDefinitionTagService);
// Validate the returned object.
assertEquals(businessObjectDefinitionTagKeys, result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys in project herd by FINRAOS.
the class BusinessObjectDefinitionTagRestControllerTest method testGetBusinessObjectDefinitionTagsByBusinessObjectDefinition.
@Test
public void testGetBusinessObjectDefinitionTagsByBusinessObjectDefinition() {
// Create a business object definition key.
BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
// Create tag keys.
List<TagKey> tagKeys = Arrays.asList(new TagKey(TAG_TYPE, TAG_CODE), new TagKey(TAG_TYPE_2, TAG_CODE_2));
BusinessObjectDefinitionTagKey businessObjectDefinitionTagKey = new BusinessObjectDefinitionTagKey(businessObjectDefinitionKey, new TagKey(TAG_TYPE, TAG_CODE));
BusinessObjectDefinitionTagKeys BusinessObjectDefinitionTagKeys = new BusinessObjectDefinitionTagKeys(Arrays.asList(businessObjectDefinitionTagKey));
when(businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByBusinessObjectDefinition(businessObjectDefinitionKey)).thenReturn(BusinessObjectDefinitionTagKeys);
// Get business object definition tags by business object definition.
BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagRestController.getBusinessObjectDefinitionTagsByBusinessObjectDefinition(BDEF_NAMESPACE, BDEF_NAME);
// Verify the external calls.
verify(businessObjectDefinitionTagService).getBusinessObjectDefinitionTagsByBusinessObjectDefinition(businessObjectDefinitionKey);
verifyNoMoreInteractions(businessObjectDefinitionTagService);
// Validate the returned object.
assertEquals(BusinessObjectDefinitionTagKeys, result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testGetBusinessObjectDefinitionTagsByTagUpperCaseParameters.
@Test
public void testGetBusinessObjectDefinitionTagsByTagUpperCaseParameters() {
// Create business object definition keys.
List<BusinessObjectDefinitionKey> businessObjectDefinitionKeys = Arrays.asList(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new BusinessObjectDefinitionKey(BDEF_NAMESPACE_2, BDEF_NAME_2));
// Create a tag key.
TagKey tagKey = new TagKey(TAG_TYPE, TAG_CODE);
// Create and persist business object definition tag entities.
for (BusinessObjectDefinitionKey businessObjectDefinitionKey : businessObjectDefinitionKeys) {
businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionKey, tagKey);
}
// Get business object definition tags by tag using upper case parameter values.
BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByTag(new TagKey(TAG_TYPE.toUpperCase(), TAG_CODE.toUpperCase()));
// Validate the returned object.
assertNotNull(result);
assertEquals(Arrays.asList(new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(0), tagKey), new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(1), tagKey)), result.getBusinessObjectDefinitionTagKeys());
}
Aggregations