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;
}
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);
}
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;
}
Aggregations