Search in sources :

Example 1 with SubmissionDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO in project ArachneCentralAPI by OHDSI.

the class SubmissionInsightToSubmissionInsightDTOConverter method convert.

@Override
public SubmissionInsightDTO convert(SubmissionInsight source) {
    final Submission submission = source.getSubmission();
    final SubmissionInsightDTO dto = new SubmissionInsightDTO();
    SubmissionDTO shortSubmissionDTO = new SubmissionDTO();
    shortSubmissionDTO.setId(submission.getId());
    shortSubmissionDTO.setCreatedAt(submission.getCreated());
    shortSubmissionDTO.setStatus(conversionService.convert(submission.getStatus(), SubmissionStatusDTO.class));
    shortSubmissionDTO.setAuthor(conversionService.convert(submission.getAuthor(), ShortUserDTO.class));
    dto.setCreated(source.getCreated());
    dto.setName(source.getName());
    dto.setDescription(source.getDescription());
    dto.setSubmission(shortSubmissionDTO);
    final List<Commentable> submissionFileDTOS = source.getSubmissionInsightSubmissionFiles().stream().map(submissionFile -> conversionService.convert(submissionFile, CommentableSubmissionFileDTO.class)).collect(Collectors.toList());
    dto.setCodeFiles(submissionFileDTOS);
    final List<Commentable> resultFileDTOS = submission.getResultFiles().stream().map(resultFile -> conversionService.convert(resultFile, CommentableResultFileDTO.class)).collect(Collectors.toList());
    dto.setResultFiles(resultFileDTOS);
    dto.setDataSource(conversionService.convert(submission.getDataSource(), DataSourceDTO.class));
    final AnalysisDTO analysisDTO = analysisConverter(source.getSubmission().getAnalysis());
    dto.setAnalysis(analysisDTO);
    dto.setCommentsCount(source.getCommentsCount());
    dto.setPermissions(conversionService.convert(source, PermissionsDTO.class));
    return dto;
}
Also used : SubmissionInsightDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO) AnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO) Autowired(org.springframework.beans.factory.annotation.Autowired) GenericConversionService(org.springframework.core.convert.support.GenericConversionService) CommentableSubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentableSubmissionFileDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) Submission(com.odysseusinc.arachne.portal.model.Submission) Collectors(java.util.stream.Collectors) SubmissionStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO) StudyShortDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO) List(java.util.List) Component(org.springframework.stereotype.Component) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) SubmissionInsightDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO) Analysis(com.odysseusinc.arachne.portal.model.Analysis) BaseConversionServiceAwareConverter(com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter) Commentable(com.odysseusinc.arachne.portal.api.v1.dto.Commentable) CommentableResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentableResultFileDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO) SubmissionInsight(com.odysseusinc.arachne.portal.model.SubmissionInsight) Study(com.odysseusinc.arachne.portal.model.Study) DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) Submission(com.odysseusinc.arachne.portal.model.Submission) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) Commentable(com.odysseusinc.arachne.portal.api.v1.dto.Commentable) AnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO) SubmissionStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)

Example 2 with SubmissionDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionController method approveSubmissionResult.

@ApiOperation("Approve submission results for show to owner")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/approveresult", method = POST)
public JsonResult<DTO> approveSubmissionResult(Principal principal, @PathVariable("submissionId") Long submissionId, @RequestBody @Valid ApproveDTO approveDTO) throws PermissionDeniedException, NotExistException {
    // ToDo remove after front will be changed
    approveDTO.setIsSuccess(true);
    Submission updatedSubmission = submissionService.approveSubmissionResult(submissionId, approveDTO, userService.getByEmail(principal.getName()));
    DTO submissionDTO = conversionService.convert(updatedSubmission, getSubmissionDTOClass());
    return new JsonResult<>(NO_ERROR, submissionDTO);
}
Also used : Submission(com.odysseusinc.arachne.portal.model.Submission) ResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO) FileDTO(com.odysseusinc.arachne.portal.api.v1.dto.FileDTO) BaseSubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionDTO) ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) SubmissionStatusHistoryElementDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO) UploadFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.UploadFileDTO) CommonAnalysisExecutionStatusDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisExecutionStatusDTO) CreateSubmissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateSubmissionsDTO) SubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO) BaseSubmissionAndAnalysisTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionAndAnalysisTypeDTO) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with SubmissionDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO in project ArachneCentralAPI by OHDSI.

the class SubmissionGroupToSubmissionGroupDTOConverter method convert.

@Override
public SubmissionGroupDTO convert(SubmissionGroup submissionGroup) {
    SubmissionGroupDTO dto = new SubmissionGroupDTO();
    dto.setId(submissionGroup.getId());
    dto.setCreated(submissionGroup.getCreated());
    if (conversionService.canConvert(Submission.class, SubmissionDTO.class)) {
        List<SubmissionDTO> submissions = submissionGroup.getSubmissions().stream().map(s -> conversionService.convert(s, SubmissionDTO.class)).collect(Collectors.toList());
        dto.setSubmissions(submissions);
    }
    dto.setQueryFilesCount(submissionGroup.getFiles().size());
    dto.setChecksum(submissionGroup.getChecksum());
    dto.setAnalysisType(submissionGroup.getAnalysisType());
    return dto;
}
Also used : SubmissionGroupDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionGroupDTO) List(java.util.List) Component(org.springframework.stereotype.Component) Map(java.util.Map) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO) Submission(com.odysseusinc.arachne.portal.model.Submission) SubmissionGroup(com.odysseusinc.arachne.portal.model.SubmissionGroup) Collectors(java.util.stream.Collectors) SubmissionGroupDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionGroupDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)

Aggregations

SubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)3 Submission (com.odysseusinc.arachne.portal.model.Submission)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Component (org.springframework.stereotype.Component)2 CommonAnalysisExecutionStatusDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisExecutionStatusDTO)1 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 AnalysisDTO (com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO)1 ApproveDTO (com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO)1 BaseSubmissionAndAnalysisTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionAndAnalysisTypeDTO)1 BaseSubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionDTO)1 Commentable (com.odysseusinc.arachne.portal.api.v1.dto.Commentable)1 CommentableResultFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.CommentableResultFileDTO)1 CommentableSubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.CommentableSubmissionFileDTO)1 CreateSubmissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateSubmissionsDTO)1 DataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO)1 FileDTO (com.odysseusinc.arachne.portal.api.v1.dto.FileDTO)1 PermissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO)1 ResultFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO)1 ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)1