Search in sources :

Example 1 with TagExistsException

use of org.alfresco.repo.tagging.TagExistsException in project alfresco-remote-api by Alfresco.

the class TagsImpl method changeTag.

public Tag changeTag(StoreRef storeRef, String tagId, Tag tag) {
    try {
        NodeRef existingTagNodeRef = validateTag(storeRef, tagId);
        String existingTagName = taggingService.getTagName(existingTagNodeRef);
        String newTagName = tag.getTag();
        NodeRef newTagNodeRef = taggingService.changeTag(storeRef, existingTagName, newTagName);
        return new Tag(newTagNodeRef, newTagName);
    } catch (NonExistentTagException e) {
        throw new NotFoundException(e.getMessage());
    } catch (TagExistsException e) {
        throw new ConstraintViolatedException(e.getMessage());
    } catch (TaggingException e) {
        throw new InvalidArgumentException(e.getMessage());
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) InvalidArgumentException(org.alfresco.rest.framework.core.exceptions.InvalidArgumentException) TagExistsException(org.alfresco.repo.tagging.TagExistsException) EntityNotFoundException(org.alfresco.rest.framework.core.exceptions.EntityNotFoundException) NotFoundException(org.alfresco.rest.framework.core.exceptions.NotFoundException) TaggingException(org.alfresco.repo.tagging.TaggingException) Tag(org.alfresco.rest.api.model.Tag) ConstraintViolatedException(org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException) NonExistentTagException(org.alfresco.repo.tagging.NonExistentTagException)

Aggregations

NonExistentTagException (org.alfresco.repo.tagging.NonExistentTagException)1 TagExistsException (org.alfresco.repo.tagging.TagExistsException)1 TaggingException (org.alfresco.repo.tagging.TaggingException)1 Tag (org.alfresco.rest.api.model.Tag)1 ConstraintViolatedException (org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException)1 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)1 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)1 NotFoundException (org.alfresco.rest.framework.core.exceptions.NotFoundException)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1