use of com.odysseusinc.arachne.portal.model.Submission 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.model.Submission in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionInsightServiceImpl method extractCommentTopics.
private Set<CommentTopic> extractCommentTopics(SubmissionInsight insight) {
final Stream<CommentTopic> submissionFilesTopics = insight.getSubmissionInsightSubmissionFiles().stream().map(SubmissionInsightSubmissionFile::getCommentTopic);
final Submission submission = insight.getSubmission();
final Stream<CommentTopic> resultFileTopics = submission.getResultFiles().stream().map(ResultFile::getCommentTopic);
return Stream.concat(submissionFilesTopics, resultFileTopics).map(commentTopic -> {
commentTopic.setComments(new LinkedList<>());
return commentTopic;
}).collect(Collectors.toSet());
}
use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionInsightServiceImpl method deleteSubmissionInsight.
@Override
@PreAuthorize("hasPermission(#submissionId, 'Submission', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).EDIT_ANALYSIS)")
public void deleteSubmissionInsight(Long submissionId) throws NotExistException {
LOGGER.info(DELETING_INSIGHT_LOG, submissionId);
final Submission submission = submissionService.getSubmissionById(submissionId, EntityUtils.fromAttributePaths("submissionInsight", "resultFiles"));
throwNotExistExceptionIfNull(submission, submissionId);
throwNotExistExceptionIfNull(submission.getSubmissionInsight(), submissionId);
final List<ResultFile> resultFiles = submission.getResultFiles();
resultFiles.forEach(resultFile -> resultFile.setCommentTopic(null));
submissionResultFileRepository.save(resultFiles);
submissionInsightRepository.deleteBySubmissionId(submissionId);
}
use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionServiceImpl method getResultFiles.
@Override
public List<ArachneFileMeta> getResultFiles(IUser user, Long submissionId, ResultFileSearch resultFileSearch) throws PermissionDeniedException {
Submission submission = submissionRepository.findById(submissionId, EntityUtils.fromAttributePaths("dataSource", "dataSource.dataNode"));
checkSubmissionPermission(user, submission);
String resultFilesPath = contentStorageHelper.getResultFilesDir(submission, resultFileSearch.getPath());
QuerySpec querySpec = new QuerySpec();
querySpec.setName(resultFileSearch.getRealName());
querySpec.setPath(resultFilesPath);
return contentStorageService.searchFiles(querySpec);
}
use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.
the class BaseAnalysisController method getSubmissionGroups.
@ApiOperation("Get submission groups.")
@RequestMapping(value = "/api/v1/analysis-management/analyses/{analysisId}/submission-groups", method = GET)
public Page<SubmissionGroupDTO> getSubmissionGroups(@PathVariable("analysisId") Long id, @ModelAttribute SubmissionGroupSearch submissionGroupSearch) {
submissionGroupSearch.setAnalysisId(id);
return submissionService.getSubmissionGroups(submissionGroupSearch).map(sg -> {
SubmissionGroupDTO sgDTO = conversionService.convert(sg, SubmissionGroupDTO.class);
sgDTO.getSubmissions().forEach(sd -> {
Submission s = ((Submission) sd.getConversionSource());
sd.setAvailableActionList(submissionService.getSubmissionActions(s));
});
return sgDTO;
});
}
Aggregations