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 2024/06/28 13:42:11 UTC
(causeway) 01/02: CAUSEWAY-3799: removes unnecessary passing of Command into InteractionInternal
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch CAUSEWAY-3799
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 35e015d34e51b35fc7cf6da4b3a5c3ea397fa8e7
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jun 28 14:23:06 2024 +0100
CAUSEWAY-3799: removes unnecessary passing of Command into InteractionInternal
---
.../core/interaction/session/CausewayInteraction.java | 19 +++++++++----------
.../core/metamodel/execution/InteractionInternal.java | 6 ++++--
.../executor/MemberExecutorServiceDefault.java | 7 +++----
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java b/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java
index 8fd2426166..8d23f8ce17 100644
--- a/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java
+++ b/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java
@@ -100,11 +100,10 @@ implements InteractionInternal {
final ActionInvocation actionInvocation,
final ClockService clockService,
final MetricsService metricsService,
- final CommandPublisher commandPublisher,
- final Command command) {
+ final CommandPublisher commandPublisher) {
push(actionInvocation);
- start(actionInvocation, clockService, metricsService, commandPublisher, command);
+ start(actionInvocation, clockService, metricsService, commandPublisher);
try {
return executeInternal(memberExecutor, actionInvocation);
} finally {
@@ -122,7 +121,7 @@ implements InteractionInternal {
final Command command) {
push(propertyEdit);
- start(propertyEdit, clockService, metricsService, commandPublisher, command);
+ start(propertyEdit, clockService, metricsService, commandPublisher);
try {
return executeInternal(memberExecutor, propertyEdit);
} finally {
@@ -142,6 +141,7 @@ implements InteractionInternal {
// we rather print all of them, no matter whether recognized or not later on
// examples are IllegalArgument- or NullPointer- exceptions being swallowed when using the
// WrapperFactory utilizing async calls
+
log.error("failed to execute an interaction", _Exceptions.getRootCause(ex).orElse(null));
// just because an exception has thrown, does not mean it is that significant;
@@ -185,17 +185,16 @@ implements InteractionInternal {
final Execution<?,?> execution,
final ClockService clockService,
final MetricsService metricsService,
- final CommandPublisher commandPublisher,
- final Command command) {
+ final CommandPublisher commandPublisher) {
// set the startedAt (and update command if this is the top-most member execution)
// (this isn't done within Interaction#execute(...) because it requires the DTO
// to have been set on the current execution).
val startedAt = execution.start(clockService, metricsService);
- if(command.getStartedAt() == null) {
- command.updater().setStartedAt(startedAt);
- command.updater().setPublishingPhase(Command.CommandPublishingPhase.STARTED);
+ if(getCommand().getStartedAt() == null) {
+ getCommand().updater().setStartedAt(startedAt);
+ getCommand().updater().setPublishingPhase(Command.CommandPublishingPhase.STARTED);
}
- commandPublisher.start(command);
+ commandPublisher.start(getCommand());
}
/**
diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/execution/InteractionInternal.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/execution/InteractionInternal.java
index bf67058c81..500421f62f 100644
--- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/execution/InteractionInternal.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/execution/InteractionInternal.java
@@ -48,6 +48,9 @@ extends Interaction {
Object execute(final T currentExecution);
}
+ static class Context {
+
+ }
/**
* Use the provided {@link MemberExecutor} to invoke an action, with the provided
* {@link ActionInvocation} capturing
@@ -62,8 +65,7 @@ extends Interaction {
final ActionInvocation actionInvocation,
final ClockService clockService,
final MetricsService metricsService,
- final CommandPublisher commandPublisher,
- final Command command);
+ final CommandPublisher commandPublisher);
/**
* Use the provided {@link MemberExecutor} to edit a property, with the provided
diff --git a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/executor/MemberExecutorServiceDefault.java b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/executor/MemberExecutorServiceDefault.java
index f9d59146e5..761d5b1976 100644
--- a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/executor/MemberExecutorServiceDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/executor/MemberExecutorServiceDefault.java
@@ -150,9 +150,8 @@ implements MemberExecutorService {
}
val interaction = getInteractionElseFail();
- val command = interaction.getCommand();
- prepareCommandForPublishing(command, head, owningAction, facetHolder);
+ prepareCommandForPublishing(interaction.getCommand(), head, owningAction, facetHolder);
val xrayHandle = _Xray.enterActionInvocation(interactionLayerTracker, interaction, owningAction, head, argumentAdapters);
@@ -170,7 +169,7 @@ implements MemberExecutorService {
interaction, actionId, targetPojo, argumentPojos);
// sets up startedAt and completedAt on the execution, also manages the execution call graph
- interaction.execute(actionExecutor, actionInvocation, clockService, metricsService(), commandPublisherProvider.get(), command);
+ interaction.execute(actionExecutor, actionInvocation, clockService, metricsService(), commandPublisherProvider.get());
// handle any exceptions
val priorExecution = interaction.getPriorExecutionOrThrowIfAnyException(actionInvocation);
@@ -205,7 +204,7 @@ implements MemberExecutorService {
.updateResult((ActionInvocationDto)priorExecution.getDto(), owningAction, returnedAdapter);
// update Command (if required)
- setCommandResultIfEntity(command, returnedAdapter);
+ setCommandResultIfEntity(interaction.getCommand(), returnedAdapter);
// publish (if not a contributed association, query-only mixin)
if (ExecutionPublishingFacet.isPublishingEnabled(facetHolder)) {