diff --git a/client/src/main/java/io/lionweb/client/DeltaErrors.java b/client/src/main/java/io/lionweb/client/DeltaErrors.java new file mode 100644 index 000000000..cc5258020 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/DeltaErrors.java @@ -0,0 +1,12 @@ +package io.lionweb.client; + +public enum DeltaErrors { + invalidParticipation, + nodeAlreadyExists, + unknownNode, + unknownIndex, + indexNodeMismatch, + moveWithoutParent, + invalidMove, + undefinedReferenceTarget +} diff --git a/client/src/main/java/io/lionweb/client/delta/CommandSource.java b/client/src/main/java/io/lionweb/client/delta/CommandSource.java new file mode 100644 index 000000000..f83bda747 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/CommandSource.java @@ -0,0 +1,41 @@ +package io.lionweb.client.delta; + +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +public class CommandSource { + public final @NotNull String participationId; + public final @NotNull String commandId; + + public CommandSource(@NotNull String participationId, @NotNull String commandId) { + Objects.requireNonNull(participationId, "participationId should not be null"); + Objects.requireNonNull(commandId, "commandId should not be null"); + this.participationId = participationId; + this.commandId = commandId; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + CommandSource that = (CommandSource) o; + return Objects.equals(participationId, that.participationId) + && Objects.equals(commandId, that.commandId); + } + + @Override + public int hashCode() { + return Objects.hash(participationId, commandId); + } + + @Override + public String toString() { + return "CommandSource{" + + "participationId='" + + participationId + + '\'' + + ", commandId='" + + commandId + + '\'' + + '}'; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/DeltaChannel.java b/client/src/main/java/io/lionweb/client/delta/DeltaChannel.java new file mode 100644 index 000000000..dbc19a469 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/DeltaChannel.java @@ -0,0 +1,33 @@ +package io.lionweb.client.delta; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.client.delta.messages.DeltaCommandResponse; +import io.lionweb.client.delta.messages.DeltaQuery; +import io.lionweb.client.delta.messages.DeltaQueryResponse; + +/** + * The DeltaChannel must be a specific link between a Client and the Server. Different clients + * should use different DeltaChannels because the clientId must be determined from the channel. + */ +public interface DeltaChannel { + /** + * Queries initiated/requested by the client, with synchronous response by the repository. A query + * requests some information from the repository without changing the repository’s contents. The + * repository gathers all information needed to answer the query, and sends the information back. + * The repository might reply invalid queries with a failure message. We also use queries for + * managing participations. + */ + DeltaQueryResponse sendQuery(DeltaQuery query); + + /** + * Commands initiated/requested by the client, with synchronous response by the repository. A + * command requests some change to the repository. The repository quickly confirms having received + * the command, or rejects a failed command.[5] However, the repository processes the command + * asynchronously, and eventually broadcasts the effect(s) as event. + */ + DeltaCommandResponse sendCommand(DeltaCommand command); + + void registerEventReceiver(DeltaEventReceiver deltaEventReceiver); + + void unregisterEventReceiver(DeltaEventReceiver deltaEventReceiver); +} diff --git a/client/src/main/java/io/lionweb/client/delta/DeltaEventReceiver.java b/client/src/main/java/io/lionweb/client/delta/DeltaEventReceiver.java new file mode 100644 index 000000000..53c15a545 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/DeltaEventReceiver.java @@ -0,0 +1,8 @@ +package io.lionweb.client.delta; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +public interface DeltaEventReceiver { + + void receiveEvent(CommonDeltaEvent event); +} diff --git a/client/src/main/java/io/lionweb/client/delta/DeltaProtocolVersion.java b/client/src/main/java/io/lionweb/client/delta/DeltaProtocolVersion.java new file mode 100644 index 000000000..a6c6045c3 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/DeltaProtocolVersion.java @@ -0,0 +1,5 @@ +package io.lionweb.client.delta; + +public enum DeltaProtocolVersion { + v2025_1 +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/CommonDeltaEvent.java b/client/src/main/java/io/lionweb/client/delta/messages/CommonDeltaEvent.java new file mode 100644 index 000000000..849b0f709 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/CommonDeltaEvent.java @@ -0,0 +1,18 @@ +package io.lionweb.client.delta.messages; + +import io.lionweb.client.delta.CommandSource; +import java.util.LinkedList; +import java.util.List; + +public class CommonDeltaEvent extends DeltaEvent { + public final int sequenceNumber; + public final List originCommands = new LinkedList<>(); + + public CommonDeltaEvent(int sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } + + public void addSource(CommandSource source) { + originCommands.add(source); + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/DeltaCommand.java b/client/src/main/java/io/lionweb/client/delta/messages/DeltaCommand.java new file mode 100644 index 000000000..a3ae942cc --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/DeltaCommand.java @@ -0,0 +1,28 @@ +package io.lionweb.client.delta.messages; + +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +public class DeltaCommand { + public final @NotNull String commandId; + public final List protocolMessages = new LinkedList<>(); + + public DeltaCommand(@NotNull String commandId) { + Objects.requireNonNull(commandId, "commandId should not be null"); + this.commandId = commandId; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + DeltaCommand that = (DeltaCommand) o; + return Objects.equals(commandId, that.commandId); + } + + @Override + public int hashCode() { + return Objects.hashCode(commandId); + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/DeltaCommandResponse.java b/client/src/main/java/io/lionweb/client/delta/messages/DeltaCommandResponse.java new file mode 100644 index 000000000..6263ad522 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/DeltaCommandResponse.java @@ -0,0 +1,3 @@ +package io.lionweb.client.delta.messages; + +public class DeltaCommandResponse {} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/DeltaEvent.java b/client/src/main/java/io/lionweb/client/delta/messages/DeltaEvent.java new file mode 100644 index 000000000..38722f23c --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/DeltaEvent.java @@ -0,0 +1,8 @@ +package io.lionweb.client.delta.messages; + +import java.util.LinkedList; +import java.util.List; + +public abstract class DeltaEvent { + public final List protocolMessages = new LinkedList<>(); +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/DeltaQuery.java b/client/src/main/java/io/lionweb/client/delta/messages/DeltaQuery.java new file mode 100644 index 000000000..956eda6cd --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/DeltaQuery.java @@ -0,0 +1,14 @@ +package io.lionweb.client.delta.messages; + +import java.util.LinkedList; +import java.util.List; +import org.jetbrains.annotations.NotNull; + +public abstract class DeltaQuery { + public final @NotNull String queryId; + public final List protocolMessages = new LinkedList<>(); + + public DeltaQuery(@NotNull String queryId) { + this.queryId = queryId; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/DeltaQueryResponse.java b/client/src/main/java/io/lionweb/client/delta/messages/DeltaQueryResponse.java new file mode 100644 index 000000000..eed02462b --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/DeltaQueryResponse.java @@ -0,0 +1,17 @@ +package io.lionweb.client.delta.messages; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import org.jetbrains.annotations.NotNull; + +public class DeltaQueryResponse { + public final @NotNull String queryId; + public final List protocolMessages = new LinkedList<>(); + public final Map values = new HashMap<>(); + + public DeltaQueryResponse(@NotNull String queryId) { + this.queryId = queryId; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/ProtocolMessage.java b/client/src/main/java/io/lionweb/client/delta/messages/ProtocolMessage.java new file mode 100644 index 000000000..ee1bf6114 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/ProtocolMessage.java @@ -0,0 +1,3 @@ +package io.lionweb.client.delta.messages; + +public abstract class ProtocolMessage {} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/ChangeClassifier.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/ChangeClassifier.java new file mode 100644 index 000000000..af9a4ba52 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/ChangeClassifier.java @@ -0,0 +1,18 @@ +package io.lionweb.client.delta.messages.commands; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** Change classifier of node to newClassifier. */ +public class ChangeClassifier extends DeltaCommand { + + public final String node; + public final MetaPointer newClassifier; + + public ChangeClassifier(@NotNull String commandId, String node, MetaPointer newClassifier) { + super(commandId); + this.node = node; + this.newClassifier = newClassifier; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/CompositeCommand.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/CompositeCommand.java new file mode 100644 index 000000000..a1c6a31af --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/CompositeCommand.java @@ -0,0 +1,15 @@ +package io.lionweb.client.delta.messages.commands; + +import io.lionweb.client.delta.messages.DeltaCommand; +import java.util.List; +import org.jetbrains.annotations.NotNull; + +/** Groups several commands into a logical group. The parts are ordered. */ +public class CompositeCommand extends DeltaCommand { + public final List parts; + + public CompositeCommand(@NotNull String commandId, List parts) { + super(commandId); + this.parts = parts; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/AddAnnotation.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/AddAnnotation.java new file mode 100644 index 000000000..b2e9791f9 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/AddAnnotation.java @@ -0,0 +1,25 @@ +package io.lionweb.client.delta.messages.commands.annotations; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.SerializationChunk; +import org.jetbrains.annotations.NotNull; + +/** + * Add new node newAnnotation to parent's annotations at index. newAnnotation might be a single node + * or an arbitrary complex subtree. All nodes in that subtree MUST be new, i.e. their id MUST NOT + * exist in the repository. Nodes in that subtree MAY have references to already existing nodes, and + * already existing nodes MAY have references to nodes in that subtree. + */ +public final class AddAnnotation extends DeltaCommand { + public final String parent; + public final SerializationChunk newAnnotation; + public final int index; + + public AddAnnotation( + @NotNull String commandId, String parent, SerializationChunk newAnnotation, int index) { + super(commandId); + this.parent = parent; + this.newAnnotation = newAnnotation; + this.index = index; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/DeleteAnnotation.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/DeleteAnnotation.java new file mode 100644 index 000000000..cd5daebbd --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/DeleteAnnotation.java @@ -0,0 +1,23 @@ +package io.lionweb.client.delta.messages.commands.annotations; + +import io.lionweb.client.delta.messages.DeltaCommand; +import org.jetbrains.annotations.NotNull; + +/** + * Delete existing node deletedAnnotation from parent's annotations at index, and all its + * descendants (including annotation instances). Does NOT change references to any of the deleted + * nodes. + */ +public final class DeleteAnnotation extends DeltaCommand { + public final String node; + public final int index; + public final String deletedAnnotation; + + public DeleteAnnotation( + @NotNull String commandId, String node, int index, String deletedAnnotation) { + super(commandId); + this.node = node; + this.index = index; + this.deletedAnnotation = deletedAnnotation; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAndReplaceAnnotationFromOtherParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAndReplaceAnnotationFromOtherParent.java new file mode 100644 index 000000000..1ec4460c2 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAndReplaceAnnotationFromOtherParent.java @@ -0,0 +1,29 @@ +package io.lionweb.client.delta.messages.commands.annotations; + +import io.lionweb.client.delta.messages.DeltaCommand; +import org.jetbrains.annotations.NotNull; + +/** + * Move existing node movedAnnotation inside newParent's annotations at newIndex. Delete current + * node replacedAnnotation at newParent's annotations at newIndex, and all its descendants + * (including annotation instances). Does NOT change references to any of the deleted nodes + */ +public final class MoveAndReplaceAnnotationFromOtherParent extends DeltaCommand { + public final String newParent; + public final int newIndex; + public final String replacedAnnotation; + public final String movedAnnotation; + + public MoveAndReplaceAnnotationFromOtherParent( + @NotNull String commandId, + String newParent, + int newIndex, + String replacedAnnotation, + String movedAnnotation) { + super(commandId); + this.newParent = newParent; + this.newIndex = newIndex; + this.replacedAnnotation = replacedAnnotation; + this.movedAnnotation = movedAnnotation; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAndReplaceAnnotationInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAndReplaceAnnotationInSameParent.java new file mode 100644 index 000000000..7398f1666 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAndReplaceAnnotationInSameParent.java @@ -0,0 +1,23 @@ +package io.lionweb.client.delta.messages.commands.annotations; + +import io.lionweb.client.delta.messages.DeltaCommand; +import org.jetbrains.annotations.NotNull; + +/** + * Move existing node movedAnnotation within the same parent to newIndex. Delete current node + * replacedAnnotation at movedAnnotation's parent’s annotations at newIndex, and all its descendants + * (including annotation instances). Does NOT change references to any of the deleted nodes. + */ +public final class MoveAndReplaceAnnotationInSameParent extends DeltaCommand { + public final int newIndex; + public final String replacedAnnotation; + public final String movedAnnotation; + + public MoveAndReplaceAnnotationInSameParent( + @NotNull String commandId, int newIndex, String replacedAnnotation, String movedAnnotation) { + super(commandId); + this.newIndex = newIndex; + this.replacedAnnotation = replacedAnnotation; + this.movedAnnotation = movedAnnotation; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAnnotationFromOtherParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAnnotationFromOtherParent.java new file mode 100644 index 000000000..5c864c947 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAnnotationFromOtherParent.java @@ -0,0 +1,19 @@ +package io.lionweb.client.delta.messages.commands.annotations; + +import io.lionweb.client.delta.messages.DeltaCommand; +import org.jetbrains.annotations.NotNull; + +/** Move existing node movedAnnotation inside newParent's annotations at newIndex. */ +public final class MoveAnnotationFromOtherParent extends DeltaCommand { + public final String newParent; + public final int newIndex; + public final String movedAnnotation; + + public MoveAnnotationFromOtherParent( + @NotNull String commandId, String newParent, int newIndex, String movedAnnotation) { + super(commandId); + this.newParent = newParent; + this.newIndex = newIndex; + this.movedAnnotation = movedAnnotation; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAnnotationInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAnnotationInSameParent.java new file mode 100644 index 000000000..c8cc3cfa9 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/MoveAnnotationInSameParent.java @@ -0,0 +1,17 @@ +package io.lionweb.client.delta.messages.commands.annotations; + +import io.lionweb.client.delta.messages.DeltaCommand; +import org.jetbrains.annotations.NotNull; + +/** Move existing node movedAnnotation within the same parent to newIndex. */ +public final class MoveAnnotationInSameParent extends DeltaCommand { + public final int newIndex; + public final String movedAnnotation; + + public MoveAnnotationInSameParent( + @NotNull String commandId, int newIndex, String movedAnnotation) { + super(commandId); + this.newIndex = newIndex; + this.movedAnnotation = movedAnnotation; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/ReplaceAnnotation.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/ReplaceAnnotation.java new file mode 100644 index 000000000..f8a939fc5 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/annotations/ReplaceAnnotation.java @@ -0,0 +1,33 @@ +package io.lionweb.client.delta.messages.commands.annotations; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import io.lionweb.serialization.data.SerializationChunk; +import org.jetbrains.annotations.NotNull; + +/** + * Delete current node replacedAnnotation at parent's annotations at index, and all its descendants + * (including annotation instances). Does NOT change references to any of the deleted nodes. + */ +public final class ReplaceAnnotation extends DeltaCommand { + public final SerializationChunk newAnnotation; + public final String parent; + public final int index; + public final MetaPointer containment; + public final String replacedAnnotation; + + public ReplaceAnnotation( + @NotNull String commandId, + SerializationChunk newAnnotation, + String parent, + MetaPointer containment, + int index, + String replacedAnnotation) { + super(commandId); + this.newAnnotation = newAnnotation; + this.parent = parent; + this.containment = containment; + this.index = index; + this.replacedAnnotation = replacedAnnotation; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/AddChild.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/AddChild.java new file mode 100644 index 000000000..192076cd7 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/AddChild.java @@ -0,0 +1,32 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import io.lionweb.serialization.data.SerializationChunk; +import org.jetbrains.annotations.NotNull; + +/** + * Add new node newChild to parent in containment at index. newChild might be a single node or an + * arbitrary complex subtree. All nodes in that subtree MUST be new, i.e. their id MUST NOT exist in + * the repository. Nodes in that subtree MAY have references to already existing nodes, and already + * existing nodes MAY have references to nodes in that subtree. + */ +public final class AddChild extends DeltaCommand { + public final String parent; + public final SerializationChunk newChild; + public final MetaPointer containment; + public final int index; + + public AddChild( + @NotNull String commandId, + String parent, + SerializationChunk newChild, + MetaPointer containment, + int index) { + super(commandId); + this.parent = parent; + this.newChild = newChild; + this.containment = containment; + this.index = index; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/DeleteChild.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/DeleteChild.java new file mode 100644 index 000000000..8cae2d401 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/DeleteChild.java @@ -0,0 +1,29 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** + * Delete existing node deletedChild from parent's containment at index, and all its descendants + * (including annotation instances). Does NOT change references to any of the deleted nodes. + */ +public final class DeleteChild extends DeltaCommand { + public final String parent; + public final MetaPointer containment; + public final int index; + public final String deletedChild; + + public DeleteChild( + @NotNull String commandId, + String parent, + MetaPointer containment, + int index, + String deletedChild) { + super(commandId); + this.parent = parent; + this.containment = containment; + this.index = index; + this.deletedChild = deletedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildFromOtherContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildFromOtherContainment.java new file mode 100644 index 000000000..b5529ab0b --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildFromOtherContainment.java @@ -0,0 +1,32 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; + +/** + * Move existing node movedChild inside newParent's newContainment at newIndex. Delete current child + * replacedChild inside newParent's newContainment at newIndex, and all its descendants (including + * annotation instances). Does NOT change references to any of the deleted nodes. + */ +public final class MoveAndReplaceChildFromOtherContainment extends DeltaCommand { + public final String newParent; + public final MetaPointer newContainment; + public final int newIndex; + public final String replacedChild; + public final String movedChild; + + public MoveAndReplaceChildFromOtherContainment( + String commandId, + String newParent, + MetaPointer newContainment, + int newIndex, + String replacedChild, + String movedChild) { + super(commandId); + this.newParent = newParent; + this.newContainment = newContainment; + this.newIndex = newIndex; + this.replacedChild = replacedChild; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildFromOtherContainmentInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildFromOtherContainmentInSameParent.java new file mode 100644 index 000000000..1639cf128 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildFromOtherContainmentInSameParent.java @@ -0,0 +1,31 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; + +/** + * Move existing node movedChild (currently inside one of movedChild's parent’s containments other + * than newContainment) inside movedChild's parent’s newContainment at newIndex. Delete current + * child replacedChild inside movedChild's parent’s newContainment at newIndex, and all its + * descendants (including annotation instances). Does NOT change references to any of the deleted + * nodes. + */ +public final class MoveAndReplaceChildFromOtherContainmentInSameParent extends DeltaCommand { + public final MetaPointer newContainment; + public final int newIndex; + public final String replacedChild; + public final String movedChild; + + public MoveAndReplaceChildFromOtherContainmentInSameParent( + String commandId, + MetaPointer newContainment, + int newIndex, + String replacedChild, + String movedChild) { + super(commandId); + this.newContainment = newContainment; + this.newIndex = newIndex; + this.replacedChild = replacedChild; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildInSameContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildInSameContainment.java new file mode 100644 index 000000000..4859ea275 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveAndReplaceChildInSameContainment.java @@ -0,0 +1,22 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; + +/** + * Move existing node movedChild within its current containment to newIndex. Delete current child + * replacedChild inside the same containment at newIndex, and all its descendants (including + * annotation instances). Does NOT change references to any of the deleted nodes + */ +public final class MoveAndReplaceChildInSameContainment extends DeltaCommand { + public final int newIndex; + public final String replacedChild; + public final String movedChild; + + public MoveAndReplaceChildInSameContainment( + String commandId, int newIndex, String replacedChild, String movedChild) { + super(commandId); + this.newIndex = newIndex; + this.replacedChild = replacedChild; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildFromOtherContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildFromOtherContainment.java new file mode 100644 index 000000000..71e599099 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildFromOtherContainment.java @@ -0,0 +1,25 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; + +/** Move existing node movedChild inside newParent's newContainment at newIndex. */ +public final class MoveChildFromOtherContainment extends DeltaCommand { + public final String newParent; + public final MetaPointer newContainment; + public final int newIndex; + public final String movedChild; + + public MoveChildFromOtherContainment( + String commandId, + String newParent, + MetaPointer newContainment, + int newIndex, + String movedChild) { + super(commandId); + this.newParent = newParent; + this.newContainment = newContainment; + this.newIndex = newIndex; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildFromOtherContainmentInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildFromOtherContainmentInSameParent.java new file mode 100644 index 000000000..4244b3b04 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildFromOtherContainmentInSameParent.java @@ -0,0 +1,22 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; + +/** + * Move existing node movedChild (currently inside one of movedChild's parent’s containments other + * than newContainment) inside movedChild's parent’s newContainment at newIndex. + */ +public final class MoveChildFromOtherContainmentInSameParent extends DeltaCommand { + public final MetaPointer newContainment; + public final int newIndex; + public final String movedChild; + + public MoveChildFromOtherContainmentInSameParent( + String commandId, MetaPointer newContainment, int newIndex, String movedChild) { + super(commandId); + this.newContainment = newContainment; + this.newIndex = newIndex; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildInSameContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildInSameContainment.java new file mode 100644 index 000000000..5d7b778a7 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/MoveChildInSameContainment.java @@ -0,0 +1,15 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; + +/** Move existing node movedChild within its current containment to newIndex. */ +public final class MoveChildInSameContainment extends DeltaCommand { + public final int newIndex; + public final String movedChild; + + public MoveChildInSameContainment(String commandId, int newIndex, String movedChild) { + super(commandId); + this.newIndex = newIndex; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/children/ReplaceChild.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/ReplaceChild.java new file mode 100644 index 000000000..fa57850f6 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/children/ReplaceChild.java @@ -0,0 +1,33 @@ +package io.lionweb.client.delta.messages.commands.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import io.lionweb.serialization.data.SerializationChunk; +import org.jetbrains.annotations.NotNull; + +/** + * Delete current child replacedChild inside parent's containment at index, and all its descendants + * (including annotation instances). Does NOT change references to any of the deleted nodes + */ +public final class ReplaceChild extends DeltaCommand { + public final SerializationChunk newChild; + public final String parent; + public final MetaPointer containment; + public final int index; + public final String replacedChild; + + public ReplaceChild( + @NotNull String commandId, + SerializationChunk newChild, + String parent, + MetaPointer containment, + int index, + String replacedChild) { + super(commandId); + this.newChild = newChild; + this.parent = parent; + this.containment = containment; + this.index = index; + this.replacedChild = replacedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/partitions/AddPartition.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/partitions/AddPartition.java new file mode 100644 index 000000000..681da80cb --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/partitions/AddPartition.java @@ -0,0 +1,13 @@ +package io.lionweb.client.delta.messages.commands.partitions; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.SerializationChunk; + +public final class AddPartition extends DeltaCommand { + public final SerializationChunk newPartition; + + public AddPartition(String commandId, SerializationChunk newPartition) { + super(commandId); + this.newPartition = newPartition; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/partitions/DeletePartition.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/partitions/DeletePartition.java new file mode 100644 index 000000000..c86470e24 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/partitions/DeletePartition.java @@ -0,0 +1,12 @@ +package io.lionweb.client.delta.messages.commands.partitions; + +import io.lionweb.client.delta.messages.DeltaCommand; + +public final class DeletePartition extends DeltaCommand { + public final String deletedPartition; + + public DeletePartition(String commandId, String deletedPartition) { + super(commandId); + this.deletedPartition = deletedPartition; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/AddProperty.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/AddProperty.java new file mode 100644 index 000000000..76d0e7222 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/AddProperty.java @@ -0,0 +1,54 @@ +package io.lionweb.client.delta.messages.commands.properties; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import java.util.Objects; +import org.jetbrains.annotations.Nullable; + +public final class AddProperty extends DeltaCommand { + public final String node; + public final MetaPointer property; + public final @Nullable String newValue; + + public AddProperty( + String commandId, String node, MetaPointer property, @Nullable String newValue) { + super(commandId); + this.node = node; + this.property = property; + this.newValue = newValue; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + AddProperty that = (AddProperty) o; + return Objects.equals(commandId, that.commandId) + && Objects.equals(node, that.node) + && Objects.equals(property, that.property) + && Objects.equals(newValue, that.newValue); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, node, property, newValue); + } + + @Override + public String toString() { + return "AddProperty{" + + "node='" + + node + + '\'' + + ", property=" + + property + + ", newValue='" + + newValue + + '\'' + + ", commandId='" + + commandId + + '\'' + + ", protocolMessages=" + + protocolMessages + + '}'; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/ChangeProperty.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/ChangeProperty.java new file mode 100644 index 000000000..46a8c34c0 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/ChangeProperty.java @@ -0,0 +1,54 @@ +package io.lionweb.client.delta.messages.commands.properties; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import java.util.Objects; +import org.jetbrains.annotations.Nullable; + +public final class ChangeProperty extends DeltaCommand { + public final String node; + public final MetaPointer property; + public final @Nullable String newValue; + + public ChangeProperty( + String commandId, String node, MetaPointer property, @Nullable String newValue) { + super(commandId); + this.node = node; + this.property = property; + this.newValue = newValue; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + ChangeProperty that = (ChangeProperty) o; + return Objects.equals(commandId, that.commandId) + && Objects.equals(node, that.node) + && Objects.equals(property, that.property) + && Objects.equals(newValue, that.newValue); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, node, property, newValue); + } + + @Override + public String toString() { + return "ChangeProperty{" + + "node='" + + node + + '\'' + + ", property=" + + property + + ", newValue='" + + newValue + + '\'' + + ", commandId='" + + commandId + + '\'' + + ", protocolMessages=" + + protocolMessages + + '}'; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/DeleteProperty.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/DeleteProperty.java new file mode 100644 index 000000000..0971b6a1f --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/properties/DeleteProperty.java @@ -0,0 +1,15 @@ +package io.lionweb.client.delta.messages.commands.properties; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; + +public final class DeleteProperty extends DeltaCommand { + public final String node; + public final MetaPointer property; + + public DeleteProperty(String commandId, String node, MetaPointer property) { + super(commandId); + this.node = node; + this.property = property; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReference.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReference.java new file mode 100644 index 000000000..751b21ec1 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReference.java @@ -0,0 +1,30 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** Add newTarget / newResolveInfo to parent's reference at index. */ +public final class AddReference extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final @Nullable String newTarget; + public final @Nullable String newResolveInfo; + + public AddReference( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + @Nullable String newTarget, + @Nullable String newResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newTarget = newTarget; + this.newResolveInfo = newResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReferenceResolveInfo.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReferenceResolveInfo.java new file mode 100644 index 000000000..0a623fd8c --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReferenceResolveInfo.java @@ -0,0 +1,26 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** Add newResolveInfo as ResolveInfo to existing entry inside parent's reference at index. */ +public final class AddReferenceResolveInfo extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String newResolveInfo; + + public AddReferenceResolveInfo( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + String newResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newResolveInfo = newResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReferenceTarget.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReferenceTarget.java new file mode 100644 index 000000000..bb9a0598e --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/AddReferenceTarget.java @@ -0,0 +1,26 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** Add newTarget as target to existing entry inside parent's reference at index. */ +public final class AddReferenceTarget extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String newTarget; + + public AddReferenceTarget( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + String newTarget) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newTarget = newTarget; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReference.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReference.java new file mode 100644 index 000000000..25012dbc6 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReference.java @@ -0,0 +1,39 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Replace existing entry oldTarget/oldResolveInfo inside parent's reference at index with + * newTarget/newResolveInfo. + */ +public final class ChangeReference extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final @Nullable String oldTarget; + public final @Nullable String oldResolveInfo; + public final @Nullable String newTarget; + public final @Nullable String newResolveInfo; + + public ChangeReference( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + @Nullable String oldTarget, + @Nullable String oldResolveInfo, + @Nullable String newTarget, + @Nullable String newResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.oldTarget = oldTarget; + this.oldResolveInfo = oldResolveInfo; + this.newTarget = newTarget; + this.newResolveInfo = newResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReferenceResolveInfo.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReferenceResolveInfo.java new file mode 100644 index 000000000..37b59a02e --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReferenceResolveInfo.java @@ -0,0 +1,29 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** Change oldResolveInfo of existing entry inside parent's reference at index to newResolveInfo. */ +public final class ChangeReferenceResolveInfo extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String oldResolveInfo; + public final String newResolveInfo; + + public ChangeReferenceResolveInfo( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + String oldResolveInfo, + String newResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.oldResolveInfo = oldResolveInfo; + this.newResolveInfo = newResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReferenceTarget.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReferenceTarget.java new file mode 100644 index 000000000..5f1edb04d --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/ChangeReferenceTarget.java @@ -0,0 +1,29 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** Change oldTarget of existing entry inside parent's reference at index to newTarget. */ +public final class ChangeReferenceTarget extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String oldTarget; + public final String newTarget; + + public ChangeReferenceTarget( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + String oldTarget, + String newTarget) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.oldTarget = oldTarget; + this.newTarget = newTarget; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReference.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReference.java new file mode 100644 index 000000000..2146d1abf --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReference.java @@ -0,0 +1,30 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** Delete existing entry deletedTarget/deletedResolveInfo from parent's reference at index. */ +public final class DeleteReference extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final @Nullable String deletedTarget; + public final @Nullable String deletedResolveInfo; + + public DeleteReference( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + @Nullable String deletedTarget, + @Nullable String deletedResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.deletedTarget = deletedTarget; + this.deletedResolveInfo = deletedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReferenceResolveInfo.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReferenceResolveInfo.java new file mode 100644 index 000000000..c41d97a3b --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReferenceResolveInfo.java @@ -0,0 +1,26 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** Delete existing deletedResolveInfo from existing entry inside parent's reference at index. */ +public final class DeleteReferenceResolveInfo extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String deletedResolveInfo; + + public DeleteReferenceResolveInfo( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + String deletedResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.deletedResolveInfo = deletedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReferenceTarget.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReferenceTarget.java new file mode 100644 index 000000000..41ae21166 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/DeleteReferenceTarget.java @@ -0,0 +1,26 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; + +/** Delete existing deletedTarget from existing entry inside parent's reference at index. */ +public final class DeleteReferenceTarget extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String deletedTarget; + + public DeleteReferenceTarget( + @NotNull String commandId, + String parent, + MetaPointer reference, + int index, + String deletedTarget) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.index = index; + this.deletedTarget = deletedTarget; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryFromOtherReference.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryFromOtherReference.java new file mode 100644 index 000000000..aaae1b74a --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryFromOtherReference.java @@ -0,0 +1,49 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Move existing entry movedTarget/movedResolveInfo inside oldParent's oldReference at oldIndex to + * newParent's newReference at newIndex, replacing existing entry replacedTarget/replacedResolveInfo + * in newParent's newReference at newIndex. + */ +public final class MoveAndReplaceEntryFromOtherReference extends DeltaCommand { + public final String newParent; + public final MetaPointer newReference; + public final int newIndex; + public final @Nullable String replacedTarget; + public final @Nullable String replacedResolveInfo; + public final String oldParent; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public MoveAndReplaceEntryFromOtherReference( + @NotNull String commandId, + String newParent, + MetaPointer newReference, + int newIndex, + @Nullable String replacedTarget, + @Nullable String replacedResolveInfo, + String oldParent, + MetaPointer oldReference, + int oldIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(commandId); + this.newParent = newParent; + this.newReference = newReference; + this.newIndex = newIndex; + this.replacedTarget = replacedTarget; + this.replacedResolveInfo = replacedResolveInfo; + this.oldParent = oldParent; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryFromOtherReferenceInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryFromOtherReferenceInSameParent.java new file mode 100644 index 000000000..b3f0086d6 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryFromOtherReferenceInSameParent.java @@ -0,0 +1,46 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Move existing entry movedTarget/movedResolveInfo inside parent's oldReference at oldIndex to + * parent's newReference at newIndex, replacing existing entry + * replacedTarget/replacedResolveInfo[32] in parent's newReference at newIndex. + */ +public final class MoveAndReplaceEntryFromOtherReferenceInSameParent extends DeltaCommand { + public final String parent; + public final MetaPointer newReference; + public final int newIndex; + public final @Nullable String replacedTarget; + public final @Nullable String replacedResolveInfo; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public MoveAndReplaceEntryFromOtherReferenceInSameParent( + @NotNull String commandId, + String parent, + MetaPointer newReference, + int newIndex, + @Nullable String replacedTarget, + @Nullable String replacedResolveInfo, + MetaPointer oldReference, + int oldIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(commandId); + this.parent = parent; + this.newReference = newReference; + this.newIndex = newIndex; + this.replacedTarget = replacedTarget; + this.replacedResolveInfo = replacedResolveInfo; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryInSameReference.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryInSameReference.java new file mode 100644 index 000000000..517b49a65 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveAndReplaceEntryInSameReference.java @@ -0,0 +1,43 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Move existing entry movedTarget/movedResolveInfo[32] inside parent's reference at oldIndex inside + * parent's reference at newIndex, replacing existing entry replacedTarget/replacedResolveInfo[32] + * in parent's reference at newIndex. + */ +public final class MoveAndReplaceEntryInSameReference extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int oldIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + public final int newIndex; + public final @Nullable String replacedTarget; + public final @Nullable String replacedResolveInfo; + + public MoveAndReplaceEntryInSameReference( + @NotNull String commandId, + String parent, + MetaPointer reference, + int oldIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo, + int newIndex, + @Nullable String replacedTarget, + @Nullable String replacedResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.oldIndex = oldIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + this.newIndex = newIndex; + this.replacedTarget = replacedTarget; + this.replacedResolveInfo = replacedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryFromOtherReference.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryFromOtherReference.java new file mode 100644 index 000000000..b95573d4b --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryFromOtherReference.java @@ -0,0 +1,42 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Move existing entry movedTarget/movedResolveInfo inside oldParent's oldReference at oldIndex to + * newParent's newReference at newIndex. + */ +public final class MoveEntryFromOtherReference extends DeltaCommand { + public final String newParent; + public final MetaPointer newReference; + public final int newIndex; + public final @NotNull String oldParent; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public MoveEntryFromOtherReference( + @NotNull String commandId, + String newParent, + MetaPointer newReference, + int newIndex, + @NotNull String oldParent, + MetaPointer oldReference, + int oldIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(commandId); + this.newParent = newParent; + this.newReference = newReference; + this.newIndex = newIndex; + this.oldParent = oldParent; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryFromOtherReferenceInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryFromOtherReferenceInSameParent.java new file mode 100644 index 000000000..9a4c8e581 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryFromOtherReferenceInSameParent.java @@ -0,0 +1,39 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Move existing entry movedTarget/movedResolveInfo inside parent's oldReference at oldIndex to + * parent's newReference at newIndex. + */ +public final class MoveEntryFromOtherReferenceInSameParent extends DeltaCommand { + public final String parent; + public final MetaPointer newReference; + public final int newIndex; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public MoveEntryFromOtherReferenceInSameParent( + @NotNull String commandId, + String parent, + MetaPointer newReference, + int newIndex, + MetaPointer oldReference, + int oldIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(commandId); + this.parent = parent; + this.newReference = newReference; + this.newIndex = newIndex; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryInSameReference.java b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryInSameReference.java new file mode 100644 index 000000000..257910afb --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/commands/references/MoveEntryInSameReference.java @@ -0,0 +1,36 @@ +package io.lionweb.client.delta.messages.commands.references; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Move existing entry movedTarget/movedResolveInfo inside parent's reference at oldIndex inside + * parent's reference at newIndex. + */ +public final class MoveEntryInSameReference extends DeltaCommand { + public final String parent; + public final MetaPointer reference; + public final int oldIndex; + public final int newIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public MoveEntryInSameReference( + @NotNull String commandId, + String parent, + MetaPointer reference, + int oldIndex, + int newIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(commandId); + this.parent = parent; + this.reference = reference; + this.oldIndex = oldIndex; + this.newIndex = newIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/ClassifierChanged.java b/client/src/main/java/io/lionweb/client/delta/messages/events/ClassifierChanged.java new file mode 100644 index 000000000..5debd16da --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/ClassifierChanged.java @@ -0,0 +1,18 @@ +package io.lionweb.client.delta.messages.events; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public class ClassifierChanged extends CommonDeltaEvent { + public String node; + public MetaPointer newClassifier; + public MetaPointer oldClassifier; + + public ClassifierChanged( + int sequenceNumber, String node, MetaPointer newClassifier, MetaPointer oldClassifier) { + super(sequenceNumber); + this.node = node; + this.newClassifier = newClassifier; + this.oldClassifier = oldClassifier; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/CompositeEvent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/CompositeEvent.java new file mode 100644 index 000000000..2f6bb78ed --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/CompositeEvent.java @@ -0,0 +1,13 @@ +package io.lionweb.client.delta.messages.events; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.client.delta.messages.DeltaEvent; +import java.util.List; + +public class CompositeEvent extends DeltaEvent { + public List parts; + + public CompositeEvent(List parts) { + this.parts = parts; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/ErrorEvent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/ErrorEvent.java new file mode 100644 index 000000000..50ac225c7 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/ErrorEvent.java @@ -0,0 +1,14 @@ +package io.lionweb.client.delta.messages.events; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +public class ErrorEvent extends CommonDeltaEvent { + public String errorCode; + public String message; + + public ErrorEvent(int sequenceNumber, String errorCode, String message) { + super(sequenceNumber); + this.errorCode = errorCode; + this.message = message; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/NoOp.java b/client/src/main/java/io/lionweb/client/delta/messages/events/NoOp.java new file mode 100644 index 000000000..0342eec20 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/NoOp.java @@ -0,0 +1,10 @@ +package io.lionweb.client.delta.messages.events; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +public class NoOp extends CommonDeltaEvent { + + public NoOp(int sequenceNumber) { + super(sequenceNumber); + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationAdded.java b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationAdded.java new file mode 100644 index 000000000..2f5bf2dc7 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationAdded.java @@ -0,0 +1,19 @@ +package io.lionweb.client.delta.messages.events.annotations; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.SerializationChunk; + +/** New node newAnnotation has been added to parent's annotations at index. */ +public class AnnotationAdded extends CommonDeltaEvent { + public final String parent; + public final SerializationChunk newAnnotation; + public final int index; + + public AnnotationAdded( + int sequenceNumber, String parent, SerializationChunk newAnnotation, int index) { + super(sequenceNumber); + this.parent = parent; + this.newAnnotation = newAnnotation; + this.index = index; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationDeleted.java b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationDeleted.java new file mode 100644 index 000000000..508fa07a0 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationDeleted.java @@ -0,0 +1,27 @@ +package io.lionweb.client.delta.messages.events.annotations; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +/** + * Existing node deletedAnnotation, and all its deletedDescendants, have been deleted from parent's + * annotations at index. + */ +public class AnnotationDeleted extends CommonDeltaEvent { + public final String deletedAnnotation; + public final String[] deletedDescendants; + public final String parent; + public final int index; + + public AnnotationDeleted( + int sequenceNumber, + String deletedAnnotation, + String[] deletedDescendants, + String parent, + int index) { + super(sequenceNumber); + this.deletedAnnotation = deletedAnnotation; + this.deletedDescendants = deletedDescendants; + this.parent = parent; + this.index = index; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedAndReplacedFromOtherParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedAndReplacedFromOtherParent.java new file mode 100644 index 000000000..f241570d1 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedAndReplacedFromOtherParent.java @@ -0,0 +1,36 @@ +package io.lionweb.client.delta.messages.events.annotations; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +/** + * Existing node movedAnnotation (previously inside oldParent's annotations at oldIndex) has + * replaced the existing replacedAnnotation inside newParent's annotations at newIndex. + */ +public class AnnotationMovedAndReplacedFromOtherParent extends CommonDeltaEvent { + public final String newParent; + public final int newIndex; + public final String movedAnnotation; + public final String oldParent; + public final int oldIndex; + public final String replacedAnnotation; + public final String[] replacedDescendants; + + public AnnotationMovedAndReplacedFromOtherParent( + int sequenceNumber, + String newParent, + int newIndex, + String movedAnnotation, + String oldParent, + int oldIndex, + String replacedAnnotation, + String[] replacedDescendants) { + super(sequenceNumber); + this.newParent = newParent; + this.newIndex = newIndex; + this.movedAnnotation = movedAnnotation; + this.oldParent = oldParent; + this.oldIndex = oldIndex; + this.replacedAnnotation = replacedAnnotation; + this.replacedDescendants = replacedDescendants; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedAndReplacedInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedAndReplacedInSameParent.java new file mode 100644 index 000000000..a6fa5ef62 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedAndReplacedInSameParent.java @@ -0,0 +1,33 @@ +package io.lionweb.client.delta.messages.events.annotations; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +/** + * Existing node movedAnnotation (previously inside parent's annotations at oldIndex) has replaced + * the existing replacedAnnotation inside parent's annotations at newIndex. + */ +public class AnnotationMovedAndReplacedInSameParent extends CommonDeltaEvent { + public final int newIndex; + public final String movedAnnotation; + public final String parent; + public final int oldIndex; + public final String replacedAnnotation; + public final String[] replacedDescendants; + + public AnnotationMovedAndReplacedInSameParent( + int sequenceNumber, + int newIndex, + String movedAnnotation, + String parent, + int oldIndex, + String replacedAnnotation, + String[] replacedDescendants) { + super(sequenceNumber); + this.newIndex = newIndex; + this.movedAnnotation = movedAnnotation; + this.parent = parent; + this.oldIndex = oldIndex; + this.replacedAnnotation = replacedAnnotation; + this.replacedDescendants = replacedDescendants; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedFromOtherParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedFromOtherParent.java new file mode 100644 index 000000000..d596b2935 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedFromOtherParent.java @@ -0,0 +1,30 @@ +package io.lionweb.client.delta.messages.events.annotations; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +/** + * Existing node movedAnnotation (previously inside oldParent's annotations at oldIndex) has been + * moved inside newParent's annotations at newIndex. + */ +public class AnnotationMovedFromOtherParent extends CommonDeltaEvent { + public final String newParent; + public final int newIndex; + public final String movedAnnotation; + public final String oldParent; + public final int oldIndex; + + public AnnotationMovedFromOtherParent( + int sequenceNumber, + String newParent, + int newIndex, + String movedAnnotation, + String oldParent, + int oldIndex) { + super(sequenceNumber); + this.newParent = newParent; + this.newIndex = newIndex; + this.movedAnnotation = movedAnnotation; + this.oldParent = oldParent; + this.oldIndex = oldIndex; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedInSameParent.java new file mode 100644 index 000000000..850b31890 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationMovedInSameParent.java @@ -0,0 +1,23 @@ +package io.lionweb.client.delta.messages.events.annotations; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; + +/** + * Existing node movedAnnotation (previously inside parent's annotations at oldIndex) has been moved + * inside parent's annotations at newIndex. + */ +public class AnnotationMovedInSameParent extends CommonDeltaEvent { + public final int newIndex; + public final String movedAnnotation; + public final String parent; + public final int oldIndex; + + public AnnotationMovedInSameParent( + int sequenceNumber, int newIndex, String movedAnnotation, String parent, int oldIndex) { + super(sequenceNumber); + this.newIndex = newIndex; + this.movedAnnotation = movedAnnotation; + this.parent = parent; + this.oldIndex = oldIndex; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationReplaced.java b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationReplaced.java new file mode 100644 index 000000000..6c45b010c --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/annotations/AnnotationReplaced.java @@ -0,0 +1,31 @@ +package io.lionweb.client.delta.messages.events.annotations; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.SerializationChunk; + +/** + * Existing node replacedAnnotation, and all its replacedDescendants, inside parent's annotations at + * index has been replaced with new node newAnnotation. + */ +public class AnnotationReplaced extends CommonDeltaEvent { + public final SerializationChunk newAnnotation; + public final String replacedAnnotation; + public final String[] replacedDescendants; + public final String parent; + public final int index; + + public AnnotationReplaced( + int sequenceNumber, + SerializationChunk newAnnotation, + String replacedAnnotation, + String[] replacedDescendants, + String parent, + int index) { + super(sequenceNumber); + this.newAnnotation = newAnnotation; + this.replacedAnnotation = replacedAnnotation; + this.replacedDescendants = replacedDescendants; + this.parent = parent; + this.index = index; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildAdded.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildAdded.java new file mode 100644 index 000000000..60f0a84e9 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildAdded.java @@ -0,0 +1,25 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import io.lionweb.serialization.data.SerializationChunk; + +public final class ChildAdded extends CommonDeltaEvent { + public final String parent; + public final SerializationChunk newChild; + public final MetaPointer containment; + public final int index; + + public ChildAdded( + int sequenceNumber, + String parent, + SerializationChunk newChild, + MetaPointer containment, + int index) { + super(sequenceNumber); + this.parent = parent; + this.newChild = newChild; + this.containment = containment; + this.index = index; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildDeleted.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildDeleted.java new file mode 100644 index 000000000..07f9d18d6 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildDeleted.java @@ -0,0 +1,20 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public final class ChildDeleted extends CommonDeltaEvent { + public final String parent; + public final MetaPointer containment; + public final int index; + public final String deletedChild; + + public ChildDeleted( + int sequenceNumber, String parent, MetaPointer containment, int index, String deletedChild) { + super(sequenceNumber); + this.parent = parent; + this.containment = containment; + this.index = index; + this.deletedChild = deletedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedFromOtherContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedFromOtherContainment.java new file mode 100644 index 000000000..d0a1a1ab6 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedFromOtherContainment.java @@ -0,0 +1,41 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.DeltaCommand; +import io.lionweb.serialization.data.MetaPointer; +import java.util.List; +import org.jetbrains.annotations.NotNull; + +public final class ChildMovedAndReplacedFromOtherContainment extends DeltaCommand { + public final String newParent; + public final MetaPointer newContainment; + public final int newIndex; + public final String movedChild; + public final String oldParent; + public final MetaPointer oldContainment; + public final int oldIndex; + public final String replacedChild; + public final List replacedDescendants; + + public ChildMovedAndReplacedFromOtherContainment( + @NotNull String commandId, + String newParent, + MetaPointer newContainment, + int newIndex, + String movedChild, + String oldParent, + MetaPointer oldContainment, + int oldIndex, + String replacedChild, + List replacedDescendants) { + super(commandId); + this.newParent = newParent; + this.newContainment = newContainment; + this.newIndex = newIndex; + this.movedChild = movedChild; + this.oldParent = oldParent; + this.oldContainment = oldContainment; + this.oldIndex = oldIndex; + this.replacedChild = replacedChild; + this.replacedDescendants = replacedDescendants; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedFromOtherContainmentInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedFromOtherContainmentInSameParent.java new file mode 100644 index 000000000..597b4fd98 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedFromOtherContainmentInSameParent.java @@ -0,0 +1,37 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import java.util.List; + +public final class ChildMovedAndReplacedFromOtherContainmentInSameParent extends CommonDeltaEvent { + public final MetaPointer newContainment; + public final int newIndex; + public final String movedChild; + public final String parent; + public final MetaPointer oldContainment; + public final int oldIndex; + public final String replacedChild; + public final List replacedDescendants; + + public ChildMovedAndReplacedFromOtherContainmentInSameParent( + int sequenceNumber, + MetaPointer newContainment, + int newIndex, + String movedChild, + String parent, + MetaPointer oldContainment, + int oldIndex, + String replacedChild, + List replacedDescendants) { + super(sequenceNumber); + this.newContainment = newContainment; + this.newIndex = newIndex; + this.movedChild = movedChild; + this.parent = parent; + this.oldContainment = oldContainment; + this.oldIndex = oldIndex; + this.replacedChild = replacedChild; + this.replacedDescendants = replacedDescendants; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedInSameContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedInSameContainment.java new file mode 100644 index 000000000..03d26761e --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedAndReplacedInSameContainment.java @@ -0,0 +1,34 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import java.util.List; + +public final class ChildMovedAndReplacedInSameContainment extends CommonDeltaEvent { + public final int newIndex; + public final String movedChild; + public final String parent; + public final MetaPointer containment; + public final int oldIndex; + public final String replacedChild; + public final List replacedDescendants; + + public ChildMovedAndReplacedInSameContainment( + int sequenceNumber, + int newIndex, + String movedChild, + String parent, + MetaPointer containment, + int oldIndex, + String replacedChild, + List replacedDescendants) { + super(sequenceNumber); + this.newIndex = newIndex; + this.movedChild = movedChild; + this.parent = parent; + this.containment = containment; + this.oldIndex = oldIndex; + this.replacedChild = replacedChild; + this.replacedDescendants = replacedDescendants; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedFromOtherContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedFromOtherContainment.java new file mode 100644 index 000000000..b87cd907b --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedFromOtherContainment.java @@ -0,0 +1,24 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public final class ChildMovedFromOtherContainment extends CommonDeltaEvent { + public final String newParent; + public final MetaPointer newContainment; + public final int newIndex; + public final String movedChild; + + public ChildMovedFromOtherContainment( + int sequenceNumber, + String newParent, + MetaPointer newContainment, + int newIndex, + String movedChild) { + super(sequenceNumber); + this.newParent = newParent; + this.newContainment = newContainment; + this.newIndex = newIndex; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedFromOtherContainmentInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedFromOtherContainmentInSameParent.java new file mode 100644 index 000000000..4d2d28d8e --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedFromOtherContainmentInSameParent.java @@ -0,0 +1,18 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public final class ChildMovedFromOtherContainmentInSameParent extends CommonDeltaEvent { + public final MetaPointer newContainment; + public final int newIndex; + public final String movedChild; + + public ChildMovedFromOtherContainmentInSameParent( + int sequenceNumber, MetaPointer newContainment, int newIndex, String movedChild) { + super(sequenceNumber); + this.newContainment = newContainment; + this.newIndex = newIndex; + this.movedChild = movedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedInSameContainment.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedInSameContainment.java new file mode 100644 index 000000000..5f6eb7989 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildMovedInSameContainment.java @@ -0,0 +1,27 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public final class ChildMovedInSameContainment extends CommonDeltaEvent { + public final int newIndex; + public final String movedChild; + public final String parent; + public final MetaPointer containment; + public final int oldIndex; + + public ChildMovedInSameContainment( + int sequenceNumber, + int newIndex, + String movedChild, + String parent, + MetaPointer containment, + int oldIndex) { + super(sequenceNumber); + this.newIndex = newIndex; + this.movedChild = movedChild; + this.parent = parent; + this.containment = containment; + this.oldIndex = oldIndex; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildReplaced.java b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildReplaced.java new file mode 100644 index 000000000..63c393cde --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/children/ChildReplaced.java @@ -0,0 +1,28 @@ +package io.lionweb.client.delta.messages.events.children; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import io.lionweb.serialization.data.SerializationChunk; + +public final class ChildReplaced extends CommonDeltaEvent { + public final SerializationChunk newChild; + public final String parent; + public final MetaPointer containment; + public final int index; + public final String replacedChild; + + public ChildReplaced( + int sequenceNumber, + SerializationChunk newChild, + String parent, + MetaPointer containment, + int index, + String replacedChild) { + super(sequenceNumber); + this.newChild = newChild; + this.parent = parent; + this.containment = containment; + this.index = index; + this.replacedChild = replacedChild; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/partitions/PartitionAdded.java b/client/src/main/java/io/lionweb/client/delta/messages/events/partitions/PartitionAdded.java new file mode 100644 index 000000000..9e694df67 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/partitions/PartitionAdded.java @@ -0,0 +1,14 @@ +package io.lionweb.client.delta.messages.events.partitions; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.SerializationChunk; + +public class PartitionAdded extends CommonDeltaEvent { + + public final SerializationChunk newPartition; + + public PartitionAdded(int sequenceNumber, SerializationChunk newPartition) { + super(sequenceNumber); + this.newPartition = newPartition; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/partitions/PartitionDeleted.java b/client/src/main/java/io/lionweb/client/delta/messages/events/partitions/PartitionDeleted.java new file mode 100644 index 000000000..99b4a7889 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/partitions/PartitionDeleted.java @@ -0,0 +1,17 @@ +package io.lionweb.client.delta.messages.events.partitions; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import java.util.List; + +public class PartitionDeleted extends CommonDeltaEvent { + + public final String deletedPartition; + public final List deletedDescendants; + + public PartitionDeleted( + int sequenceNumber, String deletedPartition, List deletedDescendants) { + super(sequenceNumber); + this.deletedPartition = deletedPartition; + this.deletedDescendants = deletedDescendants; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyAdded.java b/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyAdded.java new file mode 100644 index 000000000..9d8ce58ea --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyAdded.java @@ -0,0 +1,18 @@ +package io.lionweb.client.delta.messages.events.properties; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public class PropertyAdded extends CommonDeltaEvent { + + public final String node; + public final MetaPointer property; + public final String newValue; + + public PropertyAdded(int sequenceNumber, String node, MetaPointer property, String newValue) { + super(sequenceNumber); + this.node = node; + this.property = property; + this.newValue = newValue; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyChanged.java b/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyChanged.java new file mode 100644 index 000000000..f61a5b86c --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyChanged.java @@ -0,0 +1,21 @@ +package io.lionweb.client.delta.messages.events.properties; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public class PropertyChanged extends CommonDeltaEvent { + + public final String node; + public final MetaPointer property; + public final String newValue; + public final String oldValue; + + public PropertyChanged( + int sequenceNumber, String node, MetaPointer property, String newValue, String oldValue) { + super(sequenceNumber); + this.node = node; + this.property = property; + this.newValue = newValue; + this.oldValue = oldValue; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyDeleted.java b/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyDeleted.java new file mode 100644 index 000000000..ee551de35 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/properties/PropertyDeleted.java @@ -0,0 +1,18 @@ +package io.lionweb.client.delta.messages.events.properties; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +public class PropertyDeleted extends CommonDeltaEvent { + + public final String node; + public final MetaPointer property; + public final String oldValue; + + public PropertyDeleted(int sequenceNumber, String node, MetaPointer property, String oldValue) { + super(sequenceNumber); + this.node = node; + this.property = property; + this.oldValue = oldValue; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedFromOtherReference.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedFromOtherReference.java new file mode 100644 index 000000000..7443f3393 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedFromOtherReference.java @@ -0,0 +1,48 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference movedTarget/movedResolveInfo (previously inside oldParent's oldReference at + * oldIndex) has replaced existing replacedTarget/replacedResolveInfo at newParent's newReference at + * newIndex. + */ +public class EntryMovedAndReplacedFromOtherReference extends CommonDeltaEvent { + public final String newParent; + public final MetaPointer newReference; + public final int newIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + public final String oldParent; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String replacedTarget; + public final @Nullable String replacedResolveInfo; + + public EntryMovedAndReplacedFromOtherReference( + int sequenceNumber, + String newParent, + MetaPointer newReference, + int newIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo, + String oldParent, + MetaPointer oldReference, + int oldIndex, + @Nullable String replacedTarget, + @Nullable String replacedResolveInfo) { + super(sequenceNumber); + this.newParent = newParent; + this.newReference = newReference; + this.newIndex = newIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + this.oldParent = oldParent; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.replacedTarget = replacedTarget; + this.replacedResolveInfo = replacedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedFromOtherReferenceInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedFromOtherReferenceInSameParent.java new file mode 100644 index 000000000..d2b4c732d --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedFromOtherReferenceInSameParent.java @@ -0,0 +1,45 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference movedTarget/movedResolveInfo (previously inside parent's oldReference at + * oldIndex) has replaced existing replacedTarget/replacedResolveInfo at parent's newReference at + * newIndex. + */ +public class EntryMovedAndReplacedFromOtherReferenceInSameParent extends CommonDeltaEvent { + public final String parent; + public final MetaPointer newReference; + public final int newIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String replacedTarget; + public final @Nullable String replacedResolveInfo; + + public EntryMovedAndReplacedFromOtherReferenceInSameParent( + int sequenceNumber, + String parent, + MetaPointer newReference, + int newIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo, + MetaPointer oldReference, + int oldIndex, + @Nullable String replacedTarget, + @Nullable String replacedResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.newReference = newReference; + this.newIndex = newIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.replacedTarget = replacedTarget; + this.replacedResolveInfo = replacedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedInSameReference.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedInSameReference.java new file mode 100644 index 000000000..9ed577dd5 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedAndReplacedInSameReference.java @@ -0,0 +1,42 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference movedTarget/movedResolveInfo (previously inside parent's reference at + * oldIndex) has replaced existing replacedTarget/replacedResolveInfo at parent's reference at + * newIndex. + */ +public class EntryMovedAndReplacedInSameReference extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int newIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + public final int oldIndex; + public final @Nullable String replacedTarget; + public final @Nullable String replacedResolveInfo; + + public EntryMovedAndReplacedInSameReference( + int sequenceNumber, + String parent, + MetaPointer reference, + int newIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo, + int oldIndex, + @Nullable String replacedTarget, + @Nullable String replacedResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.newIndex = newIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + this.oldIndex = oldIndex; + this.replacedTarget = replacedTarget; + this.replacedResolveInfo = replacedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedFromOtherReference.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedFromOtherReference.java new file mode 100644 index 000000000..a9fecc65f --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedFromOtherReference.java @@ -0,0 +1,41 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference movedTarget/movedResolveInfo (previously inside oldParent's oldReference at + * oldIndex) has been moved to newParent's newReference at newIndex. + */ +public class EntryMovedFromOtherReference extends CommonDeltaEvent { + public final String newParent; + public final MetaPointer newReference; + public final int newIndex; + public final String oldParent; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public EntryMovedFromOtherReference( + int sequenceNumber, + String newParent, + MetaPointer newReference, + int newIndex, + String oldParent, + MetaPointer oldReference, + int oldIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(sequenceNumber); + this.newParent = newParent; + this.newReference = newReference; + this.newIndex = newIndex; + this.oldParent = oldParent; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedFromOtherReferenceInSameParent.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedFromOtherReferenceInSameParent.java new file mode 100644 index 000000000..782c6333e --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedFromOtherReferenceInSameParent.java @@ -0,0 +1,38 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference movedTarget/movedResolveInfo (previously inside parent's oldReference at + * oldIndex) has been moved to parent's newReference at newIndex. + */ +public class EntryMovedFromOtherReferenceInSameParent extends CommonDeltaEvent { + public final String parent; + public final MetaPointer newReference; + public final int newIndex; + public final MetaPointer oldReference; + public final int oldIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public EntryMovedFromOtherReferenceInSameParent( + int sequenceNumber, + String parent, + MetaPointer newReference, + int newIndex, + MetaPointer oldReference, + int oldIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.newReference = newReference; + this.newIndex = newIndex; + this.oldReference = oldReference; + this.oldIndex = oldIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedInSameReference.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedInSameReference.java new file mode 100644 index 000000000..1c06a7207 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/EntryMovedInSameReference.java @@ -0,0 +1,35 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference movedTarget/movedResolveInfo (previously inside parent's reference at + * oldIndex) has been moved to parent's reference at newIndex. + */ +public class EntryMovedInSameReference extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int oldIndex; + public final int newIndex; + public final @Nullable String movedTarget; + public final @Nullable String movedResolveInfo; + + public EntryMovedInSameReference( + int sequenceNumber, + String parent, + MetaPointer reference, + int oldIndex, + int newIndex, + @Nullable String movedTarget, + @Nullable String movedResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.oldIndex = oldIndex; + this.newIndex = newIndex; + this.movedTarget = movedTarget; + this.movedResolveInfo = movedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceAdded.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceAdded.java new file mode 100644 index 000000000..b9ebeae65 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceAdded.java @@ -0,0 +1,29 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** Reference with newTarget/newResolveInfo has been added to parent's reference at index. */ +public class ReferenceAdded extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final @Nullable String newTarget; + public final @Nullable String newResolveInfo; + + public ReferenceAdded( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + @Nullable String newTarget, + @Nullable String newResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newTarget = newTarget; + this.newResolveInfo = newResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceChanged.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceChanged.java new file mode 100644 index 000000000..7cdfcc9b1 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceChanged.java @@ -0,0 +1,38 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference with oldTarget/oldResolveInfo inside parent's reference at index has been + * replaced with newTarget/newResolveInfo. + */ +public class ReferenceChanged extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final @Nullable String newTarget; + public final @Nullable String newResolveInfo; + public final @Nullable String oldTarget; + public final @Nullable String oldResolveInfo; + + public ReferenceChanged( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + @Nullable String newTarget, + @Nullable String newResolveInfo, + @Nullable String oldTarget, + @Nullable String oldResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newTarget = newTarget; + this.newResolveInfo = newResolveInfo; + this.oldTarget = oldTarget; + this.oldResolveInfo = oldResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceDeleted.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceDeleted.java new file mode 100644 index 000000000..5cbb87638 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceDeleted.java @@ -0,0 +1,32 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Existing reference with deletedTarget/deletedResolveInfo has been deleted from parent's reference + * at index. + */ +public class ReferenceDeleted extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final @Nullable String deletedTarget; + public final @Nullable String deletedResolveInfo; + + public ReferenceDeleted( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + @Nullable String deletedTarget, + @Nullable String deletedResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.deletedTarget = deletedTarget; + this.deletedResolveInfo = deletedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoAdded.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoAdded.java new file mode 100644 index 000000000..1f2fba293 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoAdded.java @@ -0,0 +1,31 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +/** + * newResolveInfo has been added as ResolveInfo to existing entry inside parent's reference at index + * with target. + */ +public class ReferenceResolveInfoAdded extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String newResolveInfo; + public final String target; + + public ReferenceResolveInfoAdded( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + String newResolveInfo, + String target) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newResolveInfo = newResolveInfo; + this.target = target; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoChanged.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoChanged.java new file mode 100644 index 000000000..71161b3ee --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoChanged.java @@ -0,0 +1,35 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * ResolveInfo of existing entry inside parent's reference at index with target has been changed + * from oldResolveInfo to newResolveInfo. + */ +public class ReferenceResolveInfoChanged extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String newResolveInfo; + public final @Nullable String target; + public final String oldResolveInfo; + + public ReferenceResolveInfoChanged( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + String newResolveInfo, + @Nullable String target, + String oldResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newResolveInfo = newResolveInfo; + this.target = target; + this.oldResolveInfo = oldResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoDeleted.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoDeleted.java new file mode 100644 index 000000000..2c2f4d31a --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceResolveInfoDeleted.java @@ -0,0 +1,31 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +/** + * ResolveInfo deletedResolveInfo has been deleted from existing entry inside parent's reference at + * index with target. + */ +public class ReferenceResolveInfoDeleted extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String target; + public final String deletedResolveInfo; + + public ReferenceResolveInfoDeleted( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + String target, + String deletedResolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.target = target; + this.deletedResolveInfo = deletedResolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetAdded.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetAdded.java new file mode 100644 index 000000000..5e8e3886a --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetAdded.java @@ -0,0 +1,31 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +/** + * newTarget has been added as target to existing entry inside parent's reference at index with + * resolveInfo. + */ +public class ReferenceTargetAdded extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String newTarget; + public final String resolveInfo; + + public ReferenceTargetAdded( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + String newTarget, + String resolveInfo) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newTarget = newTarget; + this.resolveInfo = resolveInfo; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetChanged.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetChanged.java new file mode 100644 index 000000000..91e09d91d --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetChanged.java @@ -0,0 +1,35 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; +import org.jetbrains.annotations.Nullable; + +/** + * Target of existing entry inside parent's reference at index with resolveInfo has been changed + * from replacedTarget to newTarget. + */ +public class ReferenceTargetChanged extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String newTarget; + public final @Nullable String resolveInfo; + public final String replacedTarget; + + public ReferenceTargetChanged( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + String newTarget, + @Nullable String resolveInfo, + String replacedTarget) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.newTarget = newTarget; + this.resolveInfo = resolveInfo; + this.replacedTarget = replacedTarget; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetDeleted.java b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetDeleted.java new file mode 100644 index 000000000..19e0180cc --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/events/references/ReferenceTargetDeleted.java @@ -0,0 +1,31 @@ +package io.lionweb.client.delta.messages.events.references; + +import io.lionweb.client.delta.messages.CommonDeltaEvent; +import io.lionweb.serialization.data.MetaPointer; + +/** + * Target deletedTarget has been deleted from existing entry inside parent's reference at index with + * resolveInfo. + */ +public class ReferenceTargetDeleted extends CommonDeltaEvent { + public final String parent; + public final MetaPointer reference; + public final int index; + public final String resolveInfo; + public final String deletedTarget; + + public ReferenceTargetDeleted( + int sequenceNumber, + String parent, + MetaPointer reference, + int index, + String resolveInfo, + String deletedTarget) { + super(sequenceNumber); + this.parent = parent; + this.reference = reference; + this.index = index; + this.resolveInfo = resolveInfo; + this.deletedTarget = deletedTarget; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/GetAvailableIds.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/GetAvailableIds.java new file mode 100644 index 000000000..b181b2e92 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/GetAvailableIds.java @@ -0,0 +1,13 @@ +package io.lionweb.client.delta.messages.queries; + +import io.lionweb.client.delta.messages.DeltaQuery; +import org.jetbrains.annotations.NotNull; + +public class GetAvailableIds extends DeltaQuery { + public int count; + + public GetAvailableIds(@NotNull String queryId, int count) { + super(queryId); + this.count = count; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/ListPartitions.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/ListPartitions.java new file mode 100644 index 000000000..8aba32c33 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/ListPartitions.java @@ -0,0 +1,11 @@ +package io.lionweb.client.delta.messages.queries; + +import io.lionweb.client.delta.messages.DeltaQuery; +import org.jetbrains.annotations.NotNull; + +public class ListPartitions extends DeltaQuery { + + public ListPartitions(@NotNull String queryId) { + super(queryId); + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/Reconnect.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/Reconnect.java new file mode 100644 index 000000000..c0f94dda5 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/Reconnect.java @@ -0,0 +1,16 @@ +package io.lionweb.client.delta.messages.queries.partitcipations; + +import io.lionweb.client.delta.messages.DeltaQuery; +import org.jetbrains.annotations.NotNull; + +public class Reconnect extends DeltaQuery { + public final String participationId; + public final String lastReceivedSequenceNumber; + + public Reconnect( + @NotNull String queryId, String participationId, String lastReceivedSequenceNumber) { + super(queryId); + this.participationId = participationId; + this.lastReceivedSequenceNumber = lastReceivedSequenceNumber; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/SignOff.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/SignOff.java new file mode 100644 index 000000000..7e4899365 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/SignOff.java @@ -0,0 +1,11 @@ +package io.lionweb.client.delta.messages.queries.partitcipations; + +import io.lionweb.client.delta.messages.DeltaQuery; +import org.jetbrains.annotations.NotNull; + +public class SignOff extends DeltaQuery { + + public SignOff(@NotNull String queryId) { + super(queryId); + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/SignOn.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/SignOn.java new file mode 100644 index 000000000..57aa70240 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/partitcipations/SignOn.java @@ -0,0 +1,19 @@ +package io.lionweb.client.delta.messages.queries.partitcipations; + +import io.lionweb.client.delta.DeltaProtocolVersion; +import io.lionweb.client.delta.messages.DeltaQuery; +import org.jetbrains.annotations.NotNull; + +public class SignOn extends DeltaQuery { + public final @NotNull DeltaProtocolVersion deltaProtocolVersion; + public final @NotNull String clientId; + + public SignOn( + @NotNull String queryId, + @NotNull DeltaProtocolVersion deltaProtocolVersion, + @NotNull String clientId) { + super(queryId); + this.deltaProtocolVersion = deltaProtocolVersion; + this.clientId = clientId; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/SubscribeToChangingPartitions.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/SubscribeToChangingPartitions.java new file mode 100644 index 000000000..982ca7622 --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/SubscribeToChangingPartitions.java @@ -0,0 +1,28 @@ +package io.lionweb.client.delta.messages.queries.subscriptions; + +import io.lionweb.client.delta.messages.DeltaQuery; +import org.jetbrains.annotations.NotNull; + +public class SubscribeToChangingPartitions extends DeltaQuery { + /** + * Whether this client wants to receive events on newly created partitions (true), or not (false) + */ + private boolean creation; + + /** Whether this client wants to receive events on deleted partitions (true), or not (false). */ + private boolean deletion; + + /** + * Whether this client wants to automatically subscribe to newly created partitions (true), or not + * (false). + */ + private boolean partitions; + + public SubscribeToChangingPartitions( + @NotNull String queryId, boolean creation, boolean deletion, boolean partitions) { + super(queryId); + this.creation = creation; + this.deletion = deletion; + this.partitions = partitions; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/SubscribeToPartitionContents.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/SubscribeToPartitionContents.java new file mode 100644 index 000000000..ecfc9c77a --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/SubscribeToPartitionContents.java @@ -0,0 +1,15 @@ +package io.lionweb.client.delta.messages.queries.subscriptions; + +import io.lionweb.client.delta.messages.DeltaQuery; +import org.jetbrains.annotations.NotNull; + +public class SubscribeToPartitionContents extends DeltaQuery { + + /** TargetNode Node id of the partition this client wants to receive events of. */ + private String partition; + + public SubscribeToPartitionContents(@NotNull String queryId, String partition) { + super(queryId); + this.partition = partition; + } +} diff --git a/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/UnsubscribeFromPartitionContents.java b/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/UnsubscribeFromPartitionContents.java new file mode 100644 index 000000000..2cba431ae --- /dev/null +++ b/client/src/main/java/io/lionweb/client/delta/messages/queries/subscriptions/UnsubscribeFromPartitionContents.java @@ -0,0 +1,13 @@ +package io.lionweb.client.delta.messages.queries.subscriptions; + +import io.lionweb.client.delta.messages.DeltaQuery; + +public class UnsubscribeFromPartitionContents extends DeltaQuery { + + public final String partition; + + public UnsubscribeFromPartitionContents(String queryId, String partition) { + super(queryId); + this.partition = partition; + } +}