Search in sources :

Example 6 with HarmonizationStudy

use of org.obiba.mica.study.domain.HarmonizationStudy in project mica2 by obiba.

the class DatasetDtosTest method before.

@Before
public void before() {
    MicaConfig config = new MicaConfig();
    config.setLocales(Arrays.asList(Locale.ENGLISH, Locale.FRENCH));
    when(micaConfigService.getConfig()).thenReturn(config);
    when(subjectAclService.isPermitted(anyString(), anyString(), anyString())).thenReturn(true);
    when(publishedStudyService.findById(anyString())).thenReturn(new HarmonizationStudy());
    when(studySummaryDtos.asHarmoStudyDto(anyString())).thenReturn(Mica.StudySummaryDto.newBuilder().setId("123").setPublished(true).build());
    when(studySummaryDtos.asDto(anyString())).thenReturn(Mica.StudySummaryDto.newBuilder().setId("123").setPublished(true).build());
    when(permissionsDtos.asDto(any(StudyDataset.class))).thenReturn(Mica.PermissionsDto.getDefaultInstance());
    when(permissionsDtos.asDto(any(HarmonizationDataset.class))).thenReturn(Mica.PermissionsDto.getDefaultInstance());
}
Also used : MicaConfig(org.obiba.mica.micaConfig.domain.MicaConfig) HarmonizationStudy(org.obiba.mica.study.domain.HarmonizationStudy) StudyDataset(org.obiba.mica.dataset.domain.StudyDataset) HarmonizationDataset(org.obiba.mica.dataset.domain.HarmonizationDataset) Before(org.junit.Before)

Example 7 with HarmonizationStudy

use of org.obiba.mica.study.domain.HarmonizationStudy in project mica2 by obiba.

the class PublishedStudyResource method getStudyDto.

@GET
@Timed
public Mica.StudyDto getStudyDto(@PathParam("id") String id, @QueryParam("locale") String locale) {
    checkAccess(id);
    BaseStudy study = getStudy(id, locale);
    return study instanceof Study ? dtos.asDto((Study) study) : dtos.asDto((HarmonizationStudy) study);
}
Also used : HarmonizationStudy(org.obiba.mica.study.domain.HarmonizationStudy) BaseStudy(org.obiba.mica.study.domain.BaseStudy) Study(org.obiba.mica.study.domain.Study) HarmonizationStudy(org.obiba.mica.study.domain.HarmonizationStudy) BaseStudy(org.obiba.mica.study.domain.BaseStudy) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Aggregations

HarmonizationStudy (org.obiba.mica.study.domain.HarmonizationStudy)7 Timed (com.codahale.metrics.annotation.Timed)4 HashMap (java.util.HashMap)3 HarmonizationDataset (org.obiba.mica.dataset.domain.HarmonizationDataset)3 Maps (com.google.common.collect.Maps)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 NotNull (javax.validation.constraints.NotNull)2 GET (javax.ws.rs.GET)2 PUT (javax.ws.rs.PUT)2 Path (javax.ws.rs.Path)2 BaseStudy (org.obiba.mica.study.domain.BaseStudy)2 Study (org.obiba.mica.study.domain.Study)2 HarmonizationStudyService (org.obiba.mica.study.service.HarmonizationStudyService)2 Strings (com.google.common.base.Strings)1 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)1 Lists (com.google.common.collect.Lists)1 Assert (io.jsonwebtoken.lang.Assert)1