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 2017/02/14 21:46:40 UTC

[3/3] isis git commit: ISIS-1587: makes the check to filter ObjectSpecifications (for 'explicitObjectTypes') public so can be used elsewhere.

ISIS-1587: makes the check to filter ObjectSpecifications (for 'explicitObjectTypes') public so can be used elsewhere.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c9f99b4e
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c9f99b4e
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c9f99b4e

Branch: refs/heads/maint-1.14.0
Commit: c9f99b4efd5ea28c7d7fc3d3873f43037cabf4f6
Parents: 97db698
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Feb 14 21:46:28 2017 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Feb 14 21:46:28 2017 +0000

----------------------------------------------------------------------
 ...tSpecIdFacetDerivedFromClassNameFactory.java | 79 ++++++++++----------
 1 file changed, 40 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/c9f99b4e/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java
index 7d38a38..1cdfabb 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java
@@ -129,47 +129,48 @@ public class ObjectSpecIdFacetDerivedFromClassNameFactory extends FacetFactoryAb
                         return !check(objectSpec);
                     }
 
-                    private boolean check(final ObjectSpecification objectSpec) {
-                        if(objectSpec.isAbstract()) {
-                            return false;
-                        }
-                        if (objectSpec.isPersistenceCapable()) {
-                            return true;
-                        }
-                        if (objectSpec.isViewModel()) {
-                            final ViewModelFacet viewModelFacet = objectSpec.getFacet(ViewModelFacet.class);
-                            // don't check JAXB DTOs
-                            final XmlType xmlType = objectSpec.getCorrespondingClass().getAnnotation(XmlType.class);
-                            if(xmlType != null) {
-                                return false;
-                            }
-                            return true;
-                        }
-                        if(objectSpec.isMixin()) {
-                            return false;
-                        }
-                        if (objectSpec.isService()) {
-                            // don't check if domain service isn't a target in public API (UI/REST)
-                            final DomainServiceFacet domainServiceFacet = objectSpec.getFacet(DomainServiceFacet.class);
-                            if(domainServiceFacet != null) {
-                                if(domainServiceFacet.getNatureOfService() == NatureOfService.DOMAIN ||
-                                   domainServiceFacet.getNatureOfService() == NatureOfService.VIEW_CONTRIBUTIONS_ONLY) {
-                                    return false;
-                                }
-                            }
-
-                            // don't check if domain service has only programmatic methods
-                            final List<ObjectAction> objectActions = objectSpec.getObjectActions(Contributed.INCLUDED);
-                            if(objectActions.isEmpty()) {
-                                return false;
-                            }
-
-                            return true;
-                        }
-                        return false;
-                    }
+
                 });
         metaModelValidator.add(validator);
     }
 
+    public static boolean check(final ObjectSpecification objectSpec) {
+        if(objectSpec.isAbstract()) {
+            return false;
+        }
+        if (objectSpec.isPersistenceCapable()) {
+            return true;
+        }
+        if (objectSpec.isViewModel()) {
+            final ViewModelFacet viewModelFacet = objectSpec.getFacet(ViewModelFacet.class);
+            // don't check JAXB DTOs
+            final XmlType xmlType = objectSpec.getCorrespondingClass().getAnnotation(XmlType.class);
+            if(xmlType != null) {
+                return false;
+            }
+            return true;
+        }
+        if(objectSpec.isMixin()) {
+            return false;
+        }
+        if (objectSpec.isService()) {
+            // don't check if domain service isn't a target in public API (UI/REST)
+            final DomainServiceFacet domainServiceFacet = objectSpec.getFacet(DomainServiceFacet.class);
+            if(domainServiceFacet != null) {
+                if(domainServiceFacet.getNatureOfService() == NatureOfService.DOMAIN ||
+                        domainServiceFacet.getNatureOfService() == NatureOfService.VIEW_CONTRIBUTIONS_ONLY) {
+                    return false;
+                }
+            }
+
+            // don't check if domain service has only programmatic methods
+            final List<ObjectAction> objectActions = objectSpec.getObjectActions(Contributed.INCLUDED);
+            if(objectActions.isEmpty()) {
+                return false;
+            }
+
+            return true;
+        }
+        return false;
+    }
 }