Search in sources :

Example 6 with Submission

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;
}
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 7 with Submission

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());
}
Also used : Arrays(java.util.Arrays) Date(java.util.Date) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResultFile(com.odysseusinc.arachne.portal.model.ResultFile) EntityGraphUtils(com.cosium.spring.data.jpa.entity.graph.domain.EntityGraphUtils) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) EXECUTED_PUBLISHED(com.odysseusinc.arachne.portal.model.SubmissionStatus.EXECUTED_PUBLISHED) Submission(com.odysseusinc.arachne.portal.model.Submission) FAILED_PUBLISHED(com.odysseusinc.arachne.portal.model.SubmissionStatus.FAILED_PUBLISHED) Map(java.util.Map) BigInteger(java.math.BigInteger) Pageable(org.springframework.data.domain.Pageable) Sort(org.springframework.data.domain.Sort) SubmissionInsight(com.odysseusinc.arachne.portal.model.SubmissionInsight) LinkedList(java.util.LinkedList) CommentService(com.odysseusinc.arachne.portal.service.CommentService) CommentTopic(com.odysseusinc.arachne.portal.model.CommentTopic) Logger(org.slf4j.Logger) AlreadyExistException(com.odysseusinc.arachne.portal.exception.AlreadyExistException) SubmissionResultFileRepository(com.odysseusinc.arachne.portal.repository.SubmissionResultFileRepository) Set(java.util.Set) PostAuthorize(org.springframework.security.access.prepost.PostAuthorize) SubmissionInsightSubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile) Page(org.springframework.data.domain.Page) Collectors(java.util.stream.Collectors) SubmissionInsightRepository(com.odysseusinc.arachne.portal.repository.SubmissionInsightRepository) SubmissionService(com.odysseusinc.arachne.portal.service.submission.SubmissionService) List(java.util.List) NotExistException(com.odysseusinc.arachne.portal.exception.NotExistException) EntityUtils(com.odysseusinc.arachne.portal.util.EntityUtils) Stream(java.util.stream.Stream) SubmissionInsightService(com.odysseusinc.arachne.portal.service.submission.SubmissionInsightService) SubmissionInsightSubmissionFileRepository(com.odysseusinc.arachne.portal.repository.SubmissionInsightSubmissionFileRepository) SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) Submission(com.odysseusinc.arachne.portal.model.Submission) SubmissionInsightSubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile) CommentTopic(com.odysseusinc.arachne.portal.model.CommentTopic) ResultFile(com.odysseusinc.arachne.portal.model.ResultFile) LinkedList(java.util.LinkedList)

Example 8 with Submission

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);
}
Also used : Submission(com.odysseusinc.arachne.portal.model.Submission) ResultFile(com.odysseusinc.arachne.portal.model.ResultFile) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 9 with Submission

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);
}
Also used : Submission(com.odysseusinc.arachne.portal.model.Submission) QuerySpec(com.odysseusinc.arachne.storage.model.QuerySpec)

Example 10 with Submission

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;
    });
}
Also used : SubmissionGroupDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionGroupDTO) Submission(com.odysseusinc.arachne.portal.model.Submission) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Submission (com.odysseusinc.arachne.portal.model.Submission)21 LinkedList (java.util.LinkedList)8 List (java.util.List)8 ResultFile (com.odysseusinc.arachne.portal.model.ResultFile)7 ApiOperation (io.swagger.annotations.ApiOperation)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 Analysis (com.odysseusinc.arachne.portal.model.Analysis)6 IUser (com.odysseusinc.arachne.portal.model.IUser)6 Collectors (java.util.stream.Collectors)6 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)5 SubmissionStatus (com.odysseusinc.arachne.portal.model.SubmissionStatus)5 Date (java.util.Date)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)4 ApproveDTO (com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO)4 SubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)4 SubmissionStatusHistoryElementDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO)4 SubmissionStatusHistoryElement (com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement)4 Path (java.nio.file.Path)4