public CephObjectWrapper getExcerpt()

in src/main/java/com/epam/digital/data/platform/excerpt/api/service/ExcerptRetrievingService.java [57:73]


  public CephObjectWrapper getExcerpt(UUID id, SecurityContext context) {
    var excerpt = recordRepository.findById(id)
            .orElseThrow(() -> new ExcerptNotFoundException("Record not found in DB: " + id));

    validateKeycloakId(excerpt, context);

    log.info("Searching Excerpt in Ceph");
    if (excerpt.getExcerptKey() == null) {
      log.error("Could not find excerpt with null Ceph key");
      throw new ExcerptNotFoundException("Could not find excerpt with null Ceph key");
    }
    CephObject cephObject = excerptCephService
        .get(bucket, excerpt.getExcerptKey())
        .orElseThrow(() -> new ExcerptNotFoundException(
                    "Excerpt not found in Ceph: " + excerpt.getExcerptKey()));
    return new CephObjectWrapper(cephObject, excerpt.getExcerptType());
  }