use of bio.terra.service.snapshot.SnapshotSummary in project jade-data-repo by DataBiosphere.
the class CreateSnapshotMetadataStep method doStep.
@Override
public StepResult doStep(FlightContext context) {
try {
Snapshot snapshot = snapshotService.makeSnapshotFromSnapshotRequest(snapshotReq);
UUID snapshotId = snapshotDao.createAndLock(snapshot, context.getFlightId());
FlightMap workingMap = context.getWorkingMap();
workingMap.put(SnapshotWorkingMapKeys.SNAPSHOT_ID, snapshotId);
SnapshotSummary snapshotSummary = snapshotDao.retrieveSummaryById(snapshot.getId());
SnapshotSummaryModel response = snapshotService.makeSummaryModelFromSummary(snapshotSummary);
FlightUtils.setResponse(context, response, HttpStatus.CREATED);
return StepResult.getStepResultSuccess();
} catch (InvalidSnapshotException isEx) {
return new StepResult(StepStatus.STEP_RESULT_FAILURE_FATAL, isEx);
} catch (SnapshotNotFoundException ex) {
FlightUtils.setErrorResponse(context, ex.toString(), HttpStatus.BAD_REQUEST);
return new StepResult(StepStatus.STEP_RESULT_FAILURE_FATAL, ex);
}
}
use of bio.terra.service.snapshot.SnapshotSummary in project jade-data-repo by DataBiosphere.
the class DeleteDatasetValidateStep method doStep.
@Override
public StepResult doStep(FlightContext context) {
List<SnapshotSummary> snapshots = snapshotDao.retrieveSnapshotsForDataset(datasetId);
Dataset dataset = datasetService.retrieve(datasetId);
if (snapshots.size() != 0) {
throw new ValidationException("Can not delete a dataset being used by snapshots");
}
// if there are no snapshots returned from retrieveSnapshotsForDataset.
if (dependencyDao.datasetHasSnapshotReference(dataset)) {
throw new FileSystemCorruptException("File system has snapshot dependencies; metadata does not");
}
return StepResult.getStepResultSuccess();
}
Aggregations