Package com.bhle.access.download

Source Code of com.bhle.access.download.OfflineDownloadResponssFetcher

package com.bhle.access.download;

import java.io.IOException;

import org.akubraproject.Blob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bhle.access.download.storage.FileStorage;

@Component
public class OfflineDownloadResponssFetcher {
  @Autowired
  private FileStorage storage;

  public OfflineDownloadResponse fetch(String email, String filename)
      throws IOException {
    OfflineDownloadResponse response = new OfflineDownloadResponse();
    Blob blob = storage.fetchBlob(email, filename);
    if (blob.exists()) {
      response.setBlob(storage.fetchBlob(email, filename));
    } else {
      throw new IOException("Content not found");
    }
    return response;
  }
}
TOP

Related Classes of com.bhle.access.download.OfflineDownloadResponssFetcher

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.