use of edu.stanford.bmir.protege.web.shared.event.EventTag in project webprotege by protegeproject.
the class EventPollingManager method dispatchEvents.
public void dispatchEvents(EventList<?> eventList) {
if (eventList.isEmpty()) {
return;
}
GWT.log("[Event Polling Manager] Retrieved " + eventList.getEvents().size() + " events from server. From " + eventList.getStartTag() + " to " + eventList.getEndTag());
EventTag eventListStartTag = eventList.getStartTag();
if (!eventList.getStartTag().equals(eventList.getEndTag()) && nextTag.isGreaterOrEqualTo(eventListStartTag)) {
// We haven't missed any events - our next retrieval will be from where we got the event to.
nextTag = eventList.getEndTag();
GWT.log("[Event Polling Manager] Updated events. Next tag is " + nextTag);
}
if (!eventList.isEmpty()) {
GWT.log("[Event Polling Manager] Dispatching events from polling manager...");
for (WebProtegeEvent<?> event : eventList.getEvents()) {
GWT.log("[Event Polling Manager] Event: " + event.toString());
if (event.getSource() != null) {
eventBus.fireEventFromSource(event.asGWTEvent(), event.getSource());
} else {
eventBus.fireEvent(event.asGWTEvent());
}
}
}
}
use of edu.stanford.bmir.protege.web.shared.event.EventTag in project webprotege by protegeproject.
the class SetProjectTagsActionHandler method execute.
@Nonnull
@Override
public SetProjectTagsResult execute(@Nonnull SetProjectTagsAction action, @Nonnull ExecutionContext executionContext) {
EventTag eventTag = eventEventManager.getCurrentTag();
tagsManager.setProjectTags(action.getTagData());
return new SetProjectTagsResult(eventEventManager.getEventsFromTag(eventTag));
}
use of edu.stanford.bmir.protege.web.shared.event.EventTag in project webprotege by protegeproject.
the class UpdateEntityTagsActionHandler method execute.
@Nonnull
@Override
public UpdateEntityTagsResult execute(@Nonnull UpdateEntityTagsAction action, @Nonnull ExecutionContext executionContext) {
EventTag startTag = eventEventManager.getCurrentTag();
tagsManager.updateTags(action.getEntity(), action.getFromTagIds(), action.getToTagIds());
EventList<ProjectEvent<?>> events = eventEventManager.getEventsFromTag(startTag);
return new UpdateEntityTagsResult(events);
}
use of edu.stanford.bmir.protege.web.shared.event.EventTag in project webprotege by protegeproject.
the class SetDiscussionThreadStatusHandler method execute.
@Nonnull
@Override
public SetDiscussionThreadStatusResult execute(@Nonnull SetDiscussionThreadStatusAction action, @Nonnull ExecutionContext executionContext) {
EventTag fromTag = eventManager.getCurrentTag();
ThreadId threadId = action.getThreadId();
Status status = action.getStatus();
Optional<EntityDiscussionThread> thread = repository.setThreadStatus(threadId, status);
int openComments = thread.map(t -> repository.getOpenCommentsCount(projectId, t.getEntity())).orElse(-1);
eventManager.postEvent(new DiscussionThreadStatusChangedEvent(projectId, threadId, thread.map(EntityDiscussionThread::getEntity), openComments, status));
EventList<ProjectEvent<?>> eventList = eventManager.getEventsFromTag(fromTag);
return new SetDiscussionThreadStatusResult(threadId, status, eventList);
}
use of edu.stanford.bmir.protege.web.shared.event.EventTag in project webprotege by protegeproject.
the class AddEntityCommentHandler method execute.
@Nonnull
@Override
public AddEntityCommentResult execute(@Nonnull AddEntityCommentAction action, @Nonnull ExecutionContext executionContext) {
UserId createdBy = executionContext.getUserId();
long createdAt = System.currentTimeMillis();
CommentRenderer r = new CommentRenderer();
String rawComment = action.getComment();
String renderedComment = r.renderComment(rawComment);
Comment comment = new Comment(CommentId.create(), createdBy, createdAt, Optional.empty(), rawComment, renderedComment);
ThreadId threadId = action.getThreadId();
repository.addCommentToThread(threadId, comment);
EventTag startTag = eventManager.getCurrentTag();
postCommentPostedEvent(threadId, comment);
EventList<ProjectEvent<?>> eventList = eventManager.getEventsFromTag(startTag);
sendOutNotifications(threadId, comment);
return new AddEntityCommentResult(action.getProjectId(), threadId, comment, renderedComment, eventList);
}
Aggregations