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 2021/05/05 06:30:25 UTC

[isis] 03/03: ISIS-2619: use meta-annotations in ApplicationUser ...

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

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

commit 0fb0060b3a31f5c1634865775ab75f8d0cb6acfa
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed May 5 07:30:03 2021 +0100

    ISIS-2619: use meta-annotations in ApplicationUser ...
    
    ... to reduce boilerplate
---
 .../secman/api/user/ApplicationUser.java           | 221 +++++++++++++++------
 .../user/ApplicationUser_updateEmailAddress.java   |   3 +-
 .../dom/user/ApplicationUser_updateFaxNumber.java  |   3 +-
 .../model/dom/user/ApplicationUser_updateName.java |   7 +-
 .../user/ApplicationUser_updatePhoneNumber.java    |   3 +-
 .../dom/user/ApplicationUser_updateUsername.java   |   3 +-
 .../secman/jdo/dom/user/ApplicationUser.java       | 170 ++--------------
 .../ApplicationUserManager_newDelegateUser.java    |   2 +-
 .../user/ApplicationUserManager_newLocalUser.java  |   2 +-
 .../secman/jpa/dom/user/ApplicationUser.java       | 180 +++--------------
 .../ApplicationUserManager_newDelegateUser.java    |   2 +-
 .../user/ApplicationUserManager_newLocalUser.java  |   2 +-
 12 files changed, 219 insertions(+), 379 deletions(-)

diff --git a/extensions/security/secman/api/src/main/java/org/apache/isis/extensions/secman/api/user/ApplicationUser.java b/extensions/security/secman/api/src/main/java/org/apache/isis/extensions/secman/api/user/ApplicationUser.java
index d29fd62..0c13545 100644
--- a/extensions/security/secman/api/src/main/java/org/apache/isis/extensions/secman/api/user/ApplicationUser.java
+++ b/extensions/security/secman/api/src/main/java/org/apache/isis/extensions/secman/api/user/ApplicationUser.java
@@ -18,6 +18,10 @@
  */
 package org.apache.isis.extensions.secman.api.user;
 
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.util.Set;
 
 import javax.inject.Inject;
@@ -28,6 +32,7 @@ import org.springframework.stereotype.Component;
 import org.apache.isis.applib.annotation.Collection;
 import org.apache.isis.applib.annotation.CollectionLayout;
 import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Parameter;
 import org.apache.isis.applib.annotation.Programmatic;
 import org.apache.isis.applib.annotation.Property;
 import org.apache.isis.applib.annotation.PropertyLayout;
@@ -46,16 +51,6 @@ import lombok.RequiredArgsConstructor;
  */
 public interface ApplicationUser extends HasUsername, HasAtPath {
 
-    // -- CONSTANTS
-
-    int MAX_LENGTH_USERNAME = 120;
-    int MAX_LENGTH_FAMILY_NAME = 120;
-    int MAX_LENGTH_GIVEN_NAME = 120;
-    int MAX_LENGTH_KNOWN_AS = 120;
-    int MAX_LENGTH_EMAIL_ADDRESS = 120;
-    int MAX_LENGTH_PHONE_NUMBER = 120;
-    int MAX_LENGTH_AT_PATH = 254;
-
     // -- DOMAIN EVENTS
 
     abstract class PropertyDomainEvent<T> extends IsisModuleExtSecmanApi.PropertyDomainEvent<ApplicationUser, T> {}
@@ -87,17 +82,26 @@ public interface ApplicationUser extends HasUsername, HasAtPath {
 
     // -- username (property)
 
-    class UsernameDomainEvent extends PropertyDomainEvent<String> {}
-
     @Property(
-            domainEvent = UsernameDomainEvent.class,
+            domainEvent = Username.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_USERNAME
+            maxLength = Username.MAX_LENGTH
     )
     @PropertyLayout(
             fieldSetId="identity",
             sequence = "1"
     )
+    @Parameter(
+            maxLength = Username.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Username {
+        int MAX_LENGTH = 120;
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @Username
     @Override
     String getUsername();
     void setUsername(String username);
@@ -105,163 +109,248 @@ public interface ApplicationUser extends HasUsername, HasAtPath {
 
     // -- accountType (property)
 
-    class AccountTypeDomainEvent extends PropertyDomainEvent<AccountType> {}
-
     @Property(
-            domainEvent = AccountTypeDomainEvent.class,
+            domainEvent = AccountType.DomainEvent.class,
             editing = Editing.DISABLED
     )
     @PropertyLayout(
             fieldSetId="status",
             sequence = "1"
     )
-    AccountType getAccountType();
-    void setAccountType(AccountType accountType);
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface AccountType {
+        class DomainEvent extends PropertyDomainEvent<AccountType> {}
+    }
 
+    @AccountType
+    org.apache.isis.extensions.secman.api.user.AccountType getAccountType();
+    void setAccountType(org.apache.isis.extensions.secman.api.user.AccountType accountType);
 
-    // -- status (property)
 
-    class StatusDomainEvent extends PropertyDomainEvent<ApplicationUserStatus> {}
+    // -- status (property)
 
     @Property(
-            domainEvent = StatusDomainEvent.class,
+            domainEvent = Status.DomainEvent.class,
             editing = Editing.DISABLED
     )
     @PropertyLayout(
             fieldSetId="status",
             sequence = "2"
     )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Status {
+        class DomainEvent extends PropertyDomainEvent<ApplicationUserStatus> {}
+    }
+
+    @Status
     ApplicationUserStatus getStatus();
     void setStatus(ApplicationUserStatus disabled);
 
 
     // -- atPath (property)
 
-    class AtPathDomainEvent extends PropertyDomainEvent<String> {}
-
     @Property(
-            domainEvent = AtPathDomainEvent.class,
+            domainEvent = AtPath.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_AT_PATH
+            maxLength = AtPath.MAX_LENGTH
     )
     @PropertyLayout(
             fieldSetId="status",
             sequence = "3"
     )
+    @Parameter(
+            maxLength = AtPath.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface AtPath {
+        int MAX_LENGTH = 254;
+
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @AtPath
     @Override
     String getAtPath();
     void setAtPath(String atPath);
 
-    // -- familyName (property)
 
-    class FamilyNameDomainEvent extends PropertyDomainEvent<String> {}
+    // -- familyName (property)
 
     @Property(
-            domainEvent = FamilyNameDomainEvent.class,
+            domainEvent = FamilyName.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_FAMILY_NAME
+            maxLength = FamilyName.MAX_LENGTH
     )
     @PropertyLayout(
             hidden=Where.ALL_TABLES,
             fieldSetId="name",
             sequence = "1"
     )
+    @Parameter(
+            maxLength = FamilyName.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface FamilyName {
+        int MAX_LENGTH = 120;
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @FamilyName
     String getFamilyName();
     void setFamilyName(String familyName);
 
 
     // -- givenName (property)
 
-    class GivenNameDomainEvent extends PropertyDomainEvent<String> {}
-
     @Property(
-            domainEvent = GivenNameDomainEvent.class,
+            domainEvent = GivenName.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_KNOWN_AS
+            maxLength = GivenName.MAX_LENGTH
     )
     @PropertyLayout(
             hidden=Where.ALL_TABLES,
             fieldSetId="name",
             sequence = "2"
     )
+    @Parameter(
+            maxLength = GivenName.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface GivenName {
+        int MAX_LENGTH = 120;
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @GivenName
     String getGivenName();
     void setGivenName(String givenName);
 
 
     // -- knownAs (property)
 
-    class KnownAsDomainEvent extends PropertyDomainEvent<String> {}
-
     @Property(
-            domainEvent = KnownAsDomainEvent.class,
+            domainEvent = KnownAs.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_KNOWN_AS
+            maxLength = KnownAs.MAX_LENGTH
     )
     @PropertyLayout(
             hidden=Where.ALL_TABLES,
             fieldSetId="name",
             sequence = "3"
     )
+    @Parameter(
+            maxLength = KnownAs.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface KnownAs {
+        int MAX_LENGTH = 120;
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @KnownAs
     String getKnownAs();
     void setKnownAs(String knownAs);
 
 
     // -- emailAddress (property)
 
-    class EmailAddressDomainEvent extends PropertyDomainEvent<String> {}
-
     @Property(
-            domainEvent = EmailAddressDomainEvent.class,
+            domainEvent = EmailAddress.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_EMAIL_ADDRESS
+            maxLength = EmailAddress.MAX_LENGTH
     )
     @PropertyLayout(
             fieldSetId="contactDetails",
             sequence = "1"
     )
+    @Parameter(
+            maxLength = EmailAddress.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface EmailAddress {
+        int MAX_LENGTH = 120;
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @EmailAddress
     String getEmailAddress();
     void setEmailAddress(String emailAddress);
 
 
     // -- phoneNumber (property)
 
-    class PhoneNumberDomainEvent extends PropertyDomainEvent<String> {}
-
     @Property(
-            domainEvent = PhoneNumberDomainEvent.class,
+            domainEvent = PhoneNumber.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_PHONE_NUMBER
+            maxLength = PhoneNumber.MAX_LENGTH
     )
     @PropertyLayout(
             hidden = Where.PARENTED_TABLES,
             fieldSetId="contactDetails",
             sequence = "2"
     )
+    @Parameter(
+            maxLength = PhoneNumber.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface PhoneNumber {
+        int MAX_LENGTH = 120;
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @PhoneNumber
     String getPhoneNumber();
     void setPhoneNumber(String phoneNumber);
 
 
     // -- faxNumber (property)
 
-    class FaxNumberDomainEvent extends PropertyDomainEvent<String> {}
-
     @Property(
-            domainEvent = FaxNumberDomainEvent.class,
+            domainEvent = FaxNumber.DomainEvent.class,
             editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_PHONE_NUMBER
+            maxLength = FaxNumber.MAX_LENGTH
     )
     @PropertyLayout(
             hidden=Where.ALL_TABLES,
             fieldSetId="contactDetails",
             sequence = "3"
     )
+    @Parameter(
+            maxLength = FaxNumber.MAX_LENGTH
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface FaxNumber {
+        int MAX_LENGTH = 120;
+        class DomainEvent extends PropertyDomainEvent<String> {}
+    }
+
+    @FaxNumber
     String getFaxNumber();
     void setFaxNumber(String faxNumber);
 
 
     // -- encryptedPassword (hidden property)
 
-    @PropertyLayout(hidden=Where.EVERYWHERE)
+    @PropertyLayout(
+            hidden=Where.EVERYWHERE,
+            fieldSetId="password",
+            sequence = "2"
+    )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface EncryptedPassword {
+    }
+
+    @EncryptedPassword
     String getEncryptedPassword();
     void setEncryptedPassword(String encryptedPassword);
 
@@ -269,28 +358,34 @@ public interface ApplicationUser extends HasUsername, HasAtPath {
 
     // -- hasPassword (derived property)
 
-    class HasPasswordDomainEvent extends PropertyDomainEvent<Boolean> {}
-
     @Property(
-            domainEvent = HasPasswordDomainEvent.class,
+            domainEvent = HasPassword.DomainEvent.class,
             editing = Editing.DISABLED
     )
     @PropertyLayout(
             fieldSetId="password",
             sequence = "1"
     )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface HasPassword {
+        class DomainEvent extends PropertyDomainEvent<Boolean> {}
+    }
+
+    @HasPassword
     default boolean isHasPassword() {
         return _Strings.isNotEmpty(getEncryptedPassword());
     }
 
+
     @Component
     @RequiredArgsConstructor(onConstructor_ = {@Inject})
     class HasPasswordAdvisor {
 
         final org.apache.isis.extensions.secman.api.user.ApplicationUserRepository<?> applicationUserRepository;
 
-        @EventListener(org.apache.isis.extensions.secman.api.user.ApplicationUser.HasPasswordDomainEvent.class)
-        public void advise(org.apache.isis.extensions.secman.api.user.ApplicationUser.HasPasswordDomainEvent ev) {
+        @EventListener(HasPassword.DomainEvent.class)
+        public void advise(HasPassword.DomainEvent ev) {
             switch(ev.getEventPhase()) {
                 case HIDE:
                     if(! applicationUserRepository.isPasswordFeatureEnabled(ev.getSource())) {
@@ -307,16 +402,20 @@ public interface ApplicationUser extends HasUsername, HasAtPath {
 
     // -- roles (collection)
 
-
-    class RolesDomainEvent extends CollectionDomainEvent<ApplicationRole> {}
-
     @Collection(
-            domainEvent = RolesDomainEvent.class
+            domainEvent = Roles.DomainEvent.class
     )
     @CollectionLayout(
             defaultView="table",
             sequence = "20"
     )
+    @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Roles {
+        class DomainEvent extends CollectionDomainEvent<ApplicationRole> {}
+    }
+
+    @Roles
     Set<? extends ApplicationRole> getRoles();
 
 
@@ -334,7 +433,7 @@ public interface ApplicationUser extends HasUsername, HasAtPath {
 
     @Programmatic
     default boolean isLocalAccount() {
-        return getAccountType() == AccountType.LOCAL;
+        return getAccountType() == org.apache.isis.extensions.secman.api.user.AccountType.LOCAL;
     }
 
 }
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateEmailAddress.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateEmailAddress.java
index ddc6272..ac305df 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateEmailAddress.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateEmailAddress.java
@@ -26,7 +26,6 @@ import org.apache.isis.applib.annotation.ParameterLayout;
 import org.apache.isis.applib.annotation.PromptStyle;
 import org.apache.isis.extensions.secman.api.IsisModuleExtSecmanApi;
 import org.apache.isis.extensions.secman.api.user.ApplicationUser;
-import org.apache.isis.extensions.secman.model.dom.user.ApplicationUser_updateEmailAddress.ActionDomainEvent;
 
 import lombok.RequiredArgsConstructor;
 
@@ -43,7 +42,7 @@ public class ApplicationUser_updateEmailAddress {
 
     @MemberSupport
     public ApplicationUser act(
-            @Parameter(maxLength = ApplicationUser.MAX_LENGTH_EMAIL_ADDRESS)
+            @Parameter(maxLength = ApplicationUser.EmailAddress.MAX_LENGTH)
             @ParameterLayout(named="Email")
             final String emailAddress) {
         target.setEmailAddress(emailAddress);
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateFaxNumber.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateFaxNumber.java
index a6963f5..2cc60ff 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateFaxNumber.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateFaxNumber.java
@@ -27,7 +27,6 @@ import org.apache.isis.applib.annotation.ParameterLayout;
 import org.apache.isis.applib.annotation.PromptStyle;
 import org.apache.isis.extensions.secman.api.IsisModuleExtSecmanApi;
 import org.apache.isis.extensions.secman.api.user.ApplicationUser;
-import org.apache.isis.extensions.secman.model.dom.user.ApplicationUser_updateFaxNumber.ActionDomainEvent;
 
 import lombok.RequiredArgsConstructor;
 
@@ -44,7 +43,7 @@ public class ApplicationUser_updateFaxNumber {
 
     @MemberSupport
     public ApplicationUser act(
-            @Parameter(maxLength = ApplicationUser.MAX_LENGTH_PHONE_NUMBER, optionality = Optionality.OPTIONAL)
+            @Parameter(maxLength = ApplicationUser.PhoneNumber.MAX_LENGTH, optionality = Optionality.OPTIONAL)
             @ParameterLayout(named="Fax")
             final String faxNumber) {
         holder.setFaxNumber(faxNumber);
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateName.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateName.java
index ffb51c9..3c2e473 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateName.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateName.java
@@ -26,7 +26,6 @@ import org.apache.isis.applib.annotation.Parameter;
 import org.apache.isis.applib.annotation.ParameterLayout;
 import org.apache.isis.extensions.secman.api.IsisModuleExtSecmanApi;
 import org.apache.isis.extensions.secman.api.user.ApplicationUser;
-import org.apache.isis.extensions.secman.model.dom.user.ApplicationUser_updateName.ActionDomainEvent;
 
 import lombok.RequiredArgsConstructor;
 
@@ -43,13 +42,13 @@ public class ApplicationUser_updateName {
 
     @MemberSupport
     public ApplicationUser act(
-            @Parameter(maxLength = ApplicationUser.MAX_LENGTH_FAMILY_NAME, optionality = Optionality.OPTIONAL)
+            @Parameter(maxLength = ApplicationUser.FamilyName.MAX_LENGTH, optionality = Optionality.OPTIONAL)
             @ParameterLayout(named="Family Name")
             final String familyName,
-            @Parameter(maxLength = ApplicationUser.MAX_LENGTH_GIVEN_NAME, optionality = Optionality.OPTIONAL)
+            @Parameter(maxLength = ApplicationUser.GivenName.MAX_LENGTH, optionality = Optionality.OPTIONAL)
             @ParameterLayout(named="Given Name")
             final String givenName,
-            @Parameter(maxLength = ApplicationUser.MAX_LENGTH_KNOWN_AS, optionality = Optionality.OPTIONAL)
+            @Parameter(maxLength = ApplicationUser.KnownAs.MAX_LENGTH, optionality = Optionality.OPTIONAL)
             @ParameterLayout(named="Known As")
             final String knownAs
             ) {
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updatePhoneNumber.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updatePhoneNumber.java
index 48e49f1..7297f34 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updatePhoneNumber.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updatePhoneNumber.java
@@ -27,7 +27,6 @@ import org.apache.isis.applib.annotation.ParameterLayout;
 import org.apache.isis.applib.annotation.PromptStyle;
 import org.apache.isis.extensions.secman.api.IsisModuleExtSecmanApi;
 import org.apache.isis.extensions.secman.api.user.ApplicationUser;
-import org.apache.isis.extensions.secman.model.dom.user.ApplicationUser_updatePhoneNumber.ActionDomainEvent;
 
 import lombok.RequiredArgsConstructor;
 
@@ -45,7 +44,7 @@ public class ApplicationUser_updatePhoneNumber {
     @MemberSupport
     public ApplicationUser act(
             @ParameterLayout(named="Phone")
-            @Parameter(maxLength = ApplicationUser.MAX_LENGTH_PHONE_NUMBER, optionality = Optionality.OPTIONAL)
+            @Parameter(maxLength = ApplicationUser.PhoneNumber.MAX_LENGTH, optionality = Optionality.OPTIONAL)
             final String phoneNumber) {
         target.setPhoneNumber(phoneNumber);
         return target;
diff --git a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateUsername.java b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateUsername.java
index 11ae78f..49b991e 100644
--- a/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateUsername.java
+++ b/extensions/security/secman/model/src/main/java/org/apache/isis/extensions/secman/model/dom/user/ApplicationUser_updateUsername.java
@@ -25,7 +25,6 @@ import org.apache.isis.applib.annotation.Parameter;
 import org.apache.isis.applib.annotation.ParameterLayout;
 import org.apache.isis.extensions.secman.api.IsisModuleExtSecmanApi;
 import org.apache.isis.extensions.secman.api.user.ApplicationUser;
-import org.apache.isis.extensions.secman.model.dom.user.ApplicationUser_updateUsername.ActionDomainEvent;
 
 import lombok.RequiredArgsConstructor;
 
@@ -42,7 +41,7 @@ public class ApplicationUser_updateUsername {
 
     @MemberSupport
     public ApplicationUser act(
-            @Parameter(maxLength = ApplicationUser.MAX_LENGTH_USERNAME)
+            @Parameter(maxLength = ApplicationUser.Username.MAX_LENGTH)
             @ParameterLayout(named="Username")
             final String username) {
         target.setUsername(username);
diff --git a/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUser.java b/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUser.java
index d7acfae..c059da5 100644
--- a/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUser.java
+++ b/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUser.java
@@ -45,13 +45,11 @@ import org.apache.isis.applib.services.user.UserMemento;
 import org.apache.isis.applib.services.user.UserService;
 import org.apache.isis.applib.util.ObjectContracts;
 import org.apache.isis.applib.util.ObjectContracts.ObjectContract;
-import org.apache.isis.commons.internal.base._Strings;
 import org.apache.isis.commons.internal.collections._Lists;
 import org.apache.isis.extensions.secman.api.SecmanConfiguration;
 import org.apache.isis.extensions.secman.api.permission.ApplicationPermissionMode;
 import org.apache.isis.extensions.secman.api.permission.ApplicationPermissionValueSet;
 import org.apache.isis.extensions.secman.api.permission.PermissionsEvaluationService;
-import org.apache.isis.extensions.secman.api.user.AccountType;
 import org.apache.isis.extensions.secman.api.user.ApplicationUserStatus;
 import org.apache.isis.extensions.secman.jdo.dom.permission.ApplicationPermission;
 import org.apache.isis.extensions.secman.jdo.dom.permission.ApplicationPermissionRepository;
@@ -134,203 +132,79 @@ org.apache.isis.extensions.secman.api.user.ApplicationUser {
 
 
 
-    // -- username (property)
-
-    @Property(
-            domainEvent = UsernameDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_USERNAME
-    )
-    @PropertyLayout(
-            fieldSetId="identity",
-            sequence = "1"
-    )
-    @javax.jdo.annotations.Column(allowsNull="false", length = MAX_LENGTH_USERNAME)
+    @Username
+    @javax.jdo.annotations.Column(allowsNull="false", length = Username.MAX_LENGTH)
     @Getter @Setter
     private String username;
 
 
-    // -- accountType (property)
-
-    @Property(
-            domainEvent = AccountTypeDomainEvent.class,
-            editing = Editing.DISABLED
-    )
-    @PropertyLayout(
-            fieldSetId="status",
-            sequence = "1"
-    )
+    @AccountType
     @javax.jdo.annotations.Column(allowsNull="false")
     @Getter @Setter
-    private AccountType accountType;
+    private org.apache.isis.extensions.secman.api.user.AccountType accountType;
 
 
-    // -- status (property)
-
-    @Property(
-            domainEvent = StatusDomainEvent.class,
-            editing = Editing.DISABLED
-    )
-    @PropertyLayout(
-            fieldSetId="status",
-            sequence = "2"
-    )
-    @javax.jdo.annotations.Column(allowsNull="false")
+    @Status
     @Getter @Setter
     private ApplicationUserStatus status;
 
 
-    // -- atPath (property)
-
-    @Property(
-            domainEvent = AtPathDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_AT_PATH
-    )
-    @PropertyLayout(
-            fieldSetId="status",
-            sequence = "3"
-    )
-    @javax.jdo.annotations.Column(name = "atPath", allowsNull="true", length = MAX_LENGTH_AT_PATH)
+    @AtPath
+    @javax.jdo.annotations.Column(name = "atPath", allowsNull="true", length = AtPath.MAX_LENGTH)
     @Getter @Setter
     private String atPath;
 
 
-    // -- familyName (property)
-
-    @Property(
-            domainEvent = FamilyNameDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_FAMILY_NAME
-    )
-    @PropertyLayout(
-            hidden=Where.ALL_TABLES,
-            fieldSetId="name",
-            sequence = "1"
-    )
-    @javax.jdo.annotations.Column(allowsNull="true", length = MAX_LENGTH_FAMILY_NAME)
+    @FamilyName
+    @javax.jdo.annotations.Column(allowsNull="true", length = FamilyName.MAX_LENGTH)
     @Getter @Setter
     private String familyName;
 
 
-    // -- givenName (property)
-
-    @Property(
-            domainEvent = GivenNameDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_KNOWN_AS
-    )
-    @PropertyLayout(
-            hidden=Where.ALL_TABLES,
-            fieldSetId="name",
-            sequence = "2"
-    )
-    @javax.jdo.annotations.Column(allowsNull="true", length = MAX_LENGTH_GIVEN_NAME)
+    @GivenName
+    @javax.jdo.annotations.Column(allowsNull="true", length = GivenName.MAX_LENGTH)
     @Getter @Setter
     private String givenName;
 
 
-    // -- knownAs (property)
-
-    @Property(
-            domainEvent = KnownAsDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_KNOWN_AS
-    )
-    @PropertyLayout(
-            hidden=Where.ALL_TABLES,
-            fieldSetId="name",
-            sequence = "3"
-    )
-    @javax.jdo.annotations.Column(allowsNull="true", length = MAX_LENGTH_KNOWN_AS)
+    @KnownAs
+    @javax.jdo.annotations.Column(allowsNull="true", length = KnownAs.MAX_LENGTH)
     @Getter @Setter
     private String knownAs;
 
 
-    // -- emailAddress (property)
-
-    @Property(
-            domainEvent = EmailAddressDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_EMAIL_ADDRESS
-    )
-    @PropertyLayout(
-            fieldSetId="contactDetails",
-            sequence = "1"
-    )
-    @javax.jdo.annotations.Column(allowsNull="true", length = MAX_LENGTH_EMAIL_ADDRESS)
+    @EmailAddress
+    @javax.jdo.annotations.Column(allowsNull="true", length = EmailAddress.MAX_LENGTH)
     @Getter @Setter
     private String emailAddress;
 
 
-    // -- phoneNumber (property)
-
-    @Property(
-            domainEvent = PhoneNumberDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_PHONE_NUMBER
-    )
-    @PropertyLayout(
-            hidden = Where.PARENTED_TABLES,
-            fieldSetId="contactDetails",
-            sequence = "2"
-    )
-    @javax.jdo.annotations.Column(allowsNull="true", length = MAX_LENGTH_PHONE_NUMBER)
+    @PhoneNumber
+    @javax.jdo.annotations.Column(allowsNull="true", length = PhoneNumber.MAX_LENGTH)
     @Getter @Setter
     private String phoneNumber;
 
 
-    // -- faxNumber (property)
-
-    @Property(
-            domainEvent = FaxNumberDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_PHONE_NUMBER
-    )
-    @PropertyLayout(
-            hidden=Where.ALL_TABLES,
-            fieldSetId="contactDetails",
-            sequence = "3"
-    )
-    @javax.jdo.annotations.Column(allowsNull="true", length = MAX_LENGTH_PHONE_NUMBER)
+    @FaxNumber
+    @javax.jdo.annotations.Column(allowsNull="true", length = FaxNumber.MAX_LENGTH)
     @Getter @Setter
     private String faxNumber;
 
 
-    // -- encryptedPassword (hidden property)
-
-    @PropertyLayout(hidden=Where.EVERYWHERE)
+    @EncryptedPassword
     @javax.jdo.annotations.Column(allowsNull="true")
     @Getter @Setter
     private String encryptedPassword;
 
 
-
-    // -- hasPassword (derived property)
-
-    @Property(
-            domainEvent = HasPasswordDomainEvent.class,
-            editing = Editing.DISABLED
-    )
-    @PropertyLayout(
-            fieldSetId="password",
-            sequence = "1"
-    )
+    @HasPassword
     @Override
     public boolean isHasPassword() {
         return org.apache.isis.extensions.secman.api.user.ApplicationUser.super.isHasPassword();
     }
 
 
-    // -- roles (collection)
-
-    @Collection(
-            domainEvent = RolesDomainEvent.class
-    )
-    @CollectionLayout(
-            defaultView="table",
-            sequence = "20"
-    )
+    @Roles
     @javax.jdo.annotations.Persistent(table="ApplicationUserRoles")
     @javax.jdo.annotations.Join(column="userId")
     @javax.jdo.annotations.Element(column="roleId")
diff --git a/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newDelegateUser.java b/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newDelegateUser.java
index 55a5b44..f9e075d 100644
--- a/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newDelegateUser.java
+++ b/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newDelegateUser.java
@@ -42,7 +42,7 @@ extends org.apache.isis.extensions.secman.model.dom.user.ApplicationUserManager_
     @MemberSupport
     public ApplicationUserManager act(
 
-          @Parameter(maxLength = ApplicationUser.MAX_LENGTH_USERNAME)
+          @Parameter(maxLength = ApplicationUser.Username.MAX_LENGTH)
           @ParameterLayout(named = "Name")
           final String username,
 
diff --git a/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newLocalUser.java b/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newLocalUser.java
index 97dc218..ce4cd44 100644
--- a/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newLocalUser.java
+++ b/extensions/security/secman/persistence-jdo/src/main/java/org/apache/isis/extensions/secman/jdo/dom/user/ApplicationUserManager_newLocalUser.java
@@ -42,7 +42,7 @@ extends org.apache.isis.extensions.secman.model.dom.user.ApplicationUserManager_
 
     @MemberSupport
     public ApplicationUserManager act(
-          @Parameter(maxLength = ApplicationUser.MAX_LENGTH_USERNAME)
+          @Parameter(maxLength = ApplicationUser.Username.MAX_LENGTH)
           @ParameterLayout(named = "Name")
           final String username,
 
diff --git a/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUser.java b/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUser.java
index a0a570e..13909ee 100644
--- a/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUser.java
+++ b/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUser.java
@@ -30,8 +30,6 @@ import javax.persistence.Entity;
 import javax.persistence.EntityListeners;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
@@ -39,31 +37,22 @@ import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
-import javax.persistence.Version;
 
 import org.apache.isis.applib.annotation.BookmarkPolicy;
-import org.apache.isis.applib.annotation.Collection;
-import org.apache.isis.applib.annotation.CollectionLayout;
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.applib.annotation.Editing;
 import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.Property;
-import org.apache.isis.applib.annotation.PropertyLayout;
-import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.services.appfeat.ApplicationFeatureId;
 import org.apache.isis.applib.services.user.RoleMemento;
 import org.apache.isis.applib.services.user.UserMemento;
 import org.apache.isis.applib.services.user.UserService;
 import org.apache.isis.applib.util.ObjectContracts;
 import org.apache.isis.applib.util.ObjectContracts.ObjectContract;
-import org.apache.isis.commons.internal.base._Strings;
 import org.apache.isis.commons.internal.collections._Lists;
 import org.apache.isis.extensions.secman.api.SecmanConfiguration;
 import org.apache.isis.extensions.secman.api.permission.ApplicationPermissionMode;
 import org.apache.isis.extensions.secman.api.permission.ApplicationPermissionValueSet;
 import org.apache.isis.extensions.secman.api.permission.PermissionsEvaluationService;
-import org.apache.isis.extensions.secman.api.user.AccountType;
 import org.apache.isis.extensions.secman.api.user.ApplicationUserStatus;
 import org.apache.isis.extensions.secman.jpa.dom.constants.NamedQueryNames;
 import org.apache.isis.extensions.secman.jpa.dom.permission.ApplicationPermission;
@@ -124,6 +113,7 @@ org.apache.isis.extensions.secman.api.user.ApplicationUser {
 
     @Inject private transient ApplicationPermissionRepository applicationPermissionRepository;
     @Inject private transient UserService userService;
+
     /**
      * Optional service, if configured then is used to evaluate permissions within
      * {@link org.apache.isis.extensions.secman.api.permission.ApplicationPermissionValueSet#evaluate(ApplicationFeatureId, ApplicationPermissionMode)}
@@ -134,208 +124,90 @@ org.apache.isis.extensions.secman.api.user.ApplicationUser {
     @Inject private transient SecmanConfiguration configBean;
 
 
-    @Id
-    @GeneratedValue
+    @javax.persistence.Id
+    @javax.persistence.GeneratedValue
     private Long id;
 
-    @Version
+    @javax.persistence.Version
     private Long version;
 
 
-    // -- username (property)
-
-    @Property(
-            domainEvent = UsernameDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_USERNAME
-    )
-    @PropertyLayout(
-            fieldSetId="identity",
-            sequence = "1"
-    )
-    @Column(nullable=false, length=MAX_LENGTH_USERNAME)
+    @Username
+    @Column(nullable=false, length= Username.MAX_LENGTH)
     @Getter @Setter
     private String username;
 
 
-    // -- accountType (property)
-
-    @Property(
-            domainEvent = AccountTypeDomainEvent.class,
-            editing = Editing.DISABLED
-    )
-    @PropertyLayout(
-            fieldSetId="status",
-            sequence = "1"
-    )
+    @AccountType
     @Column(nullable=false)
     @Enumerated(EnumType.STRING)
     @Getter @Setter
-    private AccountType accountType;
-
+    private org.apache.isis.extensions.secman.api.user.AccountType accountType;
 
-    // -- status (property)
 
-    @Property(
-            domainEvent = StatusDomainEvent.class,
-            editing = Editing.DISABLED
-    )
-    @PropertyLayout(
-            fieldSetId="status",
-            sequence = "2"
-    )
+    @Status
     @Column(nullable=false)
     @Enumerated(EnumType.STRING)
     @Getter @Setter
     private ApplicationUserStatus status;
 
 
-    // -- atPath (property)
-
-    @Property(
-            domainEvent = AtPathDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_AT_PATH
-    )
-    @PropertyLayout(
-            fieldSetId="atPath",
-            sequence = "3"
-    )
-    @Column(name="atPath", nullable=true, length = MAX_LENGTH_AT_PATH)
+    @AtPath
+    @Column(name="atPath", nullable=true, length = AtPath.MAX_LENGTH)
     @Getter @Setter
     private String atPath;
 
 
-    // -- familyName (property)
-
-    @Property(
-            domainEvent = FamilyNameDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_FAMILY_NAME
-    )
-    @PropertyLayout(
-            hidden=Where.ALL_TABLES,
-            fieldSetId="name",
-            sequence = "1"
-    )
-    @Column(nullable=true, length=MAX_LENGTH_FAMILY_NAME)
+    @FamilyName
+    @Column(nullable=true, length= FamilyName.MAX_LENGTH)
     @Getter @Setter
     private String familyName;
 
 
-    // -- givenName (property)
-
-    @Property(
-            domainEvent = GivenNameDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_KNOWN_AS
-    )
-    @PropertyLayout(
-            hidden=Where.ALL_TABLES,
-            fieldSetId="name",
-            sequence = "2"
-    )
-    @Column(nullable=true, length=MAX_LENGTH_GIVEN_NAME)
+    @GivenName
+    @Column(nullable=true, length= GivenName.MAX_LENGTH)
     @Getter @Setter
     private String givenName;
 
 
-    // -- knownAs (property)
-
-    @Property(
-            domainEvent = KnownAsDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_KNOWN_AS
-    )
-    @PropertyLayout(
-            hidden=Where.ALL_TABLES,
-            fieldSetId="name",
-            sequence = "3"
-    )
-    @Column(nullable=true, length=MAX_LENGTH_KNOWN_AS)
+    @KnownAs
+    @Column(nullable=true, length= KnownAs.MAX_LENGTH)
     @Getter @Setter
     private String knownAs;
 
 
-    // -- emailAddress (property)
-
-    @Property(
-            domainEvent = EmailAddressDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_EMAIL_ADDRESS
-    )
-    @PropertyLayout(
-            fieldSetId="contactDetails",
-            sequence = "1"
-    )
-    @Column(nullable=true, length=MAX_LENGTH_EMAIL_ADDRESS)
+    @EmailAddress
+    @Column(nullable=true, length= EmailAddress.MAX_LENGTH)
     @Getter @Setter
     private String emailAddress;
 
 
-    // -- phoneNumber (property)
-
-    @Property(
-            domainEvent = PhoneNumberDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_PHONE_NUMBER
-    )
-    @PropertyLayout(
-            fieldSetId="contactDetails",
-            sequence = "2"
-    )
-    @Column(nullable=true, length=MAX_LENGTH_PHONE_NUMBER)
+    @PhoneNumber
+    @Column(nullable=true, length= PhoneNumber.MAX_LENGTH)
     @Getter @Setter
     private String phoneNumber;
 
 
-    // -- faxNumber (property)
-
-    @Property(
-            domainEvent = FaxNumberDomainEvent.class,
-            editing = Editing.DISABLED,
-            maxLength = MAX_LENGTH_PHONE_NUMBER
-    )
-    @PropertyLayout(
-            hidden=Where.PARENTED_TABLES,
-            fieldSetId="contactDetails",
-            sequence = "3"
-    )
-    @Column(nullable=true, length=MAX_LENGTH_PHONE_NUMBER)
+    @FaxNumber
+    @Column(nullable=true, length= FaxNumber.MAX_LENGTH)
     @Getter @Setter
     private String faxNumber;
 
 
-    // -- encryptedPassword (hidden property)
-
-    @PropertyLayout(hidden=Where.EVERYWHERE)
+    @EncryptedPassword
     @Column(nullable=true)
     @Getter @Setter
     private String encryptedPassword;
 
 
-
-    // -- hasPassword (derived property)
-
-    @Property(
-            domainEvent = HasPasswordDomainEvent.class,
-            editing = Editing.DISABLED
-    )
-    @PropertyLayout(fieldSetId="Status", sequence = "4")
+    @HasPassword
     @Override
     public boolean isHasPassword() {
         return org.apache.isis.extensions.secman.api.user.ApplicationUser.super.isHasPassword();
     }
 
 
-    // -- roles (collection)
-
-    @Collection(
-            domainEvent = RolesDomainEvent.class
-    )
-    @CollectionLayout(
-            defaultView="table",
-            sequence = "20")
+    @Roles
     @ManyToMany(mappedBy = "users", cascade = CascadeType.ALL)
     @JoinTable(
             name = "ApplicationUserRoles",
diff --git a/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newDelegateUser.java b/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newDelegateUser.java
index 9cc2d74..c9ca413 100644
--- a/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newDelegateUser.java
+++ b/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newDelegateUser.java
@@ -42,7 +42,7 @@ extends org.apache.isis.extensions.secman.model.dom.user.ApplicationUserManager_
     @MemberSupport
     public ApplicationUserManager act(
 
-          @Parameter(maxLength = ApplicationUser.MAX_LENGTH_USERNAME)
+          @Parameter(maxLength = ApplicationUser.Username.MAX_LENGTH)
           @ParameterLayout(named = "Name")
           final String username,
 
diff --git a/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newLocalUser.java b/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newLocalUser.java
index ab9365a..23d85c4 100644
--- a/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newLocalUser.java
+++ b/extensions/security/secman/persistence-jpa/src/main/java/org/apache/isis/extensions/secman/jpa/dom/user/ApplicationUserManager_newLocalUser.java
@@ -42,7 +42,7 @@ extends org.apache.isis.extensions.secman.model.dom.user.ApplicationUserManager_
 
     @MemberSupport
     public ApplicationUserManager act(
-          @Parameter(maxLength = ApplicationUser.MAX_LENGTH_USERNAME)
+          @Parameter(maxLength = ApplicationUser.Username.MAX_LENGTH)
           @ParameterLayout(named = "Name")
           final String username,