You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2022/11/04 11:45:46 UTC
[isis] 03/03: ISIS-3267: fixes compile issue
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-3267
in repository https://gitbox.apache.org/repos/asf/isis.git
commit d7fc1cbe69d2269dddeeb99c7393ffe9a18de643
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Nov 4 11:42:53 2022 +0000
ISIS-3267: fixes compile issue
---
.../wrapper/WrapperFactoryDefault.java | 31 +++++++++++++---------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/wrapper/WrapperFactoryDefault.java b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/wrapper/WrapperFactoryDefault.java
index c3a01281ed..7e9ec26b4b 100644
--- a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/wrapper/WrapperFactoryDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/wrapper/WrapperFactoryDefault.java
@@ -30,6 +30,7 @@ import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.function.BiConsumer;
+import java.util.function.Function;
import javax.annotation.PostConstruct;
import javax.annotation.Priority;
@@ -37,6 +38,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
+import org.apache.causeway.commons.functional.Try;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -641,20 +643,23 @@ implements WrapperFactory, HasMetaModelContext {
val childCommand = interactionProviderProvider.get().currentInteractionElseFail().getCommand();
childCommand.updater().setParentInteractionId(asyncCallable.getParentInteractionId());
- val bookmark = commandExecutorServiceProvider.get()
+ val tryBookmark = commandExecutorServiceProvider.get()
.executeCommand(asyncCallable.getCommandDto(), childCommand.updater());
- if (bookmark == null) {
- return null;
- }
- val spec = getSpecificationLoader().specForBookmark(bookmark).orElse(null);
- if(spec==null) {
- return null;
- }
- R domainObject = bookmarkServiceProvider.get().lookup(bookmark, asyncCallable.getReturnType()).orElse(null);
- if(spec.isEntity()) {
- domainObject = repositoryServiceProvider.get().detach(domainObject);
- }
- return domainObject;
+
+ return tryBookmark.fold(
+ throwable -> null, // failure
+ bookmarkIfAny -> bookmarkIfAny.map( // success
+ bookmark -> {
+ val spec = getSpecificationLoader().specForBookmark(bookmark).orElse(null);
+ if(spec==null) {
+ return null;
+ }
+ R domainObject = bookmarkServiceProvider.get().lookup(bookmark, asyncCallable.getReturnType()).orElse(null);
+ if(spec.isEntity()) {
+ domainObject = repositoryServiceProvider.get().detach(domainObject);
+ }
+ return domainObject;
+ }).orElse(null));
}
}