Skip to content

Commit f5accdd

Browse files
authored
Merge pull request #3542 from apache/CAUSEWAY-3998
Causeway 3998
2 parents fba2137 + df0e09b commit f5accdd

8 files changed

Lines changed: 164 additions & 65 deletions

File tree

api/applib/src/test/java/org/apache/causeway/applib/util/schema/CommandDtoUtils_fromYaml_Test.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public void scalarValuesAsMultiDocument() throws IOException {
5151
assertScalarCommands(commandDtos);
5252
}
5353

54+
@Test
55+
public void scalarValuesAsMultiDocumentWithTrailingEmptyDocument() throws IOException {
56+
var commandDtos = loadCommands("commands-with-scalar-params-multi-document-trailing-empty.yaml");
57+
58+
assertScalarCommands(commandDtos);
59+
}
60+
5461
private static void assertScalarCommands(final List<CommandDto> commandDtos) {
5562

5663
Assertions.assertThat(commandDtos).hasSize(2);

extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/CausewayModuleExtCommandLogApplib.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@
7272
ReplayableCommand_replayOrRetry.class,
7373
ReplayableCommand_excludeFromReplay.class,
7474
ReplayableCommand_delete.class,
75-
CommandExportManager.changeSince.class,
75+
CommandExportManager.changeBaseline.class,
7676
CommandExportManager.previousHour.class,
7777
CommandExportManager.nextHour.class,
7878
CommandExportManager.exportSelected.class,
7979
CommandExportManager.makeSelectedExportable.class,
80-
CommandReplayManager.changeSince.class,
80+
CommandReplayManager.changeBaseline.class,
8181
CommandExportManager.previousHour.class,
8282
CommandReplayManager.nextHour.class,
8383
CommandReplayManager.importCommands.class,

extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandExportManager.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public CommandExportManager(
7676
}
7777

7878
public CommandExportManager(
79-
final java.sql.Timestamp since,
79+
final java.sql.Timestamp baseline,
8080
final ReplayContext replayContext) {
81-
this.since = since;
81+
this.baseline = baseline;
8282
this.replayContext = replayContext;
8383
}
8484

@@ -88,9 +88,9 @@ public CommandExportManager(
8888

8989

9090
@Property
91-
@PropertyLayout(describedAs = "Only commands since this timestamp are available for export")
91+
@PropertyLayout(describedAs = "Only commands after this timestamp are available for export")
9292
@Getter
93-
private java.sql.Timestamp since;
93+
private java.sql.Timestamp baseline;
9494

9595
@Action(
9696
semantics = SemanticsOf.SAFE,
@@ -99,7 +99,7 @@ public CommandExportManager(
9999
executionPublishing = Publishing.DISABLED
100100
)
101101
@ActionLayout(
102-
associateWith = "since", sequence = "1",
102+
associateWith = "baseline", sequence = "1",
103103
named = "Previous",
104104
position = ActionLayout.Position.PANEL,
105105
describedAs = "Move back one hour"
@@ -108,7 +108,7 @@ public class previousHour {
108108
public class DomainEvent extends ActionDomainEvent<previousHour> { }
109109

110110
@MemberSupport public CommandExportManager act() {
111-
return new CommandExportManager(addSeconds(since, -3600), replayContext);
111+
return new CommandExportManager(addSeconds(baseline, -3600), replayContext);
112112
}
113113
}
114114

@@ -119,42 +119,42 @@ public class DomainEvent extends ActionDomainEvent<previousHour> { }
119119
executionPublishing = Publishing.DISABLED
120120
)
121121
@ActionLayout(
122-
associateWith = "since", sequence = "3",
122+
associateWith = "baseline", sequence = "3",
123123
named = "Next",
124124
position = ActionLayout.Position.PANEL,
125125
describedAs = "Move forward one hour"
126126
)
127127
public class nextHour {
128128
public class DomainEvent extends ActionDomainEvent<nextHour> { }
129129
@MemberSupport public CommandExportManager act() {
130-
return new CommandExportManager(addSeconds(since, +3600), replayContext);
130+
return new CommandExportManager(addSeconds(baseline, +3600), replayContext);
131131
}
132132
}
133133

134134
@Action(
135135
restrictTo = RestrictTo.PROTOTYPING,
136136
semantics = SemanticsOf.SAFE,
137137
commandPublishing = Publishing.DISABLED,
138-
domainEvent = changeSince.DomainEvent.class,
138+
domainEvent = changeBaseline.DomainEvent.class,
139139
executionPublishing = Publishing.DISABLED
140140
)
141141
@ActionLayout(
142-
associateWith = "since", sequence = "2",
142+
associateWith = "baseline", sequence = "2",
143143
named = "Change",
144144
position = ActionLayout.Position.PANEL
145145
)
146-
public class changeSince {
146+
public class changeBaseline {
147147
public class DomainEvent extends ActionDomainEvent<nextHour> { }
148-
@MemberSupport public CommandExportManager act(final java.sql.Timestamp since) {
149-
return new CommandExportManager(since, replayContext);
148+
@MemberSupport public CommandExportManager act(final java.sql.Timestamp baseline) {
149+
return new CommandExportManager(baseline, replayContext);
150150
}
151-
@MemberSupport public java.sql.Timestamp defaultSince() {
152-
return CommandExportManager.this.since;
151+
@MemberSupport public java.sql.Timestamp defaultBaseline() {
152+
return CommandExportManager.this.baseline;
153153
}
154154
}
155155

156-
private static Timestamp addSeconds(Timestamp since, int secondsToAdd) {
157-
return Timestamp.from(since.toInstant().plusSeconds(secondsToAdd));
156+
private static Timestamp addSeconds(Timestamp ts, int secondsToAdd) {
157+
return Timestamp.from(ts.toInstant().plusSeconds(secondsToAdd));
158158
}
159159

160160

@@ -165,7 +165,7 @@ private static Timestamp addSeconds(Timestamp since, int secondsToAdd) {
165165
describedAs = "Commands that can be exported"
166166
)
167167
public List<ReplayableCommand> getNotYetExported() {
168-
return commandLogEntryRepository().findForegroundSinceTimestampAndCanBeExported(since).stream()
168+
return commandLogEntryRepository().findForegroundSinceTimestampAndCanBeExported(baseline).stream()
169169
.map(entry->new ReplayableCommand(
170170
entry.getInteractionId(),
171171
replayContext))
@@ -257,7 +257,7 @@ public List<ReplayableCommand> choicesSelected() {
257257
@Collection
258258
@CollectionLayout(describedAs = "Commands that have been exported")
259259
public List<ReplayableCommand> getExported() {
260-
return commandLogEntryRepository().findForegroundSinceTimestampAndHasBeenExported(since).stream()
260+
return commandLogEntryRepository().findForegroundSinceTimestampAndHasBeenExported(baseline).stream()
261261
.map(entry->new ReplayableCommand(
262262
entry.getInteractionId(),
263263
replayContext))
@@ -308,7 +308,7 @@ public List<ReplayableCommand> choicesSelected() {
308308

309309
@Override
310310
public String viewModelMemento() {
311-
return TimestampMarshallUtil.toString(this.since);
311+
return TimestampMarshallUtil.toString(this.baseline);
312312
}
313313

314314
// -- HELPER

extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/dom/replay/CommandExportManager.layout.fallback.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<cpt:domainObject/>
55
</bs:col>
66
<bs:col span="3">
7-
<cpt:fieldSet name=" " id="since">
7+
<cpt:fieldSet name=" " id="baseline">
88
<cpt:action id="previousHour"/>
9-
<cpt:action id="changeSince"/>
9+
<cpt:action id="changeBaseline"/>
1010
<cpt:action id="nextHour"/>
11-
<cpt:property id="since"/>
11+
<cpt:property id="baseline"/>
1212
</cpt:fieldSet>
1313
</bs:col>
1414
<bs:col span="3">

0 commit comments

Comments
 (0)