You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2020/01/23 12:03:55 UTC

[isis] 03/08: ISIS-2264: removes 'checkModuleExtent' validator

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

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit f884aa6a2ad77794665af56a2bf45fcd7636ab3a
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 22 13:49:56 2020 +0000

    ISIS-2264: removes 'checkModuleExtent' validator
    
    ... this was already commented out, can't see that it adds much value in the context of Spring Boot.
    
    (cherry picked from commit 35a5ccabc429fc12ea8f96a36e5d7d0de52168f0)
---
 .../apache/isis/core/config/IsisConfiguration.java |  2 -
 .../metamodel/JdoProgrammingModelPlugin.java       | 76 ----------------------
 2 files changed, 78 deletions(-)

diff --git a/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java b/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java
index 7e79ae7..a5ced53 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java
@@ -1282,8 +1282,6 @@ public class IsisConfiguration {
                  */
                 private boolean ensureUniqueObjectTypes = true;
 
-                // TODO: to remove
-                private boolean checkModuleExtent = true;
                 /**
                  * If set, then checks that the supports <code>hideXxx</code> and <code>disableXxx</code> methods for
                  * actions do not have take parameters.
diff --git a/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/metamodel/JdoProgrammingModelPlugin.java b/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/metamodel/JdoProgrammingModelPlugin.java
index 3736f1a..773e991 100644
--- a/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/metamodel/JdoProgrammingModelPlugin.java
+++ b/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/metamodel/JdoProgrammingModelPlugin.java
@@ -111,10 +111,6 @@ public class JdoProgrammingModelPlugin implements MetaModelRefiner {
         if(config.getCore().getMetaModel().getValidator().isEnsureUniqueObjectTypes()) {
             addValidatorToEnsureUniqueObjectIds();
         }
-        
-        if(config.getCore().getMetaModel().getValidator().isCheckModuleExtent()) {
-            addValidatorToCheckModuleExtent();
-        }
 
     }
 
@@ -218,77 +214,5 @@ public class JdoProgrammingModelPlugin implements MetaModelRefiner {
         pm.addValidator(ensureUniqueObjectIds);
     }
 
-    private void addValidatorToCheckModuleExtent() {
-
-        final Map<String, List<String>> domainObjectClassNamesByPackage = _Maps.newConcurrentHashMap();
-
-        MetaModelValidatorVisiting.SummarizingVisitor visitor = new MetaModelValidatorVisiting.SummarizingVisitor(){
-
-            @Override
-            public boolean visit(ObjectSpecification objSpec, MetaModelValidator validator) {
-                Class<?> correspondingClass = objSpec.getCorrespondingClass();
-                if(correspondingClass == null) {
-                    return true;
-                }
-                Package aPackage = correspondingClass.getPackage();
-                if(aPackage == null) {
-                    return true;
-                }
-                final String packageName = aPackage.getName();
-
-                //noinspection StatementWithEmptyBody
-                if (objSpec.isValue() || objSpec.isAbstract() || objSpec.isMixin() ||
-                        objSpec.isParentedOrFreeCollection() ||
-                        objSpec.getFullIdentifier().startsWith("java") ||
-                        objSpec.getFullIdentifier().startsWith("org.joda") ||
-                        objSpec.getFullIdentifier().startsWith("org.apache.isis")) {
-                    // ignore
-                } else {
-                    List<String> classNames = domainObjectClassNamesByPackage.computeIfAbsent(packageName, k -> _Lists.newArrayList());
-                    classNames.add(objSpec.getFullIdentifier());
-                }
-                return true;
-            }
-
-            @Override
-            public void summarize(final MetaModelValidator validator) {
-                //FIXME[2112] module (legacy) specific, remove?
-                //                final Set<String> modulePackageNames = modulePackageNamesFrom(appManifest);
-                //
-                //                final Set<String> domainObjectPackageNames = domainObjectClassNamesByPackage.keySet();
-                //                for (final String pkg : domainObjectPackageNames) {
-                //                    List<String> domainObjectClassNames = domainObjectClassNamesByPackage.get(pkg);
-                //                    boolean withinSomeModule = isWithinSomeModule(modulePackageNames, pkg);
-                //                    if(!withinSomeModule) {
-                //                        String csv = stream(domainObjectClassNames)
-                //                                .collect(Collectors.joining(","));
-                //                        validationFailures.add(
-                //                                "Domain objects discovered in package '%s' are not in the set of modules obtained from "
-                //                                        + "the AppManifest's top-level module '%s'.  Classes are: %s",
-                //                                        pkg, topLevelModule.getClass().getName(), csv);
-                //                    }
-                //                }
-            }
-            //FIXME[2112] module (legacy) specific, remove?
-            //            private Set<String> modulePackageNamesFrom(final AppManifest appManifest) {
-            //                final List<Class<?>> modules = appManifest.getModules();
-            //                return modules.stream()
-            //                        .map(aClass->aClass.getPackage().getName())
-            //                        .collect(Collectors.toCollection(HashSet::new));
-            //            }
-            //
-            //            private boolean isWithinSomeModule(final Set<String> modulePackageNames, final String pkg) {
-            //                for (final String modulePackageName : modulePackageNames) {
-            //                    if(pkg.startsWith(modulePackageName)) {
-            //                        return true;
-            //                    }
-            //                }
-            //                return false;
-            //            }
-        };
-
-        pm.addValidator(visitor);
-    }
-
 
 }