andi-huber commented on code in PR #3212:
URL: https://github.com/apache/causeway/pull/3212#discussion_r2466502936
##########
core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/grid/GridSystemServiceBootstrap.java:
##########
@@ -626,4 +654,294 @@ private void addActionTo(
actionLayoutData.owner(owner);
}
+ @Override
+ public void normalize(final BSGrid grid, final Class<?> domainClass) {
+ final boolean valid = validateAndNormalize(grid, domainClass);
+ if (valid) {
+ overwriteFacets(grid, domainClass);
+ if(log.isDebugEnabled()) {
+ log.debug("Grid:\n\n{}\n\n", toXml(grid));
+ }
+ } else {
+ if(causewaySystemEnvironment.isPrototyping()) {
+ messageService.warnUser("Grid metadata errors for " +
grid.domainClass().getName() + "; check the error log");
+ }
+ log.error("Grid metadata errors in {}:\n\n{}\n\n",
grid.domainClass().getName(), toXml(grid));
+ }
+ }
+
+ /**
+ * Overwrites (replaces) any existing facets in the metamodel with info
taken from the grid.
+ *
+ * @implNote This code uses {@link FacetUtil#updateFacet(Facet)}
+ * because the layout might be reloaded from XML if reloading is supported.
+ */
+ private void overwriteFacets(
Review Comment:
too much code here, perhaps refactor into a GridTransformer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]