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 2021/03/26 15:22:05 UTC

[isis] branch master updated: ISIS-2573: xray: integrate w/ entity change tracking

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 40ac173  ISIS-2573: xray: integrate w/ entity change tracking
40ac173 is described below

commit 40ac1730694b80df7d974a4c4a31fd89c22821e4
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Mar 26 16:21:56 2021 +0100

    ISIS-2573: xray: integrate w/ entity change tracking
---
 .../isis/core/runtimeservices/publish/_Xray.java   | 52 +++++++++++++++++++++-
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/publish/_Xray.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/publish/_Xray.java
index 08a6dbb..92f0399 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/publish/_Xray.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/publish/_Xray.java
@@ -115,7 +115,31 @@ final class _Xray {
             final @NonNull InteractionTracker iaTracker,
             final @NonNull Optional<EntityChanges> payload,
             final @NonNull Can<EntityChangesSubscriber> enabledSubscribers) {
-        return null;
+        
+        if(!XrayUi.isXrayEnabled()) {
+            return null;
+        }
+        
+        val enteringLabel = payload.isPresent() 
+                ? String.format("publishing entity-changes to %d subscriber(s)", enabledSubscribers.size())
+                : "not publishing entity-changes";
+        
+        val handleIfAny = XrayUtil.createSequenceHandle(iaTracker, "ec-publisher");
+        handleIfAny.ifPresent(handle->{
+            
+            handle.submit(sequenceData->{
+                
+                sequenceData.alias("ec-publisher", "EntityChanges-\nPublisher-\n(Default)");
+                
+                val callee = handle.getCallees().getFirstOrFail();
+                sequenceData.enter(handle.getCaller(), callee, enteringLabel);
+                sequenceData.activate(callee);
+            });
+            
+        });
+        
+        return handleIfAny.orElse(null);
+        
     }
     
     // -- ENTITY PROPERTY CHANGES
@@ -124,7 +148,31 @@ final class _Xray {
             final @NonNull InteractionTracker iaTracker,
             final @NonNull Can<EntityPropertyChange> payload,
             final @NonNull Can<EntityPropertyChangeSubscriber> enabledSubscribers) {
-        return null;
+        
+        if(!XrayUi.isXrayEnabled()) {
+            return null;
+        }
+        
+        val enteringLabel = !payload.isEmpty() 
+                ? String.format("publishing entity-property-changes to %d subscriber(s)", enabledSubscribers.size())
+                : "not publishing entity-property-changes";
+        
+        val handleIfAny = XrayUtil.createSequenceHandle(iaTracker, "epc-publisher");
+        handleIfAny.ifPresent(handle->{
+            
+            handle.submit(sequenceData->{
+                
+                sequenceData.alias("epc-publisher", "EntityProperty-\nChanges-Publisher-\n(Default)");
+                
+                val callee = handle.getCallees().getFirstOrFail();
+                sequenceData.enter(handle.getCaller(), callee, enteringLabel);
+                sequenceData.activate(callee);
+            });
+            
+        });
+        
+        return handleIfAny.orElse(null);
+        
     }
     
     // -- EXIT