Search in sources :

Example 6 with EventTag

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());
            }
        }
    }
}
Also used : EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag)

Example 7 with EventTag

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));
}
Also used : EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) SetProjectTagsResult(edu.stanford.bmir.protege.web.shared.tag.SetProjectTagsResult) Nonnull(javax.annotation.Nonnull)

Example 8 with 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);
}
Also used : UpdateEntityTagsResult(edu.stanford.bmir.protege.web.shared.tag.UpdateEntityTagsResult) EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) ProjectEvent(edu.stanford.bmir.protege.web.shared.event.ProjectEvent) Nonnull(javax.annotation.Nonnull)

Example 9 with EventTag

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);
}
Also used : edu.stanford.bmir.protege.web.shared.issues(edu.stanford.bmir.protege.web.shared.issues) ProjectEvent(edu.stanford.bmir.protege.web.shared.event.ProjectEvent) BuiltInAction(edu.stanford.bmir.protege.web.shared.access.BuiltInAction) EventList(edu.stanford.bmir.protege.web.shared.event.EventList) EventManager(edu.stanford.bmir.protege.web.server.events.EventManager) Inject(javax.inject.Inject) AbstractProjectActionHandler(edu.stanford.bmir.protege.web.server.dispatch.AbstractProjectActionHandler) AccessManager(edu.stanford.bmir.protege.web.server.access.AccessManager) SET_OBJECT_COMMENT_STATUS(edu.stanford.bmir.protege.web.shared.access.BuiltInAction.SET_OBJECT_COMMENT_STATUS) ExecutionContext(edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext) EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) Optional(java.util.Optional) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) ProjectEvent(edu.stanford.bmir.protege.web.shared.event.ProjectEvent) Nonnull(javax.annotation.Nonnull)

Example 10 with EventTag

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);
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId) EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) ProjectEvent(edu.stanford.bmir.protege.web.shared.event.ProjectEvent) Nonnull(javax.annotation.Nonnull)

Aggregations

EventTag (edu.stanford.bmir.protege.web.shared.event.EventTag)12 Nonnull (javax.annotation.Nonnull)10 ProjectEvent (edu.stanford.bmir.protege.web.shared.event.ProjectEvent)7 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)4 EventList (edu.stanford.bmir.protege.web.shared.event.EventList)3 AccessManager (edu.stanford.bmir.protege.web.server.access.AccessManager)2 AbstractProjectActionHandler (edu.stanford.bmir.protege.web.server.dispatch.AbstractProjectActionHandler)2 ExecutionContext (edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext)2 EventManager (edu.stanford.bmir.protege.web.server.events.EventManager)2 BuiltInAction (edu.stanford.bmir.protege.web.shared.access.BuiltInAction)2 edu.stanford.bmir.protege.web.shared.issues (edu.stanford.bmir.protege.web.shared.issues)2 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)2 Optional (java.util.Optional)2 Nullable (javax.annotation.Nullable)2 Inject (javax.inject.Inject)2 EDIT_OWN_OBJECT_COMMENT (edu.stanford.bmir.protege.web.shared.access.BuiltInAction.EDIT_OWN_OBJECT_COMMENT)1 SET_OBJECT_COMMENT_STATUS (edu.stanford.bmir.protege.web.shared.access.BuiltInAction.SET_OBJECT_COMMENT_STATUS)1 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)1 SetProjectTagsResult (edu.stanford.bmir.protege.web.shared.tag.SetProjectTagsResult)1 UpdateEntityTagsResult (edu.stanford.bmir.protege.web.shared.tag.UpdateEntityTagsResult)1