Skip to content

Commit

Permalink
added UpdateUiHistoryEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
soimugeo committed Oct 14, 2024
1 parent 5ce9011 commit d5cd67c
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void handleEvent(PackagedProjectChangeEvent event) {
ProjectEventsQueryResponse response = new ProjectEventsQueryResponse();
response.events = new EventList(EventTag.getFirst(), event.projectEvents(), EventTag.get(1));
simpMessagingTemplate.send("/topic/project-events/" + event.projectId().id(), new GenericMessage<>(objectMapper.writeValueAsBytes(response)));

} catch (Exception e) {
LOGGER.error("Error forwarding the events through websocket");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import edu.stanford.protege.webprotege.change.OntologyChangedEvent;
import edu.stanford.protege.webprotege.event.*;
import edu.stanford.protege.webprotege.frame.*;
import edu.stanford.protege.webprotege.gateway.websocket.config.events.ProjectLinearizationChangedEvent;
import edu.stanford.protege.webprotege.gateway.websocket.config.events.UpdateUiHistoryEvent;
import edu.stanford.protege.webprotege.hierarchy.EntityHierarchyChangedEvent;
import edu.stanford.protege.webprotege.issues.CommentPostedEvent;
import edu.stanford.protege.webprotege.issues.CommentUpdatedEvent;
Expand Down Expand Up @@ -314,7 +314,7 @@ public ObjectMapper objectMapper() {
OntologyBrowserTextChangedEvent.class,
PermissionsChangedEvent.class,
ProjectChangedEvent.class,
ProjectLinearizationChangedEvent.class,
UpdateUiHistoryEvent.class,
ProjectMovedToTrashEvent.class,
OntologyChangedEvent.class,
ProjectRemovedFromTrashEvent.class,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package edu.stanford.protege.webprotege.gateway.websocket.config.events;

import com.fasterxml.jackson.annotation.*;
import com.google.common.base.Objects;
import edu.stanford.protege.webprotege.common.*;

import java.util.Set;

@JsonTypeName(UpdateUiHistoryEvent.CHANNEL)
public record UpdateUiHistoryEvent(EventId eventId,
ProjectId projectId,
Set<String> affectedEntityIris) implements ProjectEvent {

@JsonCreator
public static UpdateUiHistoryEvent create(@JsonProperty("eventId") EventId eventId,
@JsonProperty("projectId") ProjectId projectId,
@JsonProperty("afectedEntityIris") Set<String> afectedEntityIris
) {
return new UpdateUiHistoryEvent(eventId, projectId, afectedEntityIris);
}

public static final String CHANNEL = "webprotege.events.projects.uiHistory.UpdateUiHistoryEvent";

@JsonProperty("projectId")
public ProjectId projectId() {
return this.projectId;
}

@Override
@JsonProperty("eventId")
public EventId eventId() {
return eventId;
}

@Override
@JsonProperty("afectedEntityIris")
public Set<String> affectedEntityIris() {
return affectedEntityIris;
}

@Override
public String getChannel() {
return CHANNEL;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UpdateUiHistoryEvent that = (UpdateUiHistoryEvent) o;
return Objects.equal(eventId, that.eventId) && Objects.equal(projectId, that.projectId) && Objects.equal(affectedEntityIris, that.affectedEntityIris);
}

@Override
public int hashCode() {
return Objects.hashCode(eventId, projectId, affectedEntityIris);
}

@Override
public String toString() {
return "UpdateUiHistoryEvent{" +
"eventId=" + eventId +
", projectId=" + projectId +
", subjects=" + affectedEntityIris +
'}';
}

}

0 comments on commit d5cd67c

Please sign in to comment.