use of org.finra.herd.model.api.xml.TagType in project herd by FINRAOS.
the class TagTypeServiceImpl method createTagTypeFromEntity.
/**
* Creates the tag type registration from the persisted entity.
*
* @param tagTypeEntity the tag type registration entity
* @param includeDisplayName specifies to include the display name field
* @param includeTagTypeOrder specifies to include the tag type order field
* @param includeDescription specifies to include the description field
*
* @return the tag type registration
*/
private TagType createTagTypeFromEntity(TagTypeEntity tagTypeEntity, boolean includeDisplayName, boolean includeTagTypeOrder, boolean includeDescription) {
TagType tagType = new TagType();
TagTypeKey tagTypeKey = new TagTypeKey();
tagType.setTagTypeKey(tagTypeKey);
tagTypeKey.setTagTypeCode(tagTypeEntity.getCode());
if (includeDisplayName) {
tagType.setDisplayName(tagTypeEntity.getDisplayName());
}
if (includeTagTypeOrder) {
tagType.setTagTypeOrder(tagTypeEntity.getOrderNumber());
}
if (includeDescription) {
tagType.setDescription(tagTypeEntity.getDescription());
}
return tagType;
}
use of org.finra.herd.model.api.xml.TagType in project herd by FINRAOS.
the class TagTypeRestControllerTest method testDeleteTagType.
@Test
public void testDeleteTagType() throws Exception {
TagTypeKey tagTypeKey = new TagTypeKey(TAG_TYPE);
TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
when(tagTypeService.deleteTagType(tagTypeKey)).thenReturn(tagType);
// Delete this tag type.
TagType deletedTagType = tagTypeRestController.deleteTagType(TAG_TYPE);
// Verify the external calls.
verify(tagTypeService).deleteTagType(tagTypeKey);
verifyNoMoreInteractions(tagTypeService);
// Validate the returned object.
assertEquals(tagType, deletedTagType);
}
use of org.finra.herd.model.api.xml.TagType in project herd by FINRAOS.
the class TagTypeRestControllerTest method testGetTagType.
@Test
public void testGetTagType() throws Exception {
TagTypeKey tagTypeKey = new TagTypeKey(TAG_TYPE);
TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
when(tagTypeService.getTagType(tagTypeKey)).thenReturn(tagType);
// Retrieve the tag type.
TagType resultTagType = tagTypeRestController.getTagType(TAG_TYPE);
// Verify the external calls.
verify(tagTypeService).getTagType(tagTypeKey);
verifyNoMoreInteractions(tagTypeService);
// Validate the returned object.
assertEquals(tagType, resultTagType);
}
use of org.finra.herd.model.api.xml.TagType in project herd by FINRAOS.
the class TagTypeRestControllerTest method testCreateTagType.
@Test
public void testCreateTagType() throws Exception {
TagTypeCreateRequest request = new TagTypeCreateRequest(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
when(tagTypeService.createTagType(request)).thenReturn(tagType);
// Create a tag type.
TagType resultTagType = tagTypeRestController.createTagType(new TagTypeCreateRequest(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION));
// Verify the external calls.
verify(tagTypeService).createTagType(request);
verifyNoMoreInteractions(tagTypeService);
// Validate the returned object.
assertEquals(tagType, resultTagType);
}
use of org.finra.herd.model.api.xml.TagType in project herd by FINRAOS.
the class TagTypeRestControllerTest method testUpdateTagType.
@Test
public void testUpdateTagType() throws Exception {
TagTypeKey tagTypeKey = new TagTypeKey(TAG_TYPE);
TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_ORDER_2, TAG_TYPE_DESCRIPTION_2);
TagTypeUpdateRequest request = new TagTypeUpdateRequest(TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_ORDER_2, TAG_TYPE_DESCRIPTION_2);
when(tagTypeService.updateTagType(tagTypeKey, request)).thenReturn(tagType);
// Retrieve the tag type.
TagType resultTagType = tagTypeRestController.updateTagType(TAG_TYPE, request);
// Validate the returned object.
assertEquals(tagType, resultTagType);
}
Aggregations