Search in sources :

Example 6 with ValidationException

use of bio.terra.app.controller.exception.ValidationException in project jade-data-repo by DataBiosphere.

the class RepositoryApiController method lookupFileByPath.

@Override
public ResponseEntity<FileModel> lookupFileByPath(@PathVariable("id") String id, @RequestParam(value = "path", required = true) String path, @RequestParam(value = "depth", required = false, defaultValue = "0") Integer depth) {
    iamService.verifyAuthorization(getAuthenticatedInfo(), IamResourceType.DATASET, id, IamAction.READ_DATA);
    if (!ValidationUtils.isValidPath(path)) {
        throw new ValidationException("InvalidPath");
    }
    FileModel fileModel = fileService.lookupPath(id, path, depth);
    return new ResponseEntity<>(fileModel, HttpStatus.OK);
}
Also used : FileModel(bio.terra.model.FileModel) ResponseEntity(org.springframework.http.ResponseEntity) ValidationException(bio.terra.app.controller.exception.ValidationException)

Aggregations

ValidationException (bio.terra.app.controller.exception.ValidationException)6 ResponseEntity (org.springframework.http.ResponseEntity)4 FileModel (bio.terra.model.FileModel)2 PolicyModel (bio.terra.model.PolicyModel)2 PolicyResponse (bio.terra.model.PolicyResponse)2 Dataset (bio.terra.service.dataset.Dataset)2 Query (bio.terra.grammar.Query)1 SnapshotRequestContentsModel (bio.terra.model.SnapshotRequestContentsModel)1 SnapshotRequestQueryModel (bio.terra.model.SnapshotRequestQueryModel)1 SnapshotRequestRowIdModel (bio.terra.model.SnapshotRequestRowIdModel)1 AssetSpecification (bio.terra.service.dataset.AssetSpecification)1 FileSystemCorruptException (bio.terra.service.filedata.exception.FileSystemCorruptException)1 SnapshotSummary (bio.terra.service.snapshot.SnapshotSummary)1 AssetNotFoundException (bio.terra.service.snapshot.exception.AssetNotFoundException)1 InvalidSnapshotException (bio.terra.service.snapshot.exception.InvalidSnapshotException)1