This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch CAUSEWAY-4042
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/CAUSEWAY-4042 by this push:
new b49d3367466 CAUSEWAY-4042: cosmetics
b49d3367466 is described below
commit b49d3367466878285bc32c7d449eb305cb5d1ad1
Author: Dan Haywood <[email protected]>
AuthorDate: Mon Jun 29 17:26:34 2026 +0100
CAUSEWAY-4042: cosmetics
---
.../applib/dom/replay/ReplayableCommand.java | 117 ++++++++++++++-------
.../replay/ReplayableCommand.layout.fallback.xml | 14 ++-
2 files changed, 92 insertions(+), 39 deletions(-)
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 09d9be9a88c..3584bbcbd56 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
@@ -28,16 +28,20 @@
import java.util.Optional;
import java.util.UUID;
+import javax.inject.Inject;
import javax.inject.Named;
import org.apache.causeway.applib.Identifier;
import org.apache.causeway.applib.ViewModel;
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.ActionLayout;
import org.apache.causeway.applib.annotation.Collection;
import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.DomainObjectLayout;
import org.apache.causeway.applib.annotation.Introspection;
import org.apache.causeway.applib.annotation.LabelPosition;
+import org.apache.causeway.applib.annotation.MemberSupport;
import org.apache.causeway.applib.annotation.ObjectSupport;
import org.apache.causeway.applib.annotation.Programmatic;
import org.apache.causeway.applib.annotation.Property;
@@ -46,6 +50,7 @@
import org.apache.causeway.applib.annotation.Where;
import org.apache.causeway.applib.jaxb.JavaTimeXMLGregorianCalendarMarshalling;
import org.apache.causeway.applib.services.bookmark.Bookmark;
+import org.apache.causeway.applib.services.bookmark.BookmarkService;
import
org.apache.causeway.applib.services.command.CommandExecutorService.InteractionContextPolicy;
import org.apache.causeway.applib.services.command.CommandRecordingSuppressed;
import
org.apache.causeway.applib.services.queryresultscache.QueryResultsCacheControl;
@@ -125,6 +130,8 @@ final static class CommandRecord {
final CommandDto commandDto;
final ReplayState replayState;
+ final String replayStateFailureReason;
+ final Bookmark target;
boolean canReplayOrRetry() {
return replayState.isReplayOrRetryEnabled();
@@ -213,7 +220,7 @@ public String iconName() {
@Property
@PropertyLayout(
sequence = "1.1",
- fieldSetId = "details",
+ fieldSetId = "identity",
describedAs = "UUID of the original (replayable) Command")
public UUID getInteractionId() {
return interactionId;
@@ -222,7 +229,7 @@ public UUID getInteractionId() {
@Property
@PropertyLayout(
sequence = "1.2",
- fieldSetId = "details",
+ fieldSetId = "identity",
describedAs = "Timestamp of the original (replayable) Command")
public ZonedDateTime getTimestamp() {
return getTimestampIfAny()
@@ -237,10 +244,11 @@ public Optional<ZonedDateTime> getTimestampIfAny() {
.map(JavaTimeXMLGregorianCalendarMarshalling::toZonedDateTime);
}
+
@Property
@PropertyLayout(
- sequence = "3.0",
- fieldSetId = "details",
+ sequence = "2.1",
+ fieldSetId = "target",
hidden = Where.PARENTED_TABLES,
describedAs = "Target of the command")
public String getTarget() {
@@ -251,8 +259,8 @@ public String getTarget() {
@Property
@PropertyLayout(
named = "Target",
- sequence = "3.0",
- fieldSetId = "details",
+ sequence = "2.2",
+ fieldSetId = "target",
hidden = Where.OBJECT_FORMS,
describedAs = "Target of the command")
public String getTargetAbbreviated() {
@@ -261,26 +269,33 @@ public String getTargetAbbreviated() {
.orElse(null);
}
- private static @NonNull String abbreviatedIfRequired(String x) {
- final var abbreviateIfLongerThan = 80;
- return x.length() > abbreviateIfLongerThan ? x.substring(0,
abbreviateIfLongerThan) + "..." : x;
- }
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(
+ associateWith = "target",
+ position = ActionLayout.Position.PANEL
+ )
+ public class openTarget {
- private @NonNull Optional<String> targetBookmarkIfAny() {
- return commandRecord()
- .map(CommandRecord::commandDto)
- .map(CommandDto::getTargets)
- .map(OidsDto::getOid) // returns a list of OidDto's, in fact
- .flatMap(oidDtoList ->
Optional.ofNullable(oidDtoList.isEmpty() ? null : oidDtoList.get(0)))
- .map(Bookmark::forOidDto)
- .map(Bookmark::stringify);
- }
+ @MemberSupport public Object act() {
+ return targetIfAny().orElse(null);
+ }
+ @MemberSupport public String disableAct() {
+ return targetIfAny().isEmpty() ? null : "Cannot access target";
+ }
+
+ private @NonNull Optional<Object> targetIfAny() {
+ return targetBookmarkIfAny()
+ .flatMap(Bookmark::parse)
+ .flatMap(bookmark -> bookmarkService.lookup(bookmark));
+ }
+ @Inject BookmarkService bookmarkService;
+ }
@Property
@PropertyLayout(
- sequence = "3.1",
- fieldSetId = "details",
+ sequence = "2.3",
+ fieldSetId = "target",
describedAs = "Replayable Action or Property, that was executed as
captured by the original Command")
public String getMember() {
return commandRecord()
@@ -292,10 +307,29 @@ public String getMember() {
.orElse(null);
}
+
@Property
@PropertyLayout(
- sequence = "4",
- fieldSetId = "details",
+ sequence = "2.4",
+ fieldSetId = "target",
+ describedAs = "Whether this command uses only known participants
as target or action params. This determines whether the command is
exportable/replayable in context of all commands since a baseline.",
+ hidden = Where.OBJECT_FORMS
+ )
+ public boolean isKnownParticipants() {
+ if (replayableCommandParticipantTracker == null) {
+ return false;
+ }
+ return commandLogEntry()
+ .map(replayableCommandParticipantTracker::isKnownParticipants)
+ .orElse(false);
+ }
+
+
+
+ @Property
+ @PropertyLayout(
+ sequence = "3.1",
+ fieldSetId = "control",
describedAs = "Replay State of the original (replayable) Command. "
+ "When imported initially is PENDING. "
+ "Then after replay its either OK or FAILED. "
@@ -306,10 +340,11 @@ public ReplayState getReplayState() {
.orElse(null);
}
+
@Property
@PropertyLayout(
sequence = "4.1",
- fieldSetId = "details",
+ fieldSetId = "Result",
describedAs = "Whether this command stores a result bookmark.")
public boolean getHasResult() {
return commandLogEntry()
@@ -320,19 +355,26 @@ public boolean getHasResult() {
@Property
@PropertyLayout(
sequence = "4.2",
- fieldSetId = "details",
- describedAs = "Whether this command uses only known participants
as target or action params. This determines whether the command is
exportable/replayable in context of all commands since a baseline.",
- hidden = Where.OBJECT_FORMS
- )
- public boolean isKnownParticipants() {
- if (replayableCommandParticipantTracker == null) {
- return false;
- }
- return commandLogEntry()
- .map(replayableCommandParticipantTracker::isKnownParticipants)
- .orElse(false);
+ fieldSetId = "results")
+ public String getReplayStateFailureReason() {
+ return commandRecord()
+ .map(CommandRecord::replayStateFailureReason)
+ .orElse(null);
}
+
+ private static @NonNull String abbreviatedIfRequired(String x) {
+ final var abbreviateIfLongerThan = 80;
+ return x.length() > abbreviateIfLongerThan ? x.substring(0,
abbreviateIfLongerThan) + "..." : x;
+ }
+
+ private @NonNull Optional<String> targetBookmarkIfAny() {
+ return commandRecord()
+ .map(CommandRecord::target)
+ .map(Bookmark::stringify);
+ }
+
+
@Property
@PropertyLayout(
sequence = "9",
@@ -663,7 +705,10 @@ private Optional<CommandRecord> commandRecord() {
.filter(commandLogEntry ->
commandLogEntry.getReplayState() != null)
.map(commandLogEntry -> new CommandRecord(
commandLogEntry.getCommandDto(),
- commandLogEntry.getReplayState()))
+ commandLogEntry.getReplayState(),
+ commandLogEntry.getReplayStateFailureReason(),
+ commandLogEntry.getTarget()
+ ))
.orElse(null)));
}
diff --git
a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.layout.fallback.xml
b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.layout.fallback.xml
index e5631fa84b5..765de8e258d 100644
---
a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.layout.fallback.xml
+++
b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/ReplayableCommand.layout.fallback.xml
@@ -35,7 +35,6 @@
<cpt:fieldSet name="Metadata"
id="metadata">
<cpt:property id="logicalTypeName"/>
<cpt:property id="interactionId"/>
- <cpt:property id="member"/>
</cpt:fieldSet>
</bs:col>
</bs:row>
@@ -43,6 +42,15 @@
</bs:tabGroup>
</bs:col>
</bs:row>
+ <bs:row>
+ <bs:col span="12">
+ <cpt:fieldSet name="Target">
+ <cpt:action id="openTarget"/>
+ <cpt:property id="target"/>
+ <cpt:property id="member"/>
+ </cpt:fieldSet>
+ </bs:col>
+ </bs:row>
<bs:row>
<bs:col span="12">
<cpt:fieldSet name="Control" id="control">
@@ -56,9 +64,9 @@
</bs:row>
<bs:row>
<bs:col span="12">
- <cpt:fieldSet name="Target">
- <cpt:property id="target"/>
+ <cpt:fieldSet name="Result" id="result">
<cpt:property id="hasResult"/>
+ <cpt:property id="replayStateFailureReason"/>
</cpt:fieldSet>
</bs:col>
</bs:row>