You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2023/09/26 15:26:46 UTC

[causeway] branch master updated: CAUSEWAY-3607: fixes ParamDto getting initialized by its "Friendly Name"

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

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/master by this push:
     new f5c1500b8d CAUSEWAY-3607: fixes ParamDto getting initialized by its "Friendly Name"
f5c1500b8d is described below

commit f5c1500b8dd007bff31f4680e6c3a07b5a40a66d
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Sep 26 17:26:41 2023 +0200

    CAUSEWAY-3607: fixes ParamDto getting initialized by its "Friendly Name"
---
 .../java/org/apache/causeway/applib/util/schema/CommonDtoUtils.java | 4 ++++
 .../core/runtimeservices/command/CommandDtoFactoryDefault.java      | 6 ++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/causeway/applib/util/schema/CommonDtoUtils.java b/api/applib/src/main/java/org/apache/causeway/applib/util/schema/CommonDtoUtils.java
index 7de01bbdde..8c83d52b33 100644
--- a/api/applib/src/main/java/org/apache/causeway/applib/util/schema/CommonDtoUtils.java
+++ b/api/applib/src/main/java/org/apache/causeway/applib/util/schema/CommonDtoUtils.java
@@ -623,6 +623,10 @@ public final class CommonDtoUtils {
 
     // -- PARAM DTO FACTORIES
 
+    /**
+     * @param paramName name by which the parameter is identified
+     * (not its friendly name for rendering)
+     */
     public static ParamDto paramDto(final @NonNull String paramName) {
         val paramDto = new ParamDto();
         if(paramName.isBlank()) {
diff --git a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandDtoFactoryDefault.java b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandDtoFactoryDefault.java
index bb688dee6e..7846ba9d0e 100644
--- a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandDtoFactoryDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandDtoFactoryDefault.java
@@ -31,8 +31,8 @@ import org.apache.causeway.applib.annotation.PriorityPrecedence;
 import org.apache.causeway.applib.services.clock.ClockService;
 import org.apache.causeway.applib.services.user.UserService;
 import org.apache.causeway.applib.util.schema.CommandDtoUtils;
+import org.apache.causeway.applib.util.schema.CommonDtoUtils;
 import org.apache.causeway.commons.collections.Can;
-import org.apache.causeway.commons.internal.exceptions._Exceptions;
 import org.apache.causeway.core.metamodel.facetapi.FeatureType;
 import org.apache.causeway.core.metamodel.facets.actions.action.invocation.IdentifierUtil;
 import org.apache.causeway.core.metamodel.interactions.InteractionHead;
@@ -120,9 +120,7 @@ public class CommandDtoFactoryDefault implements CommandDtoFactory {
 
             val argAdapter = argAdapters.getElseFail(paramNum);
 
-            final ParamDto paramDto = new ParamDto();
-            paramDto.setName(actionParameter.getStaticFriendlyName()
-                    .orElseThrow(_Exceptions::unexpectedCodeReach));
+            final ParamDto paramDto = CommonDtoUtils.paramDto(actionParameter.getId());
 
             actionParameter.getFeatureIdentifier();