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 2015/07/09 18:29:36 UTC

[7/9] isis git commit: ISIS-1170: better exception if a class has no properties/collections at all.

ISIS-1170: better exception if a class has no properties/collections at all.


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

Branch: refs/heads/master
Commit: a4989fd5f008758370ef09cc6589cb39e780655f
Parents: edc4fa7
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Jul 9 11:28:43 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Jul 9 11:29:59 2015 +0100

----------------------------------------------------------------------
 .../apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/a4989fd5/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
index 72b4fc6..69dc4b6 100644
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
+++ b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
@@ -29,6 +29,8 @@ import org.apache.wicket.markup.html.link.BookmarkablePageLink;
 import org.apache.wicket.model.AbstractReadOnlyModel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.util.string.Strings;
+
+import org.apache.isis.applib.NonRecoverableException;
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -143,6 +145,11 @@ public class EntityPage extends PageAbstract {
         final List<ObjectAssociation> visibleAssociation = specification.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, objectAdapter, Where.NOWHERE));
 
         if(visibleAssociation.isEmpty()) {
+            final List<ObjectAssociation> anyAssociations = specification.getAssociations(Contributed.INCLUDED);
+            if(anyAssociations.isEmpty()) {
+                throw new NonRecoverableException(String.format(
+                        "No properties are defined for this entity type (%s); this is probably a programming error", specification.getFullIdentifier()));
+            }
             throw new ObjectMember.AuthorizationException();
         }