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/06/14 06:49:33 UTC
[isis] branch master updated: ISIS-2738: MM diff report: on facet
diff also report the attributes
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 665725b ISIS-2738: MM diff report: on facet diff also report the attributes
665725b is described below
commit 665725b51e80caec88bfd5e0f556d3b7cd3d45e0
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Jun 14 08:49:22 2021 +0200
ISIS-2738: MM diff report: on facet diff also report the attributes
---
.../applib/services/metamodel/_DiffExport.java | 27 ++++++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/metamodel/_DiffExport.java b/api/applib/src/main/java/org/apache/isis/applib/services/metamodel/_DiffExport.java
index caba049..66101f2 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/metamodel/_DiffExport.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/metamodel/_DiffExport.java
@@ -205,27 +205,44 @@ class _DiffExport {
private void diffFacets(DiffModel diffModel, String typeOrMemberId,
Facets leftFacets, Facets rightFacets) {
- val sb = diffModel.sb;
val leftFacet = findFirstFacet(leftFacets, diffModel.facetFilter);
val rightFacet = findFirstFacet(rightFacets, diffModel.facetFilter);
if(leftFacet.isPresent()) {
if(!rightFacet.isPresent()) {
- sb.append(LEFT_SYMBOL).append(" ").append(typeOrMemberId).append("\n");
- diffModel.diffCout++;
+ reportFacetNotInOther(diffModel, LEFT_SYMBOL, typeOrMemberId, leftFacet.get());
} else {
diffAttrs(diffModel, typeOrMemberId, leftFacet.get(), rightFacet.get());
}
} else {
if(rightFacet.isPresent()) {
- sb.append(RIGHT_SYMBOL).append(" ").append(typeOrMemberId).append("\n");
- diffModel.diffCout++;
+ reportFacetNotInOther(diffModel, RIGHT_SYMBOL, typeOrMemberId, rightFacet.get());
} else {
// skip (absent in both)
}
}
}
+ private void reportFacetNotInOther(DiffModel diffModel, String symbol, String typeOrMemberId, Facet facet) {
+ val sb = diffModel.sb;
+ val attrKeyValueLiterals = streamFacetAttr(facet)
+ .map(attr->attr.getName())
+ .collect(Can.toCan());
+
+ // even if there are no attributes, we still want to report that there is a difference with facets
+ val attrKeyValueOrEmptyLiterals =
+ attrKeyValueLiterals.isEmpty()
+ ? Can.of("<no-attributes>")
+ : attrKeyValueLiterals;
+
+ attrKeyValueOrEmptyLiterals.forEach(attrKeyValueLiteral->{
+ sb.append(symbol).append(" ").append(typeOrMemberId)
+ .append(" ").append(attrKeyValueLiteral)
+ .append("\n");
+ });
+ diffModel.diffCout++;
+ }
+
private void diffAttrs(DiffModel diffModel, String typeOrMemberId, Facet leftFacet, Facet rightFacet) {
val sb = diffModel.sb;