Search in sources :

Example 6 with SubmissionInsight

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

the class BaseAdminServiceImpl method deleteSubmissionInsight.

private void deleteSubmissionInsight(SB submission) {
    SubmissionInsight insight = submission.getSubmissionInsight();
    if (insight == null) {
        return;
    }
    List<SubmissionInsightSubmissionFile> submissionInsightSubmissionFiles = insight.getSubmissionInsightSubmissionFiles();
    for (SubmissionInsightSubmissionFile link : submissionInsightSubmissionFiles) {
        CommentTopic topic = link.getCommentTopic();
        List<Comment> comments = topic.getComments();
        commentService.deleteComments(comments);
        commentService.deleteTopic(topic);
    }
    submissionInsightService.deleteSubmissionInsightSubmissionFileLinks(submissionInsightSubmissionFiles);
    submissionInsightService.tryDeleteSubmissionInsight(insight.getId());
}
Also used : Comment(com.odysseusinc.arachne.portal.model.Comment) SubmissionInsightSubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile) CommentTopic(com.odysseusinc.arachne.portal.model.CommentTopic) SubmissionInsight(com.odysseusinc.arachne.portal.model.SubmissionInsight)

Example 7 with SubmissionInsight

use of com.odysseusinc.arachne.portal.model.SubmissionInsight 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 SubmissionInsight

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

the class BaseSubmissionInsightServiceImpl method getSubmissionInsight.

@Override
@PostAuthorize("@ArachnePermissionEvaluator.addPermissions(principal, returnObject )")
public SubmissionInsight getSubmissionInsight(Long submissionId) throws NotExistException {
    final SubmissionInsight insight = submissionInsightRepository.findOneBySubmissionId(submissionId);
    throwNotExistExceptionIfNull(insight, submissionId);
    return insight;
}
Also used : SubmissionInsight(com.odysseusinc.arachne.portal.model.SubmissionInsight) PostAuthorize(org.springframework.security.access.prepost.PostAuthorize)

Example 9 with SubmissionInsight

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

the class BaseSubmissionInsightServiceImpl method updateSubmissionInsight.

@Override
@PreAuthorize("hasPermission(#submissionId, 'Submission', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).EDIT_INSIGHT)")
public SubmissionInsight updateSubmissionInsight(Long submissionId, SubmissionInsight insight) throws NotExistException {
    LOGGER.info(UPDATING_INSIGHT_LOG, submissionId);
    final SubmissionInsight exist = submissionInsightRepository.findOneBySubmissionId(submissionId);
    throwNotExistExceptionIfNull(exist, submissionId);
    if (insight.getName() != null) {
        exist.setName(insight.getName());
    }
    if (insight.getDescription() != null) {
        exist.setDescription(insight.getDescription());
    }
    return submissionInsightRepository.save(exist);
}
Also used : SubmissionInsight(com.odysseusinc.arachne.portal.model.SubmissionInsight) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 10 with SubmissionInsight

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

the class BaseArachneSecureServiceImpl method getRolesByCommentTopic.

@Override
public List<ParticipantRole> getRolesByCommentTopic(ArachneUser user, CommentTopic topic) {
    SubmissionInsightSubmissionFile submissionInsightLink = submissionInsightSubmissionFileRepository.findByCommentTopic(topic);
    SubmissionInsight insight;
    if (submissionInsightLink == null) {
        ResultFile resultFile = resultFileRepository.findByCommentTopic(topic);
        insight = resultFile.getSubmission().getSubmissionInsight();
    } else {
        insight = submissionInsightLink.getSubmissionInsight();
    }
    return getRolesByInsight(user, insight);
}
Also used : SubmissionInsightSubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile) SubmissionInsight(com.odysseusinc.arachne.portal.model.SubmissionInsight) ResultFile(com.odysseusinc.arachne.portal.model.ResultFile)

Aggregations

SubmissionInsight (com.odysseusinc.arachne.portal.model.SubmissionInsight)12 SubmissionInsightDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO)5 CommentTopic (com.odysseusinc.arachne.portal.model.CommentTopic)5 SubmissionInsightSubmissionFile (com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile)4 ApiOperation (io.swagger.annotations.ApiOperation)4 Sort (org.springframework.data.domain.Sort)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)3 Commentable (com.odysseusinc.arachne.portal.api.v1.dto.Commentable)3 ResultFile (com.odysseusinc.arachne.portal.model.ResultFile)3 Submission (com.odysseusinc.arachne.portal.model.Submission)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Pageable (org.springframework.data.domain.Pageable)3 PostAuthorize (org.springframework.security.access.prepost.PostAuthorize)3 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)3 EntityGraphUtils (com.cosium.spring.data.jpa.entity.graph.domain.EntityGraphUtils)2 AlreadyExistException (com.odysseusinc.arachne.portal.exception.AlreadyExistException)2 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)2