use of sonia.scm.search.Index in project scm-review-plugin by scm-manager.
the class CommentIndexer method handleEvent.
@Subscribe
public void handleEvent(CommentEvent event) {
Comment comment = event.getItem();
PullRequest pullRequest = event.getPullRequest();
Repository repository = event.getRepository();
if (event.getEventType() == HandlerEventType.CREATE || event.getEventType() == HandlerEventType.MODIFY) {
updateIndexedComment(repository, pullRequest, IndexedComment.transform(pullRequest.getId(), comment));
} else if (event.getEventType() == HandlerEventType.DELETE) {
Comment deletedComment = event.getOldItem();
searchEngine.forType(IndexedComment.class).update(index -> index.delete().byId(createCommentId(deletedComment.getId(), pullRequest.getId(), repository.getId())));
}
}
use of sonia.scm.search.Index in project scm-review-plugin by scm-manager.
the class CommentIndexer method handleEvent.
@Subscribe
public void handleEvent(ReplyEvent event) {
Reply comment = event.getItem();
PullRequest pullRequest = event.getPullRequest();
Repository repository = event.getRepository();
if (event.getEventType() == HandlerEventType.CREATE || event.getEventType() == HandlerEventType.MODIFY) {
updateIndexedComment(repository, pullRequest, IndexedComment.transform(pullRequest.getId(), comment));
} else if (event.getEventType() == HandlerEventType.DELETE) {
Reply deletedReply = event.getOldItem();
searchEngine.forType(IndexedComment.class).update(index -> index.delete().byId(createCommentId(deletedReply.getId(), pullRequest.getId(), repository.getId())));
}
}
Aggregations