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 2020/01/01 13:11:57 UTC

[isis] branch master updated (37f1077 -> 2ade5ed)

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

danhaywood pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git.


    from 37f1077  ISIS-2231: fixes unit tests for xdocreport (change of package = change of directory)
     new 32eef8c  ISIS-2158: fixes brandLogoHeader, cannot fallback to applicationName
     new f8b7d9a  ISIS-2226: adds overload for invoking method, need to unwrap Can<T>  to T[]
     new 2ade5ed  ISIS-2177: reinstates the ability to inject into persistent entities.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../config/viewer/wicket/WebAppConfiguration.java  |  2 +-
 .../apache/isis/metamodel/spec/ManagedObject.java  |  4 ++++
 .../datanucleus/JDOStateManagerForIsis.java        | 27 ++++++++++++++--------
 3 files changed, 23 insertions(+), 10 deletions(-)


[isis] 03/03: ISIS-2177: reinstates the ability to inject into persistent entities.

Posted by da...@apache.org.
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

commit 2ade5ed5e0a71b61df8058d2fc32cd97c7c8484f
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 1 13:07:02 2020 +0000

    ISIS-2177: reinstates the ability to inject into persistent entities.
    
    Use of a thread-local to obtain the current IsisSession would seem to be unavoidable.
---
 .../datanucleus/JDOStateManagerForIsis.java        | 27 ++++++++++++++--------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/core/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/datanucleus/JDOStateManagerForIsis.java b/core/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/datanucleus/JDOStateManagerForIsis.java
index 4c3ea66..2983513 100644
--- a/core/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/datanucleus/JDOStateManagerForIsis.java
+++ b/core/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/datanucleus/JDOStateManagerForIsis.java
@@ -19,6 +19,8 @@
 
 package org.apache.isis.persistence.jdo.datanucleus5.datanucleus;
 
+import org.apache.isis.runtime.context.IsisContext;
+import org.apache.isis.runtime.session.IsisSession;
 import org.datanucleus.ExecutionContext;
 import org.datanucleus.cache.CachedPC;
 import org.datanucleus.enhancement.Persistable;
@@ -32,17 +34,21 @@ import org.apache.isis.persistence.jdo.datanucleus5.datanucleus.service.eventbus
 
 import lombok.extern.log4j.Log4j2;
 
-//FIXME currently is a noop, resurrect or remove see https://stackoverflow.com/a/11648163/9269480
+import java.util.Optional;
+
+/**
+ * Although injection into domain objects is considered by some "unusual"
+ * (see eg https://stackoverflow.com/a/11648163/9269480)
+ * it has always been supported by the Apache Isis framework as one of the
+ * main mechanisms in support of "behaviourally complete" objects.
+ */
 @Log4j2
 public class JDOStateManagerForIsis extends ReferentialStateManagerImpl {
 
-    private final ServiceInjector serviceInjector = null;
-    
-    public JDOStateManagerForIsis(ExecutionContext ec, AbstractClassMetaData cmd) {
+    public JDOStateManagerForIsis(
+            final ExecutionContext ec,
+            final AbstractClassMetaData cmd) {
         super(ec, cmd);
-//        this.serviceInjector = (ServiceInjector) ec.getProperty("serviceInjector");
-//        requires(serviceInjector, "serviceInjector");
-        log.warn("not implemented: #injectServicesInto(...)");
     }
 
     public enum Hint {
@@ -222,8 +228,11 @@ public class JDOStateManagerForIsis extends ReferentialStateManagerImpl {
     }
 
     protected void injectServicesInto(Persistable pc) {
-        if(serviceInjector!=null) {
-            serviceInjector.injectServicesInto(pc);
+        final Optional<IsisSession> isisSessionIfAny = IsisContext.getCurrentIsisSession();
+        if(isisSessionIfAny.isPresent()) {
+            isisSessionIfAny.get().getServiceInjector().injectServicesInto(pc);
+        } else {
+            log.warn("could not inject into PC, no isis session");
         }
     }
     


[isis] 02/03: ISIS-2226: adds overload for invoking method, need to unwrap Can to T[]

Posted by da...@apache.org.
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

commit f8b7d9a877b172e41d85a12b5ee13ba45cf243af
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 1 13:03:47 2020 +0000

    ISIS-2226: adds overload for invoking method, need to unwrap Can<T>  to T[]
---
 .../src/main/java/org/apache/isis/metamodel/spec/ManagedObject.java   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/metamodel/src/main/java/org/apache/isis/metamodel/spec/ManagedObject.java b/core/metamodel/src/main/java/org/apache/isis/metamodel/spec/ManagedObject.java
index 3b80096..64c3eec 100644
--- a/core/metamodel/src/main/java/org/apache/isis/metamodel/spec/ManagedObject.java
+++ b/core/metamodel/src/main/java/org/apache/isis/metamodel/spec/ManagedObject.java
@@ -423,6 +423,10 @@ public interface ManagedObject {
             return MethodExtensions.invoke(method, unwrapPojo(adapter), new Object[] {arg0});
         }
     
+        public static Object invoke(Method method, ManagedObject adapter, Can<ManagedObject> args) {
+            return invoke(method, adapter, args.toList().toArray(new ManagedObject[]{}));
+        }
+
         public static Object invoke(Method method, ManagedObject adapter, ManagedObject arg0Adapter) {
             return invoke(method, adapter, unwrapPojo(arg0Adapter));
         }


[isis] 01/03: ISIS-2158: fixes brandLogoHeader, cannot fallback to applicationName

Posted by da...@apache.org.
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

commit 32eef8c4a138daafd92f97d2d70e7cbb8094df30
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 1 11:33:57 2020 +0000

    ISIS-2158: fixes brandLogoHeader, cannot fallback to applicationName
    
    because it needs to be a URL
---
 .../java/org/apache/isis/config/viewer/wicket/WebAppConfiguration.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/config/src/main/java/org/apache/isis/config/viewer/wicket/WebAppConfiguration.java b/core/config/src/main/java/org/apache/isis/config/viewer/wicket/WebAppConfiguration.java
index 190f765..d57a5a8 100644
--- a/core/config/src/main/java/org/apache/isis/config/viewer/wicket/WebAppConfiguration.java
+++ b/core/config/src/main/java/org/apache/isis/config/viewer/wicket/WebAppConfiguration.java
@@ -84,7 +84,7 @@ public class WebAppConfiguration {
         this.applicationJs = ignoreLeadingSlash(application.getJs());
 
         this.brandLogoHeader = Optional.ofNullable(honorContextPath(application.getBrandLogoHeader()))
-                .orElse(this.applicationName);
+                .orElse(null);
         this.brandLogoSignin = Optional.ofNullable(honorContextPath(application.getBrandLogoSignin()))
                 .orElse(null);
         this.faviconUrl = honorContextPath(application.getFaviconUrl());