Search in sources :

Example 1 with IDataSource

use of com.odysseusinc.arachne.portal.model.IDataSource 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));
}
Also used : DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) CreateVirtualDataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) IDataSource(com.odysseusinc.arachne.portal.model.IDataSource) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with IDataSource

use of com.odysseusinc.arachne.portal.model.IDataSource 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);
}
Also used : DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) CreateVirtualDataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) IDataSource(com.odysseusinc.arachne.portal.model.IDataSource) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with IDataSource

use of com.odysseusinc.arachne.portal.model.IDataSource in project ArachneCentralAPI by OHDSI.

the class StudyDataSourceLinkToPaperStudyDataSourceConverter method convert.

@Override
public PaperStudyDataSource convert(StudyDataSourceLink studyDataSourceLink) {
    final PaperStudyDataSource studyDataSource = new PaperStudyDataSource();
    final IDataSource dataSource = studyDataSourceLink.getDataSource();
    studyDataSource.setDataSource(dataSource);
    return studyDataSource;
}
Also used : PaperStudyDataSource(com.odysseusinc.arachne.portal.model.PaperStudyDataSource) IDataSource(com.odysseusinc.arachne.portal.model.IDataSource)

Example 4 with IDataSource

use of com.odysseusinc.arachne.portal.model.IDataSource in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionToSubmissionDTOConverter method convert.

@Override
public DTO convert(T source) {
    DTO dto = super.convert(source);
    dto.setInsight(insightDTO(source.getSubmissionInsight()));
    final Status status = statusConverter(source.getStatus());
    final Boolean execConfirmed = status.isExecConfirmed();
    dto.setIsExecConfirmed(execConfirmed);
    final Boolean resultConfirmed = status.isResultConfirmed();
    dto.setIsResultConfirmed(resultConfirmed);
    dto.setAction(source.getStatus().toString());
    IDataSource dataSource = source.getDataSource();
    Long loggedUserId = ((ArachneUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
    final boolean isOwner = DataNodeUtils.isDataNodeOwner(dataSource.getDataNode(), loggedUserId);
    dto.setIsOwner(isOwner);
    return dto;
}
Also used : ArachneUser(com.odysseusinc.arachne.portal.model.security.ArachneUser) SubmissionInsightDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO) IDataSource(com.odysseusinc.arachne.portal.model.IDataSource)

Aggregations

IDataSource (com.odysseusinc.arachne.portal.model.IDataSource)4 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)2 CreateVirtualDataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO)2 DataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO)2 IUser (com.odysseusinc.arachne.portal.model.IUser)2 ApiOperation (io.swagger.annotations.ApiOperation)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 SubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)1 SubmissionInsightDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO)1 PaperStudyDataSource (com.odysseusinc.arachne.portal.model.PaperStudyDataSource)1 ArachneUser (com.odysseusinc.arachne.portal.model.security.ArachneUser)1