use of org.pmiops.workbench.model.FileDetail in project workbench by all-of-us.
the class WorkspacesController method convertBlobToFileDetail.
/**
* Convers Blob to FileDetail
* @param blobList
* @param bucketName
* @return List of FileDetail
*/
private List<FileDetail> convertBlobToFileDetail(List<Blob> blobList, String bucketName) {
List<FileDetail> fileList = new ArrayList<>();
blobList.forEach(blob -> {
String[] parts = blob.getName().split("/");
FileDetail fileDetail = new FileDetail();
fileDetail.setName(parts[parts.length - 1]);
fileDetail.setPath("gs://" + bucketName + "/" + blob.getName());
fileList.add(fileDetail);
});
return fileList;
}
use of org.pmiops.workbench.model.FileDetail in project workbench by all-of-us.
the class WorkspacesController method getNoteBookList.
@Override
public ResponseEntity<List<FileDetail>> getNoteBookList(String workspaceNamespace, String workspaceId) {
List<FileDetail> fileList = new ArrayList<>();
try {
org.pmiops.workbench.firecloud.model.Workspace fireCloudWorkspace = fireCloudService.getWorkspace(workspaceNamespace, workspaceId).getWorkspace();
String bucketName = fireCloudWorkspace.getBucketName();
fileList = getFilesFromNotebooks(bucketName);
} catch (org.pmiops.workbench.firecloud.ApiException e) {
if (e.getCode() == 404) {
throw new NotFoundException(String.format("Workspace %s/%s not found", workspaceNamespace, workspaceId));
}
throw new ServerErrorException(e);
}
return ResponseEntity.ok(fileList);
}
Aggregations