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/03/03 18:39:12 UTC

[isis] 07/09: ISIS-2553: simplify ApplicationFeatureSort

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

commit 10aa6a362e4e887e52bbc24668ee052eb24e74e9
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Mar 3 18:09:32 2021 +0100

    ISIS-2553: simplify ApplicationFeatureSort
---
 .../services/appfeat/ApplicationFeatureId.java     | 83 ++++++++++++++--------
 .../services/appfeat/ApplicationFeatureSort.java   | 74 +++----------------
 .../services/appfeat/ApplicationFeature.java       | 18 ++---
 .../core/metamodel/services/appfeat/_Asserts.java  | 41 +++++------
 .../appfeat/ApplicationFeatureTypeTest.java        | 36 +++++-----
 .../app/feature/ApplicationFeatureViewModel.java   |  4 +-
 .../dom/role/ApplicationRole_addPermission.java    |  4 --
 7 files changed, 115 insertions(+), 145 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureId.java b/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureId.java
index 20152bf..c29f7e7 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureId.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureId.java
@@ -37,6 +37,7 @@ import org.apache.isis.applib.util.Hashing;
 import org.apache.isis.applib.util.ObjectContracts;
 import org.apache.isis.applib.util.TitleBuffer;
 import org.apache.isis.applib.util.ToString;
+import org.apache.isis.commons.internal.assertions._Assert;
 import org.apache.isis.commons.internal.base._Strings;
 import org.apache.isis.commons.internal.collections._Lists;
 import org.apache.isis.commons.internal.exceptions._Exceptions;
@@ -112,31 +113,57 @@ implements
     }
 
     public static ApplicationFeatureId newNamespace(final String namespace) {
-        val feat = new ApplicationFeatureId(ApplicationFeatureSort.NAMESPACE);
-        ApplicationFeatureSort.initNamespace(feat, namespace);
-        return feat;
+        val feature = new ApplicationFeatureId(ApplicationFeatureSort.NAMESPACE);
+        feature.setNamespace(namespace);
+        feature.setTypeSimpleName(null);
+        feature.setMemberName(null);
+        return feature;
     }
 
     public static ApplicationFeatureId newType(final String logicalTypeName) {
         val feat = new ApplicationFeatureId(ApplicationFeatureSort.TYPE);
-        ApplicationFeatureSort.initType(feat, logicalTypeName);
+        initType(feat, logicalTypeName);
         return feat;
     }
 
     public static ApplicationFeatureId newMember(final String logicalTypeName, final String memberName) {
         final ApplicationFeatureId featureId = new ApplicationFeatureId(ApplicationFeatureSort.MEMBER);
-        ApplicationFeatureSort.initType(featureId, logicalTypeName);
-        featureId.sort = ApplicationFeatureSort.MEMBER;
+        initType(featureId, logicalTypeName);
         featureId.setMemberName(memberName);
         return featureId;
     }
 
     public static ApplicationFeatureId newMember(String fqn) {
         val feat = new ApplicationFeatureId(ApplicationFeatureSort.MEMBER);
-        ApplicationFeatureSort.initMember(feat, fqn);
+        initMember(feat, fqn);
         return feat;
     }
     
+    // -- FACTORY HELPERS
+    
+    private static void initType(final ApplicationFeatureId feature, final String fullyQualifiedName) {
+        final int i = fullyQualifiedName.lastIndexOf(".");
+        if(i != -1) {
+            feature.setNamespace(fullyQualifiedName.substring(0, i));
+            feature.setTypeSimpleName(fullyQualifiedName.substring(i+1));
+        } else {
+            feature.setNamespace("");
+            feature.setTypeSimpleName(fullyQualifiedName);
+        }
+        feature.setMemberName(null);
+    }
+    
+    private static void initMember(final ApplicationFeatureId feature, final String fullyQualifiedName) {
+        final int i = fullyQualifiedName.lastIndexOf("#");
+        if(i == -1) {
+            throw new IllegalArgumentException("Malformed, expected a '#': " + fullyQualifiedName);
+        }
+        final String className = fullyQualifiedName.substring(0, i);
+        final String memberName = fullyQualifiedName.substring(i+1);
+        initType(feature, className);
+        feature.setMemberName(memberName);
+    }
+    
     // -- CONSTRUCTOR
 
     private ApplicationFeatureId(final ApplicationFeatureSort sort) {
@@ -157,18 +184,27 @@ implements
 
     // -- PROPERTIES
     
-    @Getter ApplicationFeatureSort sort;
+    @Getter final @NonNull ApplicationFeatureSort sort;
     
     /**
      * The {@link ApplicationFeatureId id} of the member's class.
      */
     public ApplicationFeatureId getParentClassId() {
-        ApplicationFeatureSort.ensureMember(this);
-        final String classFqn = this.getNamespace() + "." + getTypeSimpleName();
-        return newType(classFqn);
+        _Assert.assertTrue(sort.isMember());
+        final String logicalTypeName = this.getNamespace() + "." + getTypeSimpleName();
+        return newType(logicalTypeName);
     }
     
     // -- PROPERTIES - NON UI
+    
+    @Programmatic 
+    @Getter @Setter private String namespace;
+
+    @Programmatic 
+    @Getter @Setter private String typeSimpleName;
+
+    @Programmatic 
+    @Getter @Setter private String memberName;
 
     @Programmatic
     public String getFullyQualifiedName() {
@@ -198,35 +234,24 @@ implements
         return buf.toString();
     }
 
-    @Programmatic 
-    @Getter @Setter private String namespace;
-
-    @Programmatic 
-    @Getter @Setter private String typeSimpleName;
-
-    @Programmatic 
-    @Getter @Setter private String memberName;
-
     /**
      * The {@link ApplicationFeatureId id} of the parent package of this
      * class or package.
      */
     @Programmatic
     public ApplicationFeatureId getParentPackageId() {
-        ApplicationFeatureSort.ensurePackageOrClass(this);
+        
+        _Assert.assertFalse(sort.isMember());
 
-        if(sort == ApplicationFeatureSort.TYPE) {
+        if(sort.isType()) {
             return ApplicationFeatureId.newNamespace(getNamespace());
         } else {
-            final String packageName = getNamespace(); // eg aaa.bbb.ccc
-
-            if(!packageName.contains(".")) {
+            val namespace = getNamespace(); // eg aaa.bbb.ccc
+            if(!namespace.contains(".")) {
                 return null; // parent is root
             }
-
-            final int cutOffPos = packageName.lastIndexOf('.');
-            final String parentPackageName = packageName.substring(0, cutOffPos);
-
+            final int cutOffPos = namespace.lastIndexOf('.');
+            final String parentPackageName = namespace.substring(0, cutOffPos);
             return newNamespace(parentPackageName);
         }
     }
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureSort.java b/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureSort.java
index 074e382..c1cb650 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureSort.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/appfeat/ApplicationFeatureSort.java
@@ -18,8 +18,10 @@
  */
 package org.apache.isis.applib.services.appfeat;
 
-import org.apache.isis.commons.internal.base._Strings;
-
+/**
+ * 
+ * @since 1.x revised for 2.0 {@index}
+ */
 public enum ApplicationFeatureSort {
     
     /** 
@@ -39,75 +41,21 @@ public enum ApplicationFeatureSort {
      */
     MEMBER;
 
-    public boolean hideClassName() {
+    public boolean isNamespace() {
         return this == ApplicationFeatureSort.NAMESPACE;
     }
     
-    public boolean hideMember() {
-        return this == ApplicationFeatureSort.NAMESPACE || this == ApplicationFeatureSort.TYPE;
+    public boolean isType() {
+        return this == ApplicationFeatureSort.TYPE;
     }
-
-    public static void ensurePackage(final ApplicationFeatureId feature) {
-        if(feature.sort != ApplicationFeatureSort.NAMESPACE) {
-            throw new IllegalStateException("Can only be called for a package; " + feature.toString());
-        }
-    }
-
-    public static void ensurePackageOrClass(final ApplicationFeatureId applicationFeatureId) {
-        if(applicationFeatureId.sort != ApplicationFeatureSort.NAMESPACE && applicationFeatureId.sort != ApplicationFeatureSort.TYPE) {
-            throw new IllegalStateException("Can only be called for a package or a class; " + applicationFeatureId.toString());
-        }
-    }
-
-    public static void ensureClass(final ApplicationFeatureId feature) {
-        if(feature.sort != ApplicationFeatureSort.TYPE) {
-            throw new IllegalStateException("Can only be called for a class; " + feature.toString());
-        }
-    }
-
-    public static void ensureMember(final ApplicationFeatureId feature) {
-        if(feature.sort != ApplicationFeatureSort.MEMBER) {
-            throw new IllegalStateException("Can only be called for a member; " + feature.toString());
-        }
+    
+    public boolean isMember() {
+        return this == ApplicationFeatureSort.MEMBER;
     }
 
     @Override
     public String toString() {
-        return _Strings.capitalize(name());
-    }
-    
-    // -- REFACTORING
-    
-    static void initNamespace(final ApplicationFeatureId feature, final String fullyQualifiedName) {
-        feature.setNamespace(fullyQualifiedName);
-        feature.setTypeSimpleName(null);
-        feature.setMemberName(null);
-        feature.sort = NAMESPACE;
-    }
-    
-    static void initType(final ApplicationFeatureId feature, final String fullyQualifiedName) {
-        final int i = fullyQualifiedName.lastIndexOf(".");
-        if(i != -1) {
-            feature.setNamespace(fullyQualifiedName.substring(0, i));
-            feature.setTypeSimpleName(fullyQualifiedName.substring(i+1));
-        } else {
-            feature.setNamespace("");
-            feature.setTypeSimpleName(fullyQualifiedName);
-        }
-        feature.setMemberName(null);
-        feature.sort = TYPE;
-    }
-    
-    static void initMember(final ApplicationFeatureId feature, final String fullyQualifiedName) {
-        final int i = fullyQualifiedName.lastIndexOf("#");
-        if(i == -1) {
-            throw new IllegalArgumentException("Malformed, expected a '#': " + fullyQualifiedName);
-        }
-        final String className = fullyQualifiedName.substring(0, i);
-        final String memberName = fullyQualifiedName.substring(i+1);
-        initType(feature, className);
-        feature.setMemberName(memberName);
-        feature.sort = MEMBER;
+        return name();
     }
     
 
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeature.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeature.java
index 9781f0a..69d7e78 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeature.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeature.java
@@ -122,13 +122,13 @@ public class ApplicationFeature implements Comparable<ApplicationFeature> {
     private final SortedSet<ApplicationFeatureId> contents = _Sets.newTreeSet();
 
     public SortedSet<ApplicationFeatureId> getContents() {
-        ApplicationFeatureSort.ensurePackage(this.getFeatureId());
+        _Asserts.ensureNamespace(this.getFeatureId());
         return contents;
     }
 
     public void addToContents(final ApplicationFeatureId contentId) {
-        ApplicationFeatureSort.ensurePackage(this.getFeatureId());
-        ApplicationFeatureSort.ensurePackageOrClass(contentId);
+        _Asserts.ensureNamespace(this.getFeatureId());
+        _Asserts.ensureNamespaceOrType(contentId);
         this.contents.add(contentId);
     }
 
@@ -137,7 +137,7 @@ public class ApplicationFeature implements Comparable<ApplicationFeature> {
     private final SortedSet<ApplicationFeatureId> properties = _Sets.newTreeSet();
 
     public SortedSet<ApplicationFeatureId> getProperties() {
-        ApplicationFeatureSort.ensureClass(this.getFeatureId());
+        _Asserts.ensureType(this.getFeatureId());
         return properties;
     }
 
@@ -145,7 +145,7 @@ public class ApplicationFeature implements Comparable<ApplicationFeature> {
     private final SortedSet<ApplicationFeatureId> collections = _Sets.newTreeSet();
     
     public SortedSet<ApplicationFeatureId> getCollections() {
-        ApplicationFeatureSort.ensureClass(this.getFeatureId());
+        _Asserts.ensureType(this.getFeatureId());
         return collections;
     }
 
@@ -153,19 +153,19 @@ public class ApplicationFeature implements Comparable<ApplicationFeature> {
     private final SortedSet<ApplicationFeatureId> actions = _Sets.newTreeSet();
     
     public SortedSet<ApplicationFeatureId> getActions() {
-        ApplicationFeatureSort.ensureClass(this.getFeatureId());
+        _Asserts.ensureType(this.getFeatureId());
         return actions;
     }
     
     public void addToMembers(final ApplicationFeatureId memberId, final ApplicationMemberType memberType) {
-        ApplicationFeatureSort.ensureClass(this.getFeatureId());
-        ApplicationFeatureSort.ensureMember(memberId);
+        _Asserts.ensureType(this.getFeatureId());
+        _Asserts.ensureMember(memberId);
 
         membersOf(memberType).add(memberId);
     }
     
     public SortedSet<ApplicationFeatureId> membersOf(final ApplicationMemberType memberType) {
-        ApplicationFeatureSort.ensureClass(this.getFeatureId());
+        _Asserts.ensureType(this.getFeatureId());
         switch (memberType) {
         case PROPERTY:
             return properties;
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/_Asserts.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/_Asserts.java
index 81b9c52..fe17bc7 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/_Asserts.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/appfeat/_Asserts.java
@@ -18,33 +18,34 @@
  */
 package org.apache.isis.core.metamodel.services.appfeat;
 
-import java.util.function.Predicate;
-
 import org.apache.isis.applib.services.appfeat.ApplicationFeatureId;
 import org.apache.isis.applib.services.appfeat.ApplicationFeatureSort;
-import org.apache.isis.applib.services.appfeat.ApplicationMemberType;
 
 final class _Asserts {
 
-    public static Predicate<ApplicationFeatureId> isClassContaining(
-            final ApplicationMemberType memberType, final ApplicationFeatureRepositoryDefault applicationFeatures) {
-        return new Predicate<ApplicationFeatureId>() {
-            @Override
-            public boolean test(final ApplicationFeatureId input) {
-                if(input.getSort() != ApplicationFeatureSort.TYPE) {
-                    return false;
-                }
-                final ApplicationFeature feature = applicationFeatures.findFeature(input);
-                if(feature == null) {
-                    return false;
-                }
-                return memberType == null || !feature.membersOf(memberType).isEmpty();
-            }
-        };
+    public static void ensureNamespace(final ApplicationFeatureId feature) {
+        if(feature.getSort() != ApplicationFeatureSort.NAMESPACE) {
+            throw new IllegalStateException("Can only be called for a package; " + feature.toString());
+        }
+    }
+
+    public static void ensureNamespaceOrType(final ApplicationFeatureId applicationFeatureId) {
+        if(applicationFeatureId.getSort() != ApplicationFeatureSort.NAMESPACE 
+                && applicationFeatureId.getSort() != ApplicationFeatureSort.TYPE) {
+            throw new IllegalStateException("Can only be called for a package or a class; " + applicationFeatureId.toString());
+        }
+    }
+
+    public static void ensureType(final ApplicationFeatureId feature) {
+        if(feature.getSort() != ApplicationFeatureSort.TYPE) {
+            throw new IllegalStateException("Can only be called for a class; " + feature.toString());
+        }
     }
 
-    public static Predicate<ApplicationFeatureId> isClassRecursivelyWithin(final ApplicationFeatureId packageId) {
-        return (ApplicationFeatureId input) -> input.getParentIds().contains(packageId);
+    public static void ensureMember(final ApplicationFeatureId feature) {
+        if(feature.getSort() != ApplicationFeatureSort.MEMBER) {
+            throw new IllegalStateException("Can only be called for a member; " + feature.toString());
+        }
     }
 
 }
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeatureTypeTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeatureTypeTest.java
index 1da0471..bf237a1 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeatureTypeTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/appfeat/ApplicationFeatureTypeTest.java
@@ -36,9 +36,9 @@ public class ApplicationFeatureTypeTest {
     public static class HideClassName extends ApplicationFeatureTypeTest {
         @Test
         public void all() throws Exception {
-            assertThat(ApplicationFeatureSort.NAMESPACE.hideClassName(), is(true));
-            assertThat(ApplicationFeatureSort.TYPE.hideClassName(), is(false));
-            assertThat(ApplicationFeatureSort.MEMBER.hideClassName(), is(false));
+            assertThat(ApplicationFeatureSort.NAMESPACE.isNamespace(), is(true));
+            assertThat(ApplicationFeatureSort.TYPE.isNamespace(), is(false));
+            assertThat(ApplicationFeatureSort.MEMBER.isNamespace(), is(false));
         }
     }
 
@@ -46,9 +46,9 @@ public class ApplicationFeatureTypeTest {
 
         @Test
         public void all() throws Exception {
-            assertThat(ApplicationFeatureSort.NAMESPACE.hideMember(), is(true));
-            assertThat(ApplicationFeatureSort.TYPE.hideMember(), is(true));
-            assertThat(ApplicationFeatureSort.MEMBER.hideMember(), is(false));
+            assertThat(!ApplicationFeatureSort.NAMESPACE.isMember(), is(true));
+            assertThat(!ApplicationFeatureSort.TYPE.isMember(), is(true));
+            assertThat(!ApplicationFeatureSort.MEMBER.isMember(), is(false));
         }
     }
 
@@ -102,17 +102,17 @@ public class ApplicationFeatureTypeTest {
 
         @Test
         public void whenPackage() throws Exception {
-            ApplicationFeatureSort.ensurePackage(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
+            _Asserts.ensureNamespace(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
         }
         @Test
         public void whenClass() throws Exception {
             expectedException.expect(IllegalStateException.class);
-            ApplicationFeatureSort.ensurePackage(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
+            _Asserts.ensureNamespace(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
         }
         @Test
         public void whenMember() throws Exception {
             expectedException.expect(IllegalStateException.class);
-            ApplicationFeatureSort.ensurePackage(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
+            _Asserts.ensureNamespace(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
         }
     }
 
@@ -123,16 +123,16 @@ public class ApplicationFeatureTypeTest {
 
         @Test
         public void whenPackage() throws Exception {
-            ApplicationFeatureSort.ensurePackageOrClass(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
+            _Asserts.ensureNamespaceOrType(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
         }
         @Test
         public void whenClass() throws Exception {
-            ApplicationFeatureSort.ensurePackageOrClass(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
+            _Asserts.ensureNamespaceOrType(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
         }
         @Test
         public void whenMember() throws Exception {
             expectedException.expect(IllegalStateException.class);
-            ApplicationFeatureSort.ensurePackageOrClass(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
+            _Asserts.ensureNamespaceOrType(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
         }
 
     }
@@ -144,16 +144,16 @@ public class ApplicationFeatureTypeTest {
         @Test
         public void whenPackage() throws Exception {
             expectedException.expect(IllegalStateException.class);
-            ApplicationFeatureSort.ensureClass(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
+            _Asserts.ensureType(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
         }
         @Test
         public void whenClass() throws Exception {
-            ApplicationFeatureSort.ensureClass(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
+            _Asserts.ensureType(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
         }
         @Test
         public void whenMember() throws Exception {
             expectedException.expect(IllegalStateException.class);
-            ApplicationFeatureSort.ensureClass(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
+            _Asserts.ensureType(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
         }
 
     }
@@ -165,16 +165,16 @@ public class ApplicationFeatureTypeTest {
         @Test
         public void whenPackage() throws Exception {
             expectedException.expect(IllegalStateException.class);
-            ApplicationFeatureSort.ensureMember(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
+            _Asserts.ensureMember(ApplicationFeatureId.newFeature(ApplicationFeatureSort.NAMESPACE, "xxx"));
         }
         @Test
         public void whenClass() throws Exception {
             expectedException.expect(IllegalStateException.class);
-            ApplicationFeatureSort.ensureMember(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
+            _Asserts.ensureMember(ApplicationFeatureId.newFeature(ApplicationFeatureSort.TYPE, "xxx"));
         }
         @Test
         public void whenMember() throws Exception {
-            ApplicationFeatureSort.ensureMember(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
+            _Asserts.ensureMember(ApplicationFeatureId.newFeature(ApplicationFeatureSort.MEMBER, "xxx#x"));
         }
     }
 
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java
index c0a100a..e143702 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/app/feature/ApplicationFeatureViewModel.java
@@ -199,7 +199,7 @@ public abstract class ApplicationFeatureViewModel implements ViewModel {
         return getFeatureId().getTypeSimpleName();
     }
     public boolean hideClassName() {
-        return getType().hideClassName();
+        return getType().isNamespace();
     }
 
     // -- memberName
@@ -219,7 +219,7 @@ public abstract class ApplicationFeatureViewModel implements ViewModel {
     }
 
     public boolean hideMemberName() {
-        return getType().hideMember();
+        return !getType().isMember();
     }
 
 
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/role/ApplicationRole_addPermission.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/role/ApplicationRole_addPermission.java
index 8fa78bc..cdf53d0 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/role/ApplicationRole_addPermission.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/role/ApplicationRole_addPermission.java
@@ -25,14 +25,11 @@ import java.util.stream.Collectors;
 import javax.enterprise.inject.Model;
 import javax.inject.Inject;
 
-import org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.ActionLayout;
 import org.apache.isis.applib.annotation.MemberOrder;
 import org.apache.isis.applib.annotation.MinLength;
 import org.apache.isis.applib.annotation.Optionality;
 import org.apache.isis.applib.annotation.Parameter;
 import org.apache.isis.applib.annotation.ParameterLayout;
-import org.apache.isis.applib.annotation.PromptStyle;
 import org.apache.isis.applib.services.appfeat.ApplicationFeatureId;
 import org.apache.isis.applib.services.appfeat.ApplicationFeatureRepository;
 import org.apache.isis.core.metamodel.services.appfeat.ApplicationFeature;
@@ -41,7 +38,6 @@ import org.apache.isis.extensions.secman.api.permission.ApplicationPermissionMod
 import org.apache.isis.extensions.secman.api.permission.ApplicationPermissionRepository;
 import org.apache.isis.extensions.secman.api.permission.ApplicationPermissionRule;
 import org.apache.isis.extensions.secman.api.role.ApplicationRole;
-import org.apache.isis.extensions.secman.api.role.ApplicationRole.AddPermissionDomainEvent;
 
 import lombok.RequiredArgsConstructor;
 import lombok.Value;