From a263e4e195b0d6fa2570b8703ebb5f9567bbc50d Mon Sep 17 00:00:00 2001 From: silag Date: Wed, 17 Apr 2024 16:25:18 +0300 Subject: [PATCH] fixed serialization issues. --- pom.xml | 6 +++--- .../event/OntologyBrowserTextChangedEvent.java | 2 ++ .../protege/webprotege/hierarchy/EdgeChange.java | 16 +++++++++++++++- .../webprotege/hierarchy/GraphModelChange.java | 6 +++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index e492f54..31a7700 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ edu.stanford.protege webprotege-backend-api - 0.9.5-SNAPSHOT + 0.9.7 UTF-8 @@ -76,7 +76,7 @@ edu.stanford.protege webprotege-common - 0.9.4 + 0.9.5 @@ -106,7 +106,7 @@ edu.stanford.protege webprotege-ontology-change - 0.9.2 + 0.9.3-SNAPSHOT diff --git a/src/main/java/edu/stanford/protege/webprotege/event/OntologyBrowserTextChangedEvent.java b/src/main/java/edu/stanford/protege/webprotege/event/OntologyBrowserTextChangedEvent.java index f605ce5..b561124 100644 --- a/src/main/java/edu/stanford/protege/webprotege/event/OntologyBrowserTextChangedEvent.java +++ b/src/main/java/edu/stanford/protege/webprotege/event/OntologyBrowserTextChangedEvent.java @@ -1,5 +1,6 @@ package edu.stanford.protege.webprotege.event; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import edu.stanford.protege.webprotege.common.EventId; import edu.stanford.protege.webprotege.common.ProjectEvent; @@ -19,6 +20,7 @@ */ @JsonTypeName("webprotege.events.ontologies.OntologyBrowserTextChanged") +@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "type") public record OntologyBrowserTextChangedEvent(EventId eventId, ProjectId projectId, OWLOntologyID ontologyID, diff --git a/src/main/java/edu/stanford/protege/webprotege/hierarchy/EdgeChange.java b/src/main/java/edu/stanford/protege/webprotege/hierarchy/EdgeChange.java index 5829cfb..1f20c7b 100644 --- a/src/main/java/edu/stanford/protege/webprotege/hierarchy/EdgeChange.java +++ b/src/main/java/edu/stanford/protege/webprotege/hierarchy/EdgeChange.java @@ -1,5 +1,8 @@ package edu.stanford.protege.webprotege.hierarchy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; + import java.util.function.Consumer; /** @@ -7,18 +10,29 @@ * Stanford Center for Biomedical Informatics Research * 2021-04-20 */ +@JsonSubTypes({ + @JsonSubTypes.Type(AddEdge.class), + @JsonSubTypes.Type(RemoveEdge.class) +}) public abstract class EdgeChange extends GraphModelChange { - private final GraphEdge edge; + + private GraphEdge edge; + + protected EdgeChange() { + + } protected EdgeChange(GraphEdge edge) { this.edge = edge; } + @JsonIgnore public GraphNode getPredecessor() { return edge.getPredecessor(); } + @JsonIgnore public GraphNode getSuccessor() { return edge.getSuccessor(); } diff --git a/src/main/java/edu/stanford/protege/webprotege/hierarchy/GraphModelChange.java b/src/main/java/edu/stanford/protege/webprotege/hierarchy/GraphModelChange.java index e74c94d..cc29d40 100644 --- a/src/main/java/edu/stanford/protege/webprotege/hierarchy/GraphModelChange.java +++ b/src/main/java/edu/stanford/protege/webprotege/hierarchy/GraphModelChange.java @@ -12,12 +12,12 @@ * 2021-04-20 */ @JsonSubTypes({ - @Type(AddEdge.class), - @Type(RemoveEdge.class), + @Type(EdgeChange.class), @Type(AddRootNode.class), + @Type(UpdateUserObject.class), @Type(RemoveRootNode.class) }) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "changeType") +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public abstract class GraphModelChange { public GraphModelChange() {