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/causeway.git


The following commit(s) were added to refs/heads/master by this push:
     new f1d4898460 CAUSEWAY-3344: split up entity diagram page into 2
f1d4898460 is described below

commit f1d48984607ac579540bf96ce4490df330a41364
Author: Andi Huber <[email protected]>
AuthorDate: Sat Jan 28 08:28:27 2023 +0100

    CAUSEWAY-3344: split up entity diagram page into 2
    
    - framework built-in entities
    - non framework built-in entities
---
 .../extensions/docgen/CausewayModuleExtDocgen.java | 14 ++++--
 .../domainobjects/CausewayEntityDiagramPage.java   | 54 ++++++++++++++++++++++
 .../domainobjects/DomainEntityDiagramPage.java     | 54 ++++++++++++++++++++++
 ...ramPage.java => EntityDiagramPageAbstract.java} | 17 ++-----
 4 files changed, 122 insertions(+), 17 deletions(-)

diff --git 
a/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/CausewayModuleExtDocgen.java
 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/CausewayModuleExtDocgen.java
index b130322c63..2b24950b5f 100644
--- 
a/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/CausewayModuleExtDocgen.java
+++ 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/CausewayModuleExtDocgen.java
@@ -26,7 +26,8 @@ import org.springframework.context.annotation.Import;
 
 import org.apache.causeway.extensions.docgen.applib.HelpNode.HelpTopic;
 import org.apache.causeway.extensions.docgen.menu.DocumentationMenu;
-import 
org.apache.causeway.extensions.docgen.topics.domainobjects.EntityDiagramPage;
+import 
org.apache.causeway.extensions.docgen.topics.domainobjects.CausewayEntityDiagramPage;
+import 
org.apache.causeway.extensions.docgen.topics.domainobjects.DomainEntityDiagramPage;
 import org.apache.causeway.extensions.docgen.topics.welcome.WelcomeHelpPage;
 
 import lombok.val;
@@ -42,7 +43,8 @@ import lombok.val;
 
     // help pages, as required by the default RootHelpTopic below (in case 
when to be managed by Spring)
     WelcomeHelpPage.class,
-    EntityDiagramPage.class
+    CausewayEntityDiagramPage.class,
+    DomainEntityDiagramPage.class
 
 })
 public class CausewayModuleExtDocgen {
@@ -57,14 +59,18 @@ public class CausewayModuleExtDocgen {
     @Qualifier("Default")
     public HelpTopic rootHelpTopic(
             final WelcomeHelpPage welcomeHelpPage,
-            final EntityDiagramPage entityDiagramPage) {
+            final CausewayEntityDiagramPage causewayEntityDiagramPage,
+            final DomainEntityDiagramPage domainEntityDiagramPage) {
 
         val root = HelpTopic.root("Topics");
 
         root.addPage(welcomeHelpPage);
 
+        root.subTopic("Causeway")
+            .addPage(causewayEntityDiagramPage);
+
         root.subTopic("Domain")
-            .addPage(entityDiagramPage);
+            .addPage(domainEntityDiagramPage);
 
         return root;
     }
diff --git 
a/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/CausewayEntityDiagramPage.java
 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/CausewayEntityDiagramPage.java
new file mode 100644
index 0000000000..0af2b1c501
--- /dev/null
+++ 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/CausewayEntityDiagramPage.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.extensions.docgen.topics.domainobjects;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.springframework.stereotype.Component;
+
+import org.apache.causeway.core.config.beans.CausewayBeanTypeRegistry;
+import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
+import org.apache.causeway.core.metamodel.specloader.SpecificationLoader;
+import org.apache.causeway.extensions.docgen.CausewayModuleExtDocgen;
+
+import lombok.val;
+
+@Component
+@Named(CausewayModuleExtDocgen.NAMESPACE + ".CausewayEntityDiagramPage")
+public class CausewayEntityDiagramPage extends EntityDiagramPageAbstract {
+
+    @Inject
+    public CausewayEntityDiagramPage(final SpecificationLoader specLoader, 
final CausewayBeanTypeRegistry beanTypeRegistry) {
+        super(specLoader, beanTypeRegistry);
+    }
+
+    @Override
+    public String getTitle() {
+        return "Causeway Entity Diagram";
+    }
+
+    protected boolean accept(final ObjectSpecification objSpec) {
+        val ns = "" + objSpec.getLogicalType().getNamespace();
+        return ns.equals("causeway")
+                || ns.startsWith("causeway.");
+    }
+
+}
+
diff --git 
a/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/DomainEntityDiagramPage.java
 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/DomainEntityDiagramPage.java
new file mode 100644
index 0000000000..5149656eb3
--- /dev/null
+++ 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/DomainEntityDiagramPage.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.extensions.docgen.topics.domainobjects;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.springframework.stereotype.Component;
+
+import org.apache.causeway.core.config.beans.CausewayBeanTypeRegistry;
+import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
+import org.apache.causeway.core.metamodel.specloader.SpecificationLoader;
+import org.apache.causeway.extensions.docgen.CausewayModuleExtDocgen;
+
+import lombok.val;
+
+@Component
+@Named(CausewayModuleExtDocgen.NAMESPACE + ".DomainEntityDiagramPage")
+public class DomainEntityDiagramPage extends EntityDiagramPageAbstract {
+
+    @Inject
+    public DomainEntityDiagramPage(final SpecificationLoader specLoader, final 
CausewayBeanTypeRegistry beanTypeRegistry) {
+        super(specLoader, beanTypeRegistry);
+    }
+
+    @Override
+    public String getTitle() {
+        return "Domain Entity Diagram";
+    }
+
+    protected boolean accept(final ObjectSpecification objSpec) {
+        val ns = "" + objSpec.getLogicalType().getNamespace();
+        return !ns.equals("causeway")
+                && !ns.startsWith("causeway.");
+    }
+
+}
+
diff --git 
a/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/EntityDiagramPage.java
 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/EntityDiagramPageAbstract.java
similarity index 82%
rename from 
extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/EntityDiagramPage.java
rename to 
extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/EntityDiagramPageAbstract.java
index e9ec6c1924..38faf7748d 100644
--- 
a/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/EntityDiagramPage.java
+++ 
b/extensions/core/docgen/src/main/java/org/apache/causeway/extensions/docgen/topics/domainobjects/EntityDiagramPageAbstract.java
@@ -21,7 +21,6 @@ package 
org.apache.causeway.extensions.docgen.topics.domainobjects;
 import java.util.Optional;
 import java.util.stream.Stream;
 
-import javax.inject.Inject;
 import javax.inject.Named;
 
 import org.springframework.stereotype.Component;
@@ -37,18 +36,13 @@ import lombok.RequiredArgsConstructor;
 import lombok.val;
 
 @Component
-@Named(CausewayModuleExtDocgen.NAMESPACE + ".EntityDiagramPage")
-@RequiredArgsConstructor(onConstructor_ = {@Inject})
-public class EntityDiagramPage implements HelpPage {
+@Named(CausewayModuleExtDocgen.NAMESPACE + ".EntityDiagramPageAbstract")
+@RequiredArgsConstructor
+public abstract class EntityDiagramPageAbstract implements HelpPage {
 
     private final SpecificationLoader specLoader;
     private final CausewayBeanTypeRegistry beanTypeRegistry;
 
-    @Override
-    public String getTitle() {
-        return "Entity Diagram";
-    }
-
     @Override
     public AsciiDoc getContent() {
         return AsciiDoc.valueOf(
@@ -57,10 +51,7 @@ public class EntityDiagramPage implements HelpPage {
     }
 
     /** governs which entities to include */
-    protected boolean accept(final ObjectSpecification objSpec) {
-        // exclude demo entities, so we don't overflow kroki.io limits in the 
causeway demo app
-        return !"demo".equals(objSpec.getLogicalType().getNamespace());
-    }
+    protected abstract boolean accept(final ObjectSpecification objSpec);
 
     // -- HELPER
 

Reply via email to