TagService not returning all Tags
Is there a reason why TagServce would not return all the tags for a document? I do not have an exception or anything.
These tags were added programatically as so:
TagService tagService = Framework.getService(TagService.class);
for(int i=0; i<tags.length; i++)
{
tagService.tag(session, doc.getId(), tags[i], session.getPrincipal().getName());
}
I then use the following code to get the tags:
TagService tagService = Framework.getService(TagService.class);
List<Tag> tagList = tagService.getDocumentTags(session, doc.getId(), session.getPrincipal().getName());
Only one tag is returned on a document that clearly has 5 tags. The only tag it returns is the one that I added myself inside the Nuxeo UI (not programmatically).
Thank you in advance.
I found the problem.
When I used the tag service to place the tags, they did not belong to particular user.
So when I pulled them using the following code
List<Tag> tagList = tagService.getDocumentTags(session, doc.getId(), session.getPrincipal().getName());
It was only pulling the ones I added via the limit I placed.
The fix is to not set a user as so:
List<Tag> tagList = tagService.getDocumentTags(session, doc.getId(), null);
I am now getting all of the tags for the document.
I hope this helps someone.
CoreSession.save()
somewhere?