Search in sources :

Example 1 with BusinessObjectDefinitionTagKeys

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));
}
Also used : BusinessObjectDefinitionEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionEntity) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys)

Example 2 with BusinessObjectDefinitionTagKeys

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));
}
Also used : TagEntity(org.finra.herd.model.jpa.TagEntity) BusinessObjectDefinitionTagEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionTagEntity) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys) ArrayList(java.util.ArrayList)

Example 3 with BusinessObjectDefinitionTagKeys

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);
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) Test(org.junit.Test)

Example 4 with BusinessObjectDefinitionTagKeys

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);
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) Test(org.junit.Test)

Example 5 with BusinessObjectDefinitionTagKeys

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());
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionTagKeys (org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys)15 Test (org.junit.Test)13 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)12 BusinessObjectDefinitionTagKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey)12 TagKey (org.finra.herd.model.api.xml.TagKey)12 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)2 BusinessObjectDefinitionTagEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionTagEntity)2 TagEntity (org.finra.herd.model.jpa.TagEntity)2 ArrayList (java.util.ArrayList)1 TagTypeEntity (org.finra.herd.model.jpa.TagTypeEntity)1