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 2018/11/01 07:47:41 UTC

[isis] branch master updated: ISIS-2025: further checks for wrapTry

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

danhaywood 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 6064058  ISIS-2025: further checks for wrapTry
6064058 is described below

commit 6064058da83b4246934c8df94f3492725e451e02
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Nov 1 07:46:41 2018 +0000

    ISIS-2025: further checks for wrapTry
---
 .../handlers/DomainObjectInvocationHandler.java    | 106 +++++++++++++++++----
 1 file changed, 90 insertions(+), 16 deletions(-)

diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DomainObjectInvocationHandler.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DomainObjectInvocationHandler.java
index c628799..91bb4de 100644
--- a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DomainObjectInvocationHandler.java
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DomainObjectInvocationHandler.java
@@ -394,9 +394,20 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
             final ObjectAdapter targetAdapter, final ObjectSpecification targetNoSpec) {
 
         if(getExecutionMode().shouldEnforceRules()) {
-            final InteractionResult interactionResult =
-                    targetNoSpec.isValidResult(targetAdapter, getInteractionInitiatedBy());
-            notifyListenersAndVetoIfRequired(interactionResult);
+            if(getExecutionMode().shouldFailFast()) {
+                final InteractionResult interactionResult =
+                        targetNoSpec.isValidResult(targetAdapter, getInteractionInitiatedBy());
+                notifyListenersAndVetoIfRequired(interactionResult);
+            } else {
+                try {
+                    final InteractionResult interactionResult =
+                            targetNoSpec.isValidResult(targetAdapter, getInteractionInitiatedBy());
+                    notifyListenersAndVetoIfRequired(interactionResult);
+                } catch(Exception ex) {
+                    return null;
+                }
+            }
+
         }
 
         if (getExecutionMode().shouldExecute()) {
@@ -429,7 +440,17 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
         }
 
         if(getExecutionMode().shouldEnforceRules()) {
-            checkVisibility(targetAdapter, property);
+            if(getExecutionMode().shouldFailFast()) {
+                checkVisibility(targetAdapter, property);
+            } else {
+                try {
+                    checkVisibility(targetAdapter, property);
+                } catch(Exception ex) {
+                    return null;
+
+                }
+            }
+
         }
 
         resolveIfRequired(targetAdapter);
@@ -459,8 +480,18 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
         final Object argumentObj = underlying(args[0]);
 
         if(getExecutionMode().shouldEnforceRules()) {
-            checkVisibility(targetAdapter, property);
-            checkUsability(targetAdapter, property);
+            if(getExecutionMode().shouldFailFast()) {
+                checkVisibility(targetAdapter, property);
+                checkUsability(targetAdapter, property);
+            } else {
+                try {
+                    checkVisibility(targetAdapter, property);
+                    checkUsability(targetAdapter, property);
+                } catch(Exception ex) {
+                    return null;
+                }
+            }
+
         }
 
         final ObjectAdapter argumentAdapter = argumentObj != null ? adapterFor(argumentObj) : null;
@@ -506,7 +537,16 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
         }
 
         if(getExecutionMode().shouldEnforceRules()) {
-            checkVisibility(targetAdapter, collection);
+            if(getExecutionMode().shouldFailFast()) {
+                checkVisibility(targetAdapter, collection);
+            } else {
+                try {
+                    checkVisibility(targetAdapter, collection);
+                } catch(Exception ex) {
+                    return null;
+                }
+            }
+
         }
 
         resolveIfRequired(targetAdapter);
@@ -565,8 +605,17 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
         }
 
         if(getExecutionMode().shouldEnforceRules()) {
-            checkVisibility(targetAdapter, otma);
-            checkUsability(targetAdapter, otma);
+            if(getExecutionMode().shouldFailFast()) {
+                checkVisibility(targetAdapter, otma);
+                checkUsability(targetAdapter, otma);
+            } else {
+                try {
+                    checkVisibility(targetAdapter, otma);
+                    checkUsability(targetAdapter, otma);
+                } catch(Exception ex) {
+                    return null;
+                }
+            }
         }
 
         resolveIfRequired(targetAdapter);
@@ -612,8 +661,18 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
         }
 
         if(getExecutionMode().shouldEnforceRules()) {
-            checkVisibility(targetAdapter, collection);
-            checkUsability(targetAdapter, collection);
+            if(getExecutionMode().shouldFailFast()) {
+                checkVisibility(targetAdapter, collection);
+                checkUsability(targetAdapter, collection);
+            } else {
+                try {
+                    checkVisibility(targetAdapter, collection);
+                    checkUsability(targetAdapter, collection);
+                } catch(Exception ex) {
+                    return null;
+                }
+            }
+
         }
 
 
@@ -671,13 +730,28 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
         }
 
         if(getExecutionMode().shouldEnforceRules()) {
-            if(contributeeMember != null) {
-                checkVisibility(contributeeAdapter, contributeeMember);
-                checkUsability(contributeeAdapter, contributeeMember);
+            if(getExecutionMode().shouldFailFast()) {
+                if(contributeeMember != null) {
+                    checkVisibility(contributeeAdapter, contributeeMember);
+                    checkUsability(contributeeAdapter, contributeeMember);
+                } else {
+                    checkVisibility(targetAdapter, objectAction);
+                    checkUsability(targetAdapter, objectAction);
+                }
             } else {
-                checkVisibility(targetAdapter, objectAction);
-                checkUsability(targetAdapter, objectAction);
+                try {
+                    if(contributeeMember != null) {
+                        checkVisibility(contributeeAdapter, contributeeMember);
+                        checkUsability(contributeeAdapter, contributeeMember);
+                    } else {
+                        checkVisibility(targetAdapter, objectAction);
+                        checkUsability(targetAdapter, objectAction);
+                    }
+                } catch(Exception ex) {
+                    return null;
+                }
             }
+
         }
 
         final ObjectAdapter[] argAdapters = asObjectAdaptersUnderlying(args);