use of com.odysseusinc.arachne.portal.model.CommentTopic 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.CommentTopic in project ArachneCentralAPI by OHDSI.
the class CommentServiceImpl method addComment.
@CacheEvict(cacheNames = "comments", allEntries = true)
@Override
@PreAuthorize("hasPermission(#topicId, 'CommentTopic', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).EDIT_INSIGHT)")
public Comment addComment(Long topicId, Long parentId, Comment comment) {
comment.setId(null);
comment.setDate(new Date());
final CommentTopic topic = commentTopicRepository.getOne(topicId);
comment.setTopic(topic);
if (parentId != null) {
final Comment parent = commentRepository.findOne(parentId);
comment.setParent(parent);
}
return commentRepository.save(comment);
}
use of com.odysseusinc.arachne.portal.model.CommentTopic in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionInsightServiceImpl method createSubmissionInsight.
@Override
@PreAuthorize("hasPermission(#submissionId, 'Submission', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).EDIT_ANALYSIS)")
public SubmissionInsight createSubmissionInsight(Long submissionId, SubmissionInsight insight) throws AlreadyExistException, NotExistException {
LOGGER.info(CREATING_INSIGHT_LOG, submissionId);
final SubmissionInsight submissionInsight = submissionInsightRepository.findOneBySubmissionId(submissionId);
if (submissionInsight != null) {
final String message = String.format(INSIGHT_ALREADY_EXISTS_EXCEPTION, submissionId);
throw new AlreadyExistException(message);
}
final List<SubmissionStatus> allowedStatuses = Arrays.asList(EXECUTED_PUBLISHED, FAILED_PUBLISHED);
final Submission submission = submissionService.getSubmissionByIdAndStatus(submissionId, allowedStatuses);
throwNotExistExceptionIfNull(submission, submissionId);
insight.setId(null);
insight.setCreated(new Date());
insight.setSubmission(submission);
final SubmissionInsight savedInsight = submissionInsightRepository.save(insight);
final List<SubmissionInsightSubmissionFile> submissionInsightSubmissionFiles = submission.getSubmissionGroup().getFiles().stream().map(sf -> new SubmissionInsightSubmissionFile(savedInsight, sf, new CommentTopic())).collect(Collectors.toList());
submissionInsightSubmissionFileRepository.save(submissionInsightSubmissionFiles);
final List<ResultFile> resultFiles = submission.getResultFiles();
resultFiles.forEach(resultFile -> resultFile.setCommentTopic(new CommentTopic()));
submissionResultFileRepository.save(resultFiles);
return savedInsight;
}
use of com.odysseusinc.arachne.portal.model.CommentTopic in project ArachneCentralAPI by OHDSI.
the class CommentTopicToCommentTopicDTOConverter method convert.
@Override
public CommentTopicDTO convert(CommentTopic source) {
final CommentTopicDTO commentTopicDTO = new CommentTopicDTO();
final List<CommentDTO> commentDTOS = source.getComments().stream().map(c -> conversionService.convert(c, CommentDTO.class)).collect(Collectors.toList());
commentTopicDTO.setId(source.getId());
commentTopicDTO.setComments(commentDTOS);
return commentTopicDTO;
}
Aggregations