Search in sources :

Example 1 with CommentAddedEvent

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);
}
Also used : CommentAddedEvent(org.kie.workbench.common.services.shared.discussion.CommentAddedEvent) SocialUser(org.ext.uberfire.social.activities.model.SocialUser) SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date)

Example 2 with CommentAddedEvent

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()));
            }
        }
    }
}
Also used : CommentAddedEvent(org.kie.workbench.common.services.shared.discussion.CommentAddedEvent) DiscussionRecord(org.guvnor.common.services.shared.metadata.model.DiscussionRecord)

Aggregations

CommentAddedEvent (org.kie.workbench.common.services.shared.discussion.CommentAddedEvent)2 Date (java.util.Date)1 SocialActivitiesEvent (org.ext.uberfire.social.activities.model.SocialActivitiesEvent)1 SocialUser (org.ext.uberfire.social.activities.model.SocialUser)1 DiscussionRecord (org.guvnor.common.services.shared.metadata.model.DiscussionRecord)1