use of org.obiba.mica.dataset.domain.Dataset in project mica2 by obiba.
the class DraftCollectedDatasetResource method update.
@PUT
public Response update(Mica.DatasetDto datasetDto, @Context UriInfo uriInfo, @Nullable @QueryParam("comment") String comment) {
checkPermission("/draft/collected-dataset", "EDIT");
if (!datasetDto.hasId() || !datasetDto.getId().equals(id))
throw new IllegalArgumentException("Not the expected dataset id");
Dataset dataset = dtos.fromDto(datasetDto);
if (!(dataset instanceof StudyDataset))
throw new IllegalArgumentException("A study dataset is expected");
datasetService.save((StudyDataset) dataset, comment);
return Response.noContent().build();
}
use of org.obiba.mica.dataset.domain.Dataset in project mica2 by obiba.
the class DatasetController method getDataset.
private Dataset getDataset(String id, String shareKey) {
Dataset dataset;
if (Strings.isNullOrEmpty(shareKey)) {
dataset = publishedDatasetService.findById(id);
if (dataset == null)
throw NoSuchDatasetException.withId(id);
checkAccess((dataset instanceof StudyDataset) ? "/collected-dataset" : "/harmonized-dataset", id);
} else {
try {
dataset = draftCollectedDatasetService.findById(id);
checkPermission("/draft/collected-dataset", "VIEW", id, shareKey);
} catch (NoSuchDatasetException ex) {
dataset = draftHarmonizedDatasetService.findById(id);
checkPermission("/draft/harmonized-dataset", "VIEW", id, shareKey);
}
}
return dataset;
}
use of org.obiba.mica.dataset.domain.Dataset in project mica2 by obiba.
the class DatasetAnalysisController method getDataset.
private Dataset getDataset(String id) {
Dataset dataset = publishedDatasetService.findById(id);
if (dataset == null)
throw NoSuchDatasetException.withId(id);
checkAccess((dataset instanceof StudyDataset) ? "/collected-dataset" : "/harmonized-dataset", id);
return dataset;
}
Aggregations