You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by jo...@apache.org on 2022/10/26 07:07:19 UTC

[isis] 02/04: ISIS-3171 property-descriptions loaded

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

joergrade pushed a commit to branch ISIS-3171
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 87d1b8b17876c10b59889687ba6aefd79fb27ff7
Author: Joerg Rade <jo...@kuehne-nagel.com>
AuthorDate: Fri Oct 14 15:38:51 2022 +0200

    ISIS-3171 property-descriptions loaded
---
 .../client/kroviz/core/aggregator/AggregatorWithLayout.kt |  8 ++++----
 .../isis/client/kroviz/core/aggregator/BaseAggregator.kt  |  2 +-
 .../client/kroviz/core/aggregator/CollectionAggregator.kt | 10 ++++++----
 .../client/kroviz/core/aggregator/ObjectAggregator.kt     | 15 +++++++--------
 .../isis/client/kroviz/core/model/CollectionProperties.kt |  4 ++--
 5 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt
index 19e687608b..e3207efb45 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt
@@ -31,7 +31,7 @@ import org.apache.isis.client.kroviz.ui.diagram.Tree
 abstract class AggregatorWithLayout : BaseAggregator() {
     // parentUrl is to be set in update
     // and to be used in subsequent invocations
-    var parentUrl: String? = null
+    private var parentUrl: String? = null
     var tree: Tree? = null
 
     override fun update(logEntry: LogEntry, subType: String?) {
@@ -98,9 +98,9 @@ abstract class AggregatorWithLayout : BaseAggregator() {
         invoke(l, aggregator, referrer = referrer)
     }
 
-    protected fun Property.descriptionLink(): Link? {
-        return links.find {
-            it.relation() == Relation.ELEMENT_TYPE
+    protected fun Property.getDescriptionLink(): Link? {
+        return this.links.firstOrNull() {
+            it.rel == Relation.DESCRIBED_BY.type
         }
     }
 
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/BaseAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/BaseAggregator.kt
index 135dc3f654..3589b6743c 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/BaseAggregator.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/BaseAggregator.kt
@@ -28,7 +28,7 @@ import org.apache.isis.client.kroviz.utils.UrlUtils
 
 /**
  * An Aggregator:
- * @item is initially created in ResponseHandlers, displayModels, Menus
+ * @item is initially created in ResponseHandlers, DisplayModels, Menus
  * @item is assigned to at least one LogEntry,
  * @item is passed on to related LogEntries (eg. siblings in a list, Layout),
  * @item is notified about changes to related LogEntries,
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt
index b1fd3c04a7..3ebee3f04e 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt
@@ -67,6 +67,7 @@ class CollectionAggregator(actionTitle: String, val parent: ObjectAggregator? =
                 }
             } else {
                 val le = LogEntry(ResourceSpecification(""))
+                //in case of a _parented_collection_ an empty LogEntry is passed on
                 parent.update(le, subType)
             }
         }
@@ -106,15 +107,16 @@ class CollectionAggregator(actionTitle: String, val parent: ObjectAggregator? =
     }
 
     private fun handleProperty(p: Property, referrer: String) {
+        console.log("[CA.handleProperty]")
         val dm = dpm as CollectionDM
         if (p.isPropertyDescription()) {
             dm.addPropertyDescription(p)
         } else {
             dm.addProperty(p)
-            val pdl = p.descriptionLink()
-            if (pdl != null) {
-                invoke(pdl, this, referrer = referrer)
-            }
+            val pdl = p.getDescriptionLink()
+            console.log(pdl)
+            if (pdl == null) return
+            invoke(pdl, this, referrer = referrer)
         }
     }
 
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt
index 3f175cc339..a0ad82c6df 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt
@@ -120,19 +120,18 @@ class ObjectAggregator(val actionTitle: String) : AggregatorWithLayout() {
     }
 
     private fun handleProperty(p: Property, referrer: String) {
+        console.log("[OA.handleProperty]")
         val dm = dpm as ObjectDM
         if (p.isPropertyDescription()) {
-            console.log("[OA.handleProperty].isPropertyDescription")
+            console.log("isPropertyDescription")
             dm.addPropertyDescription(p)
         } else {
-            console.log("[OA.handleProperty].isNotPropertyDescription")
-            console.log(p)
-            console.log(dm)
             dm.addProperty(p)
-            val pdl = p.descriptionLink()
-            if (pdl != null) {
-                invoke(pdl, this, referrer = referrer)
-            }
+            console.log(p)
+            val pdl = p.getDescriptionLink()
+            console.log(pdl)
+            if (pdl == null) return
+            invoke(pdl, this, referrer = referrer)
         }
     }
 
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/CollectionProperties.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/CollectionProperties.kt
index b18eb0059b..befdb20fcb 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/CollectionProperties.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/CollectionProperties.kt
@@ -19,8 +19,8 @@
 package org.apache.isis.client.kroviz.core.model
 
 import org.apache.isis.client.kroviz.layout.PropertyLt
-import org.apache.isis.client.kroviz.to.Property
 import org.apache.isis.client.kroviz.to.Extensions
+import org.apache.isis.client.kroviz.to.Property
 
 class CollectionProperties() {
     val list = mutableListOf<ColumnProperties>()
@@ -33,7 +33,7 @@ class CollectionProperties() {
         val pls = propertyLayoutList.size
         val pds = propertyDescriptionList.size
         val descriptionsComplete = (pds >= pls) && (ps >= pls)
-        return descriptionsComplete
+        return descriptionsComplete && pds > 0
     }
 
     fun addProperty(property: Property) {