use of com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO in project ArachneCentralAPI by OHDSI.
the class BaseStudyController method updateDataSource.
@ApiOperation("Update data source linked to study")
@RequestMapping(value = "/api/v1/study-management/studies/{studyId}/data-sources/{dataSourceId}", method = PUT)
public JsonResult<DataSourceDTO> updateDataSource(Principal principal, @PathVariable("studyId") Long studyId, @PathVariable("dataSourceId") Long dataSourceId, @RequestBody @Valid CreateVirtualDataSourceDTO dataSourceDTO) throws PermissionDeniedException, ValidationException, IOException, NoSuchFieldException, SolrServerException, IllegalAccessException {
final IUser user = getUser(principal);
IDataSource dataSource = studyService.updateVirtualDataSource(user, studyId, dataSourceId, dataSourceDTO.getName(), dataSourceDTO.getDataOwnersIds());
return new JsonResult<>(NO_ERROR, conversionService.convert(dataSource, DataSourceDTO.class));
}
use of com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO in project ArachneCentralAPI by OHDSI.
the class BaseStudyController method createVirtualDataSource.
@ApiOperation("Create virtual data source linked to study")
@RequestMapping(value = "/api/v1/study-management/studies/{studyId}/data-sources", method = POST)
public JsonResult<DataSourceDTO> createVirtualDataSource(Principal principal, @PathVariable("studyId") Long studyId, @RequestBody @Valid CreateVirtualDataSourceDTO dataSourceDTO) throws PermissionDeniedException, NotExistException, IllegalAccessException, SolrServerException, IOException, ValidationException, FieldException, AlreadyExistException, NoSuchFieldException {
final IUser createdBy = getUser(principal);
final IDataSource dataSource = studyService.addVirtualDataSource(createdBy, studyId, dataSourceDTO.getName(), dataSourceDTO.getDataOwnersIds());
final DataSourceDTO registeredDataSourceDTO = conversionService.convert(dataSource, DataSourceDTO.class);
return new JsonResult<>(NO_ERROR, registeredDataSourceDTO);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO in project ArachneCentralAPI by OHDSI.
the class StudyDataSourceControllerTests method testAddVirtualDataSource.
@Test
@WithUserDetails(STUDY_LEAD)
@ExpectedDatabase(value = "/data/study/datasource/study-data-source1-virtual.xml", assertionMode = NON_STRICT)
public void testAddVirtualDataSource() throws Exception {
final CreateVirtualDataSourceDTO createVirtualDataSourceDTO = new CreateVirtualDataSourceDTO();
createVirtualDataSourceDTO.setName("virtual");
createVirtualDataSourceDTO.setDataOwnersIds(Arrays.asList(UserIdUtils.idToUuid(1l)));
mvc.perform(post("/api/v1/study-management/studies/{studyId}/data-sources", STUDY_ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(createVirtualDataSourceDTO))).andExpect(NO_ERROR_CODE);
}
Aggregations