You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/02/04 13:25:47 UTC

[isis] branch master updated: ISIS-2877: optimize: only query object's bookmark when we know its a REFERENCE type

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/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 6933b582 ISIS-2877: optimize: only query object's bookmark when we know its a REFERENCE type
6933b582 is described below

commit 6933b582418c560fa107992e792cd877d94caec3
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Feb 4 14:25:39 2022 +0100

    ISIS-2877: optimize: only query object's bookmark when we know its a
    REFERENCE type
---
 .../runtimeservices/command/SchemaValueMarshallerDefault.java | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/command/SchemaValueMarshallerDefault.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/command/SchemaValueMarshallerDefault.java
index 8f2134a..8c9b82b 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/command/SchemaValueMarshallerDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/command/SchemaValueMarshallerDefault.java
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import org.apache.isis.applib.annotation.PriorityPrecedence;
+import org.apache.isis.applib.services.bookmark.Bookmark;
 import org.apache.isis.applib.util.schema.CommonDtoUtils;
 import org.apache.isis.applib.value.semantics.ValueDecomposition;
 import org.apache.isis.applib.value.semantics.ValueSemanticsResolver;
@@ -65,12 +66,6 @@ extends SchemaValueMarshallerAbstract {
 
         valueDto.setType(context.getSchemaValueType());
 
-        val bookmark = value.getBookmark().orElse(null);
-        if(bookmark!=null) {
-            valueDto.setReference(bookmark.toOidDto());
-            return valueDto;
-        }
-
         switch (context.getSchemaValueType()) {
         case COMPOSITE:
             valueDto.setComposite(toTypedTuple(context, _Casts.<T>uncheckedCast(value.getPojo())));
@@ -79,7 +74,9 @@ extends SchemaValueMarshallerAbstract {
             recordValues(context, valueDto, ((PackedManagedObject)value).unpack());
             return valueDto;
         case REFERENCE:
-            // null reference
+            value.getBookmark()
+                .map(Bookmark::toOidDto)
+                .ifPresent(valueDto::setReference); // otherwise: null reference
             return valueDto;
 
         default: