mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
Addressed review comments
This commit is contained in:
@@ -196,7 +196,11 @@ public class TagsImpl implements Tags
|
||||
public NodeRef validateTag(String tagId)
|
||||
{
|
||||
NodeRef tagNodeRef = nodes.validateNode(tagId);
|
||||
return validateTag(tagNodeRef.getStoreRef(), tagId);
|
||||
if (tagNodeRef == null || nodeService.hasAspect(tagNodeRef, ContentModel.ASPECT_TAGGABLE))
|
||||
{
|
||||
throw new EntityNotFoundException(tagId);
|
||||
}
|
||||
return tagNodeRef;
|
||||
}
|
||||
|
||||
public NodeRef validateTag(StoreRef storeRef, String tagId)
|
||||
@@ -247,10 +251,6 @@ public class TagsImpl implements Tags
|
||||
public CollectionWithPagingInfo<Tag> getTags(String nodeId, Parameters params)
|
||||
{
|
||||
NodeRef nodeRef = nodes.validateNode(nodeId);
|
||||
if( nodeRef == null )
|
||||
{
|
||||
throw new EntityNotFoundException(nodeId);
|
||||
}
|
||||
PagingResults<Pair<NodeRef, String>> results = taggingService.getTags(nodeRef, Util.getPagingRequest(params.getPaging()));
|
||||
Integer totalItems = results.getTotalResultCount().getFirst();
|
||||
List<Pair<NodeRef, String>> page = results.getPage();
|
||||
|
@@ -100,13 +100,6 @@ public class TagsImplTest
|
||||
assertEquals(expectedTags, actualCreatedTags);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTagNotFoundValidation()
|
||||
{
|
||||
given(nodeServiceMock.hasAspect(any(),any())).willReturn(true);
|
||||
assertThrows(EntityNotFoundException.class, () ->objectUnderTest.validateTag(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, TAG_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteTagById()
|
||||
{
|
||||
@@ -151,6 +144,9 @@ public class TagsImplTest
|
||||
|
||||
then(nodesMock).should().validateNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "dummy-id");
|
||||
then(nodesMock).shouldHaveNoMoreInteractions();
|
||||
|
||||
then(taggingServiceMock).shouldHaveNoInteractions();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user