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/04/24 07:49:36 UTC

(causeway) 26/28: CAUSEWAY-3989: [v2] declares mixins

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

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

commit 9d12f794a7600af4120cc67339e4ebead4fcbded
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Apr 22 19:14:27 2026 +0100

    CAUSEWAY-3989: [v2] declares mixins
---
 .../applib/CausewayModuleExtCommandLogApplib.java  |  23 ++++
 .../applib/dom/replay/ReplayableCommand.java       | 127 ++-------------------
 .../dom/replay/ReplayableCommand_delete.java       |  49 ++++++++
 .../ReplayableCommand_excludeFromReplay.java       |  54 +++++++++
 .../replay/ReplayableCommand_makeExportable.java   |  55 +++++++++
 .../ReplayableCommand_openCommandLogEntry.java     |  54 +++++++++
 .../replay/ReplayableCommand_replayOrRetry.java    |  57 +++++++++
 7 files changed, 300 insertions(+), 119 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 c5a329e765b..4f83a6a5f1f 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
@@ -36,6 +36,11 @@
 import org.apache.causeway.extensions.commandlog.applib.dom.replay.CommandExportManager;
 import org.apache.causeway.extensions.commandlog.applib.dom.replay.CommandReplayManager;
 import org.apache.causeway.extensions.commandlog.applib.dom.replay.ReplayContext;
+import org.apache.causeway.extensions.commandlog.applib.dom.replay.ReplayableCommand_delete;
+import org.apache.causeway.extensions.commandlog.applib.dom.replay.ReplayableCommand_excludeFromReplay;
+import org.apache.causeway.extensions.commandlog.applib.dom.replay.ReplayableCommand_makeExportable;
+import org.apache.causeway.extensions.commandlog.applib.dom.replay.ReplayableCommand_openCommandLogEntry;
+import org.apache.causeway.extensions.commandlog.applib.dom.replay.ReplayableCommand_replayOrRetry;
 import org.apache.causeway.extensions.commandlog.applib.fakescheduler.FakeScheduler;
 import org.apache.causeway.extensions.commandlog.applib.job.BackgroundCommandsJobControl;
 import org.apache.causeway.extensions.commandlog.applib.job.RunBackgroundCommandsJob;
@@ -61,6 +66,24 @@
         CommandLogEntry_childCommands.class,
         CommandLogEntry_openResultObject.class,
         CommandLogEntry_siblingCommands.class,
+        ReplayableCommand_makeExportable.class,
+        ReplayableCommand_openCommandLogEntry.class,
+        ReplayableCommand_replayOrRetry.class,
+        ReplayableCommand_excludeFromReplay.class,
+        ReplayableCommand_delete.class,
+        CommandExportManager.changeSince.class,
+        CommandExportManager.previousHour.class,
+        CommandExportManager.nextHour.class,
+        CommandExportManager.exportSelected.class,
+        CommandExportManager.makeSelectedExportable.class,
+        CommandReplayManager.changeSince.class,
+        CommandExportManager.previousHour.class,
+        CommandReplayManager.nextHour.class,
+        CommandReplayManager.importCommands.class,
+        CommandReplayManager.replayOrRetrySelected.class,
+        CommandReplayManager.excludeSelectedFromReplay.class,
+        CommandReplayManager.deleteSelectedSucceededOrExcluded.class,
+        CommandReplayManager.deleteSelectedPendingOrFailed.class,
 
         // @Component's
         RunBackgroundCommandsJob.class,
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.java
index 6c793a3b861..e2ea51718b0 100644
--- a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.java
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.java
@@ -264,83 +264,6 @@ public AsciiDoc getDto() {
 
     // -- ACTIONS
 
-    @Action(
-            semantics = SemanticsOf.SAFE,
-            commandPublishing = Publishing.DISABLED,
-            domainEvent = openCommandLogEntry.DomainEvent.class,
-            executionPublishing = Publishing.DISABLED
-    )
-    @ActionLayout(
-            sequence = "0.2",
-            describedAs = "Opens the underlying Command Log Entry"
-    )
-    public class openCommandLogEntry {
-        public class DomainEvent extends ActionDomainEvent<openCommandLogEntry> { }
-        @MemberSupport public CommandLogEntry act() {
-            return commandLogEntry()
-                    .orElse(null);
-        }
-        @MemberSupport public String disableAct() {
-            return commandLogEntry().isEmpty() ? "No corresponding CommandLogEntry" : null;
-        }
-    }
-
-
-    @Action(
-            restrictTo = RestrictTo.PROTOTYPING,
-            semantics = SemanticsOf.NON_IDEMPOTENT,
-            commandPublishing = Publishing.DISABLED,
-            domainEvent = replayOrRetry.DomainEvent.class,
-            executionPublishing = Publishing.DISABLED
-    )
-    @ActionLayout(
-            sequence = "0.1",
-            cssClassFa = "solid circle-play",
-            cssClass = "btn-primary"
-            //hidden = Where.NOWHERE // show in tables //TODO NPE bug
-    )
-    public class replayOrRetry {
-        public class DomainEvent extends ActionDomainEvent<replayOrRetry> { }
-        @MemberSupport public ReplayableCommand act() {
-            tryReplayOrRetry();
-            return ReplayableCommand.this;
-        }
-        @MemberSupport public String disableAct() {
-            return disableReplayOrRetry();
-        }
-    }
-    private String disableReplayOrRetry() {
-        return commandRecord()
-                .map(CommandRecord::canReplayOrRetryOrMarkForExclusion)
-                .orElse(false)
-                ? null
-                : "Cannot replay, if neither PENDING nor FAILED";
-    }
-
-
-    @Action(
-            restrictTo = RestrictTo.PROTOTYPING,
-            semantics = SemanticsOf.IDEMPOTENT,
-            commandPublishing = Publishing.DISABLED,
-            domainEvent = makeExportable.DomainEvent.class,
-            executionPublishing = Publishing.DISABLED
-    )
-    @ActionLayout(
-            //hidden = Where.NOWHERE, // show in tables //TODO NPE bug
-            associateWith = "replayState",
-            sequence = "2.1",
-            describedAs = "Makes Command exportable (again)"
-    )
-    public class makeExportable {
-        public class DomainEvent extends ActionDomainEvent<makeExportable> { }
-
-        @MemberSupport public ReplayableCommand act() {
-            return makeExportable();
-        }
-        @MemberSupport public String disableAct() {
-            return disableMakeExportable();
-        }
-    }
 
     ReplayableCommand makeExportable() {
         if(disableMakeExportable()!=null) {
@@ -363,29 +286,6 @@ String disableMakeExportable() {
     }
 
 
-    @Action(
-            restrictTo = RestrictTo.PROTOTYPING,
-            commandPublishing = Publishing.DISABLED,
-            domainEvent = excludeFromReplay.DomainEvent.class,
-            executionPublishing = Publishing.DISABLED
-    )
-    @ActionLayout(
-            //hidden = Where.NOWHERE, // show in tables //TODO NPE bug
-            sequence = "2.2",
-            associateWith = "replayState",
-            describedAs = "Marks Command to be EXCLUDED from replay."
-    )
-    public class excludeFromReplay {
-        public class DomainEvent extends ActionDomainEvent<excludeFromReplay> { }
-
-        @MemberSupport public ReplayableCommand act() {
-            return excludeFromReplay();
-        }
-        @MemberSupport private String disableAct() {
-            return disableExcludeFromReplay();
-        }
-    }
-
     ReplayableCommand excludeFromReplay() {
         if(disableExcludeFromReplay()!=null) {
             return ReplayableCommand.this; // safeguard when called programmatically
@@ -398,7 +298,7 @@ ReplayableCommand excludeFromReplay() {
                 });
         return ReplayableCommand.this;
     }
-    private String disableExcludeFromReplay() {
+    String disableExcludeFromReplay() {
         return commandRecord()
                 .map(CommandRecord::canReplayOrRetryOrMarkForExclusion)
                 .orElse(false)
@@ -407,24 +307,6 @@ private String disableExcludeFromReplay() {
     }
 
 
-    @Action(
-            restrictTo = RestrictTo.PROTOTYPING,
-            semantics =  SemanticsOf.NON_IDEMPOTENT,
-            commandPublishing = Publishing.DISABLED,
-            domainEvent = delete.DomainEvent.class,
-            executionPublishing = Publishing.DISABLED
-    )
-    @ActionLayout(
-            sequence = "0.3",
-            //hidden = Where.NOWHERE, // show in tables //TODO NPE bug
-            describedAs = "Deletes the associated Command Log Entry (cannot be undone)"
-    )
-    public class delete {
-        public class DomainEvent extends ActionDomainEvent<delete> { }
-        @MemberSupport public void act() {
-            deleteObj();
-        }
-    }
     @Programmatic
     void deleteObj() {
         commandLogEntry()
@@ -477,6 +359,13 @@ Try<ReplayableCommand> tryReplayOrRetry() {
             })
             .orElseGet(()->Try.success(null));
     }
+    String disableReplayOrRetry() {
+        return commandRecord()
+                .map(CommandRecord::canReplayOrRetryOrMarkForExclusion)
+                .orElse(false)
+                ? null
+                : "Cannot replay, if neither PENDING nor FAILED";
+    }
 
     // -- HELPER
 
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_delete.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_delete.java
new file mode 100644
index 00000000000..6289ab9647e
--- /dev/null
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_delete.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.extensions.commandlog.applib.dom.replay;
+
+import lombok.RequiredArgsConstructor;
+
+import org.apache.causeway.applib.annotation.*;
+
+@Action(
+        restrictTo = RestrictTo.PROTOTYPING,
+        semantics = SemanticsOf.NON_IDEMPOTENT,
+        commandPublishing = Publishing.DISABLED,
+        domainEvent = ReplayableCommand_delete.DomainEvent.class,
+        executionPublishing = Publishing.DISABLED
+)
+@ActionLayout(
+        sequence = "0.3",
+        //hidden = Where.NOWHERE, // show in tables //TODO NPE bug
+        describedAs = "Deletes the associated Command Log Entry (cannot be undone)"
+)
+@RequiredArgsConstructor
+public class ReplayableCommand_delete {
+
+    public static class DomainEvent extends ReplayableCommand.ActionDomainEvent<ReplayableCommand_delete> {
+    }
+
+    private final ReplayableCommand replayableCommand;
+
+    @MemberSupport
+    public void act() {
+        replayableCommand.deleteObj();
+    }
+}
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_excludeFromReplay.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_excludeFromReplay.java
new file mode 100644
index 00000000000..955c7ef4c2d
--- /dev/null
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_excludeFromReplay.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.extensions.commandlog.applib.dom.replay;
+
+import lombok.RequiredArgsConstructor;
+
+import org.apache.causeway.applib.annotation.*;
+
+@Action(
+        restrictTo = RestrictTo.PROTOTYPING,
+        commandPublishing = Publishing.DISABLED,
+        domainEvent = ReplayableCommand_excludeFromReplay.DomainEvent.class,
+        executionPublishing = Publishing.DISABLED
+)
+@ActionLayout(
+        //hidden = Where.NOWHERE, // show in tables //TODO NPE bug
+        sequence = "2.2",
+        associateWith = "replayState",
+        describedAs = "Marks Command to be EXCLUDED from replay."
+)
+@RequiredArgsConstructor
+public class ReplayableCommand_excludeFromReplay {
+
+    public static class DomainEvent extends ReplayableCommand.ActionDomainEvent<ReplayableCommand_excludeFromReplay> {
+    }
+
+    private final ReplayableCommand replayableCommand;
+
+    @MemberSupport
+    public ReplayableCommand act() {
+        return replayableCommand.excludeFromReplay();
+    }
+
+    @MemberSupport
+    private String disableAct() {
+        return replayableCommand.disableExcludeFromReplay();
+    }
+}
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_makeExportable.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_makeExportable.java
new file mode 100644
index 00000000000..591746fa0c9
--- /dev/null
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_makeExportable.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.extensions.commandlog.applib.dom.replay;
+
+import lombok.RequiredArgsConstructor;
+
+import org.apache.causeway.applib.annotation.*;
+
+@Action(
+        restrictTo = RestrictTo.PROTOTYPING,
+        semantics = SemanticsOf.IDEMPOTENT,
+        commandPublishing = Publishing.DISABLED,
+        domainEvent = ReplayableCommand_makeExportable.DomainEvent.class,
+        executionPublishing = Publishing.DISABLED
+)
+@ActionLayout(
+        //hidden = Where.NOWHERE, // show in tables //TODO NPE bug
+        associateWith = "replayState",
+        sequence = "2.1",
+        describedAs = "Makes Command exportable (again)"
+)
+@RequiredArgsConstructor
+public class ReplayableCommand_makeExportable {
+
+    public static class DomainEvent extends ReplayableCommand.ActionDomainEvent<ReplayableCommand_makeExportable> {
+    }
+
+    private final ReplayableCommand replayableCommand;
+
+    @MemberSupport
+    public ReplayableCommand act() {
+        return replayableCommand.makeExportable();
+    }
+
+    @MemberSupport
+    public String disableAct() {
+        return replayableCommand.disableMakeExportable();
+    }
+}
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_openCommandLogEntry.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_openCommandLogEntry.java
new file mode 100644
index 00000000000..600744eab9c
--- /dev/null
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_openCommandLogEntry.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.extensions.commandlog.applib.dom.replay;
+
+import lombok.RequiredArgsConstructor;
+
+import org.apache.causeway.applib.annotation.*;
+import org.apache.causeway.extensions.commandlog.applib.dom.CommandLogEntry;
+
+@Action(
+        semantics = SemanticsOf.SAFE,
+        commandPublishing = Publishing.DISABLED,
+        domainEvent = ReplayableCommand_openCommandLogEntry.DomainEvent.class,
+        executionPublishing = Publishing.DISABLED
+)
+@ActionLayout(
+        sequence = "0.2",
+        describedAs = "Opens the underlying Command Log Entry"
+)
+@RequiredArgsConstructor
+public class ReplayableCommand_openCommandLogEntry {
+
+    public static class DomainEvent extends ReplayableCommand.ActionDomainEvent<ReplayableCommand_openCommandLogEntry> {
+    }
+
+    private final ReplayableCommand replayableCommand;
+
+    @MemberSupport
+    public CommandLogEntry act() {
+        return replayableCommand.commandLogEntry()
+                .orElse(null);
+    }
+
+    @MemberSupport
+    public String disableAct() {
+        return replayableCommand.commandLogEntry().isEmpty() ? "No corresponding CommandLogEntry" : null;
+    }
+}
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_replayOrRetry.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_replayOrRetry.java
new file mode 100644
index 00000000000..e2847773951
--- /dev/null
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand_replayOrRetry.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.extensions.commandlog.applib.dom.replay;
+
+import lombok.RequiredArgsConstructor;
+
+import org.apache.causeway.applib.annotation.*;
+
+@Action(
+        restrictTo = RestrictTo.PROTOTYPING,
+        semantics = SemanticsOf.NON_IDEMPOTENT,
+        commandPublishing = Publishing.DISABLED,
+        domainEvent = ReplayableCommand_replayOrRetry.DomainEvent.class,
+        executionPublishing = Publishing.DISABLED
+)
+@ActionLayout(
+        sequence = "0.1",
+        cssClassFa = "solid circle-play",
+        cssClass = "btn-primary"
+        //hidden = Where.NOWHERE // show in tables //TODO NPE bug
+)
+@RequiredArgsConstructor
+public class ReplayableCommand_replayOrRetry {
+
+    public static class DomainEvent extends ReplayableCommand.ActionDomainEvent<ReplayableCommand_replayOrRetry> {
+    }
+
+    private final ReplayableCommand replayableCommand;
+
+
+    @MemberSupport
+    public ReplayableCommand act() {
+        replayableCommand.tryReplayOrRetry();
+        return replayableCommand;
+    }
+
+    @MemberSupport
+    public String disableAct() {
+        return replayableCommand.disableReplayOrRetry();
+    }
+}