You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2026/05/06 11:42:43 UTC

(causeway) branch CAUSEWAY-3998 updated: CAUSEWAY-3998 : makes CommandExportManager similar to CommandReplayManager

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3998
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/CAUSEWAY-3998 by this push:
     new dd57db1d5fe CAUSEWAY-3998 : makes CommandExportManager similar to CommandReplayManager
dd57db1d5fe is described below

commit dd57db1d5fe504a304bcb636571448da47769d95
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed May 6 12:42:35 2026 +0100

    CAUSEWAY-3998 : makes CommandExportManager similar to CommandReplayManager
    
    - renames 'since' to 'baseline'
    - also fix up layout for both
---
 .../applib/CausewayModuleExtCommandLogApplib.java  |  2 +-
 .../applib/dom/replay/CommandExportManager.java    | 40 +++++++++++-----------
 .../applib/dom/replay/CommandReplayManager.java    | 12 +++----
 .../CommandReplayManager.layout.fallback.xml       |  6 ++--
 4 files changed, 28 insertions(+), 32 deletions(-)

diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/CausewayModuleExtCommandLogApplib.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/CausewayModuleExtCommandLogApplib.java
index a53e5fa50b8..990d30772d9 100644
--- a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/CausewayModuleExtCommandLogApplib.java
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/CausewayModuleExtCommandLogApplib.java
@@ -72,7 +72,7 @@
         ReplayableCommand_replayOrRetry.class,
         ReplayableCommand_excludeFromReplay.class,
         ReplayableCommand_delete.class,
-        CommandExportManager.changeSince.class,
+        CommandExportManager.changeBaseline.class,
         CommandExportManager.previousHour.class,
         CommandExportManager.nextHour.class,
         CommandExportManager.exportSelected.class,
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandExportManager.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandExportManager.java
index f9784c15eb1..e24078a6f29 100644
--- a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandExportManager.java
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandExportManager.java
@@ -76,9 +76,9 @@ public CommandExportManager(
     }
 
     public CommandExportManager(
-            final java.sql.Timestamp since,
+            final java.sql.Timestamp baseline,
             final ReplayContext replayContext) {
-        this.since = since;
+        this.baseline = baseline;
         this.replayContext = replayContext;
     }
 
@@ -88,9 +88,9 @@ public CommandExportManager(
 
 
     @Property
-    @PropertyLayout(describedAs = "Only commands since this timestamp are available for export")
+    @PropertyLayout(describedAs = "Only commands after this timestamp are available for export")
     @Getter
-    private java.sql.Timestamp since;
+    private java.sql.Timestamp baseline;
 
     @Action(
             semantics = SemanticsOf.SAFE,
@@ -99,7 +99,7 @@ public CommandExportManager(
             executionPublishing = Publishing.DISABLED
     )
     @ActionLayout(
-            associateWith = "since", sequence = "1",
+            associateWith = "baseline", sequence = "1",
             named = "Previous",
             position = ActionLayout.Position.PANEL,
             describedAs = "Move back one hour"
@@ -108,7 +108,7 @@ public class previousHour {
         public class DomainEvent extends ActionDomainEvent<previousHour> { }
 
         @MemberSupport public CommandExportManager act() {
-            return new CommandExportManager(addSeconds(since, -3600), replayContext);
+            return new CommandExportManager(addSeconds(baseline, -3600), replayContext);
         }
     }
 
@@ -119,7 +119,7 @@ public class DomainEvent extends ActionDomainEvent<previousHour> { }
             executionPublishing = Publishing.DISABLED
     )
     @ActionLayout(
-            associateWith = "since", sequence = "3",
+            associateWith = "baseline", sequence = "3",
             named = "Next",
             position = ActionLayout.Position.PANEL,
             describedAs = "Move forward one hour"
@@ -127,7 +127,7 @@ public class DomainEvent extends ActionDomainEvent<previousHour> { }
     public class nextHour {
         public class DomainEvent extends ActionDomainEvent<nextHour> { }
         @MemberSupport public CommandExportManager act() {
-            return new CommandExportManager(addSeconds(since, +3600), replayContext);
+            return new CommandExportManager(addSeconds(baseline, +3600), replayContext);
         }
     }
 
@@ -135,26 +135,26 @@ public class DomainEvent extends ActionDomainEvent<nextHour> { }
             restrictTo = RestrictTo.PROTOTYPING,
             semantics = SemanticsOf.SAFE,
             commandPublishing = Publishing.DISABLED,
-            domainEvent = changeSince.DomainEvent.class,
+            domainEvent = changeBaseline.DomainEvent.class,
             executionPublishing = Publishing.DISABLED
     )
     @ActionLayout(
-            associateWith = "since", sequence = "2",
+            associateWith = "baseline", sequence = "2",
             named = "Change",
             position = ActionLayout.Position.PANEL
     )
-    public class changeSince {
+    public class changeBaseline {
         public class DomainEvent extends ActionDomainEvent<nextHour> { }
-        @MemberSupport public CommandExportManager act(final java.sql.Timestamp since) {
-            return new CommandExportManager(since, replayContext);
+        @MemberSupport public CommandExportManager act(final java.sql.Timestamp baseline) {
+            return new CommandExportManager(baseline, replayContext);
         }
-        @MemberSupport public java.sql.Timestamp defaultSince() {
-            return CommandExportManager.this.since;
+        @MemberSupport public java.sql.Timestamp defaultBaseline() {
+            return CommandExportManager.this.baseline;
         }
     }
 
-    private static Timestamp addSeconds(Timestamp since, int secondsToAdd) {
-        return Timestamp.from(since.toInstant().plusSeconds(secondsToAdd));
+    private static Timestamp addSeconds(Timestamp ts, int secondsToAdd) {
+        return Timestamp.from(ts.toInstant().plusSeconds(secondsToAdd));
     }
 
 
@@ -165,7 +165,7 @@ private static Timestamp addSeconds(Timestamp since, int secondsToAdd) {
             describedAs = "Commands that can be exported"
     )
     public List<ReplayableCommand> getNotYetExported() {
-        return commandLogEntryRepository().findForegroundSinceTimestampAndCanBeExported(since).stream()
+        return commandLogEntryRepository().findForegroundSinceTimestampAndCanBeExported(baseline).stream()
             .map(entry->new ReplayableCommand(
                     entry.getInteractionId(),
                     replayContext))
@@ -257,7 +257,7 @@ public List<ReplayableCommand> choicesSelected() {
     @Collection
     @CollectionLayout(describedAs = "Commands that have been exported")
     public List<ReplayableCommand> getExported() {
-        return commandLogEntryRepository().findForegroundSinceTimestampAndHasBeenExported(since).stream()
+        return commandLogEntryRepository().findForegroundSinceTimestampAndHasBeenExported(baseline).stream()
             .map(entry->new ReplayableCommand(
                     entry.getInteractionId(),
                     replayContext))
@@ -308,7 +308,7 @@ public List<ReplayableCommand> choicesSelected() {
 
     @Override
     public String viewModelMemento() {
-        return TimestampMarshallUtil.toString(this.since);
+        return TimestampMarshallUtil.toString(this.baseline);
     }
 
     // -- HELPER
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.java
index d3e1f8c5a72..08edf482047 100644
--- a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.java
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.java
@@ -64,7 +64,6 @@
 public final class CommandReplayManager implements ViewModel {
 
     public static final String LOGICAL_TYPE_NAME = CausewayModuleExtCommandLogApplib.NAMESPACE + ".CommandReplayManager";
-    private TimestampService timestampService;
 
     public static abstract class ActionDomainEvent<T>
             extends CausewayModuleExtCommandLogApplib.ActionDomainEvent<T> { }
@@ -74,9 +73,8 @@ public static abstract class ActionDomainEvent<T>
     @Inject
     public CommandReplayManager(
             final String memento,
-            final ReplayContext replayContext, TimestampService timestampService) {
+            final ReplayContext replayContext) {
         this(fromString(memento, replayContext.clockService().getClock().nowAsJavaSqlTimestamp()),  replayContext);
-        this.timestampService = timestampService;
     }
 
     public CommandReplayManager(
@@ -157,8 +155,8 @@ public class DomainEvent extends ActionDomainEvent<nextHour> { }
         }
     }
 
-    private static Timestamp addSeconds(Timestamp t0, int secondsToAdd) {
-        return Timestamp.from(t0.toInstant().plusSeconds(secondsToAdd));
+    private static Timestamp addSeconds(Timestamp ts, int secondsToAdd) {
+        return Timestamp.from(ts.toInstant().plusSeconds(secondsToAdd));
     }
 
     @Action(
@@ -213,7 +211,7 @@ private static Timestamp toJavaSqlTimestamp(XMLGregorianCalendar xgc) {
 
     @Collection
     @CollectionLayout(
-            describedAs = "Imported Commands that can be either replayed (replayState=PENDING) or retried (when replayState=FAILED)"
+            describedAs = "Imported Commands that can be either replayed (if PENDING) or retried (if FAILED)"
     )
     public List<ReplayableCommand> getPendingOrFailed() {
         return streamPendingOrFailed()
@@ -450,7 +448,6 @@ public List<ReplayableCommand> choicesSelected() {
     }
 
 
-
     // -- VM STATE
 
     @Override
@@ -459,7 +456,6 @@ public String viewModelMemento() {
     }
 
     // -- HELPER
-
     private CommandLogEntryRepository commandLogEntryRepository() {
         return replayContext.commandLogEntryRepository();
     }
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.layout.fallback.xml b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.layout.fallback.xml
index c7aed354e9f..f10b0445aa8 100644
--- a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.layout.fallback.xml
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandReplayManager.layout.fallback.xml
@@ -4,11 +4,11 @@
             <cpt:domainObject/>
         </bs:col>
         <bs:col span="3">
-            <cpt:fieldSet name=" " id="since">
+            <cpt:fieldSet name=" " id="baseline">
                 <cpt:action id="previousHour"/>
-                <cpt:action id="changeSince"/>
+                <cpt:action id="changeBaseline"/>
                 <cpt:action id="nextHour"/>
-                <cpt:property id="since"/>
+                <cpt:property id="baseline"/>
             </cpt:fieldSet>
         </bs:col>
         <bs:col span="3">