use of org.guvnor.common.services.shared.metadata.model.DiscussionRecord in project kie-wb-common by kiegroup.
the class DiscussionWidgetPresenter method setContent.
public void setContent(Metadata metadata) {
view.clear();
this.metadata = metadata;
for (DiscussionRecord record : metadata.getDiscussion()) {
view.addRow(record);
}
view.scrollToBottom();
}
use of org.guvnor.common.services.shared.metadata.model.DiscussionRecord in project kie-wb-common by kiegroup.
the class DiscussionWidgetPresenterTest method testInit.
@Test
public void testInit() throws Exception {
Metadata metadata = new Metadata();
metadata.getDiscussion().add(new DiscussionRecord(1234, "Toni", "Knock Knock"));
metadata.getDiscussion().add(new DiscussionRecord(1235, "Michael", "Who is there?"));
metadata.getDiscussion().add(new DiscussionRecord(1236, "Toni", "Can't think of anything funny :("));
DiscussionWidgetPresenter presenter = new DiscussionWidgetPresenter(view, identity, appConfigService);
presenter.setContent(metadata);
ArgumentCaptor<DiscussionRecord> discussionRecordArgumentCaptor = ArgumentCaptor.forClass(DiscussionRecord.class);
verify(view, times(3)).addRow(discussionRecordArgumentCaptor.capture());
assertComment(discussionRecordArgumentCaptor.getAllValues().get(0), 1234, "Toni", "Knock Knock");
assertComment(discussionRecordArgumentCaptor.getAllValues().get(1), 1235, "Michael", "Who is there?");
assertComment(discussionRecordArgumentCaptor.getAllValues().get(2), 1236, "Toni", "Can't think of anything funny :(");
}
use of org.guvnor.common.services.shared.metadata.model.DiscussionRecord 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()));
}
}
}
}
use of org.guvnor.common.services.shared.metadata.model.DiscussionRecord in project kie-wb-common by kiegroup.
the class CommentLinePresenterTest method testVisualization.
@Test
public void testVisualization() {
CommentLineView view = mock(CommentLineView.class);
CommentLinePresenter presenter = new CommentLinePresenterWithNOGWTCode(view);
Date commentDate = new Date();
DiscussionRecord record = new DiscussionRecord(commentDate.getTime(), "test user", "test note");
presenter.setRecord(record);
verify(view, times(1)).setAuthor(eq(expectedAuthorFormat("test user")));
verify(view, times(1)).setComment(eq(expectedCommentFormat("test note")));
verify(view, times(1)).setDate(expectedDateFormat(commentDate.getTime()));
}
use of org.guvnor.common.services.shared.metadata.model.DiscussionRecord in project kie-wb-common by kiegroup.
the class DiscussionWidgetPresenter method onAddComment.
@Override
public void onAddComment(final String comment) {
if (comment != null && !comment.trim().isEmpty()) {
appConfigService.call(new RemoteCallback<Long>() {
@Override
public void callback(Long timestamp) {
DiscussionRecord record = new DiscussionRecord(timestamp, identity.getIdentifier(), comment);
metadata.getDiscussion().add(record);
view.addRow(record);
view.clearCommentBox();
view.scrollToBottom();
}
}).getTimestamp();
}
}
Aggregations