use of io.gravitee.rest.api.service.exceptions.TagNotFoundException in project gravitee-management-rest-api by gravitee-io.
the class TagServiceImpl method findByIdAndReference.
@Override
public TagEntity findByIdAndReference(String tagId, String referenceId, TagReferenceType referenceType) {
try {
LOGGER.debug("Find tag by ID: {}", tagId);
Optional<Tag> optTag = tagRepository.findByIdAndReference(tagId, referenceId, repoTagReferenceType(referenceType));
if (!optTag.isPresent()) {
throw new TagNotFoundException(tagId);
}
return convert(optTag.get());
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to find tag by ID", ex);
throw new TechnicalManagementException("An error occurs while trying to find tag by ID", ex);
}
}
Aggregations