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