Search in sources :

Example 26 with StudyDataset

use of org.obiba.mica.dataset.domain.StudyDataset 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;
}
Also used : NoSuchDatasetException(org.obiba.mica.dataset.NoSuchDatasetException) StudyDataset(org.obiba.mica.dataset.domain.StudyDataset) Dataset(org.obiba.mica.dataset.domain.Dataset) HarmonizationDataset(org.obiba.mica.dataset.domain.HarmonizationDataset) StudyDataset(org.obiba.mica.dataset.domain.StudyDataset)

Example 27 with StudyDataset

use of org.obiba.mica.dataset.domain.StudyDataset 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;
}
Also used : StudyDataset(org.obiba.mica.dataset.domain.StudyDataset) Dataset(org.obiba.mica.dataset.domain.Dataset) StudyDataset(org.obiba.mica.dataset.domain.StudyDataset)

Aggregations

StudyDataset (org.obiba.mica.dataset.domain.StudyDataset)27 Dataset (org.obiba.mica.dataset.domain.Dataset)10 StudyTable (org.obiba.mica.core.domain.StudyTable)6 HarmonizationDataset (org.obiba.mica.dataset.domain.HarmonizationDataset)6 Timed (com.codahale.metrics.annotation.Timed)5 DatasetVariable (org.obiba.mica.dataset.domain.DatasetVariable)5 Lists (com.google.common.collect.Lists)4 IOException (java.io.IOException)4 Inject (javax.inject.Inject)4 DatasetUpdatedEvent (org.obiba.mica.dataset.event.DatasetUpdatedEvent)4 Component (org.springframework.stereotype.Component)4 Strings (com.google.common.base.Strings)3 Collectors (java.util.stream.Collectors)3 Collectors.toList (java.util.stream.Collectors.toList)3 Path (javax.ws.rs.Path)3 Sets (com.google.common.collect.Sets)2 EventBus (com.google.common.eventbus.EventBus)2 java.util (java.util)2 HashMap (java.util.HashMap)2 List (java.util.List)2