use of org.kie.workbench.common.services.shared.discussion.CommentAddedEvent in project kie-wb-common by kiegroup.
the class DiscussionAddedEventAdapter method toSocial.
@Override
public SocialActivitiesEvent toSocial(Object object) {
CommentAddedEvent event = (CommentAddedEvent) object;
SocialUser socialUser = socialUserRepositoryAPI.findSocialUser(event.getUserName());
String additionalInfo = "commented";
return new SocialActivitiesEvent(socialUser, DiscussionEventTypes.COMMENT_ADDED.name(), new Date(event.getTimestamp())).withLink(event.getPath().getFileName(), event.getPath().toURI()).withAdicionalInfo(additionalInfo);
}
use of org.kie.workbench.common.services.shared.discussion.CommentAddedEvent in project kie-wb-common by kiegroup.
the class KieService method fireMetadataSocialEvents.
protected void fireMetadataSocialEvents(final Path path, final Metadata currentMetadata, final Metadata newMetadata) {
List<DiscussionRecord> newDiscussion = newMetadata != null ? newMetadata.getDiscussion() : null;
List<DiscussionRecord> currentDiscussion = currentMetadata != null ? currentMetadata.getDiscussion() : null;
if (newDiscussion != null && newDiscussion.size() > 0) {
for (DiscussionRecord newRecord : newDiscussion) {
if (newRecord != null && (currentDiscussion == null || !currentDiscussion.contains(newRecord))) {
commentAddedEvent.fire(new CommentAddedEvent(newRecord.getAuthor(), path, newRecord.getNote(), newRecord.getTimestamp()));
}
}
}
}
Aggregations