You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/07/08 22:55:18 UTC
(causeway) branch maintenance-branch updated: maintenance-branch: adds guard in the other impl of DataRow
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch maintenance-branch
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/maintenance-branch by this push:
new 7b8fdc1478 maintenance-branch: adds guard in the other impl of DataRow
7b8fdc1478 is described below
commit 7b8fdc14785179bebb33aabfc61ce2c4c667749b
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Jul 8 23:55:17 2024 +0100
maintenance-branch: adds guard in the other impl of DataRow
doh
---
.../core/metamodel/tabular/interactive/DataRow.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/interactive/DataRow.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/interactive/DataRow.java
index d1abc1c754..364581e8bf 100644
--- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/interactive/DataRow.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/interactive/DataRow.java
@@ -21,9 +21,11 @@ package org.apache.causeway.core.metamodel.tabular.interactive;
import java.util.Optional;
import java.util.UUID;
+import org.apache.causeway.applib.annotation.Where;
import org.apache.causeway.commons.collections.Can;
import org.apache.causeway.commons.internal.binding._Bindables;
import org.apache.causeway.commons.internal.binding._Bindables.BooleanBindable;
+import org.apache.causeway.core.metamodel.consent.InteractionInitiatedBy;
import org.apache.causeway.core.metamodel.object.ManagedObject;
import org.apache.causeway.core.metamodel.object.ManagedObjects;
import org.apache.causeway.core.metamodel.spec.feature.ObjectAssociation;
@@ -75,8 +77,16 @@ public class DataRow {
public Can<ManagedObject> getCellElementsForColumn(final @NonNull DataColumn column) {
final ObjectAssociation assoc = column.getAssociationMetaModel();
return assoc.getSpecialization().fold(
- property->Can.of(property.get(getRowElement())),
- collection->ManagedObjects.unpack(collection.get(getRowElement())));
+ property-> Can.of(
+ // similar to ManagedProperty#reassessPropertyValue
+ property.isVisible(getRowElement(), InteractionInitiatedBy.PASS_THROUGH, Where.ALL_TABLES).isAllowed()
+ ? property.get(getRowElement(), InteractionInitiatedBy.PASS_THROUGH)
+ : ManagedObject.empty(property.getElementType())),
+ collection-> ManagedObjects.unpack(
+ collection.isVisible(getRowElement(), InteractionInitiatedBy.PASS_THROUGH, Where.ALL_TABLES).isAllowed()
+ ? collection.get(getRowElement(), InteractionInitiatedBy.PASS_THROUGH)
+ : null
+ ));
}
/**