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 cd01f4e1e0 ISIS-3263: actually allow (mixed-in) actions to be executed 
on deleted entities
cd01f4e1e0 is described below

commit cd01f4e1e014f090174457a837baf99befc894fb
Author: Andi Huber <[email protected]>
AuthorDate: Wed Oct 26 18:15:38 2022 +0200

    ISIS-3263: actually allow (mixed-in) actions to be executed on deleted
    entities
    
    - valid use-case is the application user delete action which returns a
    collection of remaining existing users, not requiring the just deleted
    user to produce the result
---
 .../core/metamodel/interactions/managed/ManagedAction.java | 14 ++++++++++----
 .../core/metamodel/object/_ManagedObjectEntityHybrid.java  |  2 --
 examples/demo/domain/src/main/resources/banner.txt         |  4 ++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git 
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/interactions/managed/ManagedAction.java
 
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/interactions/managed/ManagedAction.java
index bb8508d794..e18a23f346 100644
--- 
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/interactions/managed/ManagedAction.java
+++ 
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/interactions/managed/ManagedAction.java
@@ -91,10 +91,16 @@ public final class ManagedAction extends ManagedMember {
             final @NonNull MultiselectChoices multiselectChoices) {
 
         super(owner, where);
-        _Assert.assertFalse(ManagedObjects.isNullOrUnspecifiedOrEmpty(owner), 
()->
-                String.format("cannot create managed-action for action %s with 
an empty owner %s",
-                        action.getFeatureIdentifier(),
-                        owner));
+        /* entities might become removed, but even though removed, an entity 
delete mixin say,
+            may still want to provide an action result, that does not need the 
mixee instance to be produced;
+            eg. delete ApplicationUser mixin that returns a collection of all 
remaining users
+            after deleting the selected one */
+        if(!owner.getSpecialization().isEntity()) {
+            
_Assert.assertFalse(ManagedObjects.isNullOrUnspecifiedOrEmpty(owner), ()->
+                    String.format("cannot create managed-action for action %s 
with an empty owner %s",
+                            action.getFeatureIdentifier(),
+                            owner));
+        }
         this.action = action;
         this.multiselectChoices = multiselectChoices;
     }
diff --git 
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/object/_ManagedObjectEntityHybrid.java
 
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/object/_ManagedObjectEntityHybrid.java
index c27e1fe475..6b838642d0 100644
--- 
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/object/_ManagedObjectEntityHybrid.java
+++ 
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/object/_ManagedObjectEntityHybrid.java
@@ -108,8 +108,6 @@ implements _Refetchable {
         val entityState = variant.getEntityState();
         val newMorphState = MorphState.valueOf(entityState);
 
-        System.err.printf("%s -> %s%n", peekAtPojo(), entityState);
-
         if(this.morphState!=newMorphState) {
             log.debug("about to transition to {} variant given {}", 
newMorphState.name(), entityState);
             reassessVariant(entityState, peekAtPojo());
diff --git a/examples/demo/domain/src/main/resources/banner.txt 
b/examples/demo/domain/src/main/resources/banner.txt
index 11c71d519f..a3bbb7d27b 100644
--- a/examples/demo/domain/src/main/resources/banner.txt
+++ b/examples/demo/domain/src/main/resources/banner.txt
@@ -2,5 +2,5 @@
    /_\    _ __   __ _   __  | |_    ___     / __|  __ _   _  _   ___  ___  __ 
__ __  __ _   _  _ 
   / _ \  | '_ \ / _` | / _| | ' \  / -_)   | (__  / _` | | || | (_-< / -_) \ V 
 V / / _` | | || |
  /_/ \_\ | .__/ \__,_| \__| |_||_| \___|    \___| \__,_|  \_,_| /__/ \___|  
\_/\_/  \__,_|  \_, |
-         |_|                                                                   
             |__/           
-Powered by Spring Boot ${spring-boot.version}
\ No newline at end of file
+ ======= |_| 
=============================================================================== 
|__/           
+Powered by Spring Boot ${spring-boot.version}

Reply via email to