Example #1
0
 @Override
 protected final void entityRestoreState() {
   username = usernameOriginal;
   encodedpassword = encodedpasswordOriginal;
   usercode = usercodeOriginal;
   enabled = enabledOriginal;
   userpermissions.restoreState();
   userroles.restoreState();
 }
Example #2
0
 /**
  * Constructor - User.
  *
  * @param id the unique id for this entity
  * @param em - the entity manager for this entity type
  */
 public User(int id, User.EM em) {
   super("User[" + Integer.toString(id) + "]", "user", em);
   this.id = id;
   root = UserRoot.get();
   addRule(usernameRules, new UsernameMinRule());
   addRule(usernameRules, new UsernameMaxRule());
   addRule(usernameRules, new UsernameUniqueRule());
   addRule(encodedpasswordRules, new EncodedpasswordMinRule());
   addRule(encodedpasswordRules, new EncodedpasswordMaxRule());
   addRule(usercodeRules, new UsercodeMinRule());
   addRule(usercodeRules, new UsercodeMaxRule());
   addRule(usercodeRules, new UsercodeUniqueRule());
   userpermissions =
       new EntityReferenceFilterSet<>(
           instanceDescription() + ">Userpermissions", "user", getId(), Userpermission.EM.class);
   userpermissions.load();
   userroles =
       new EntityReferenceFilterSet<>(
           instanceDescription() + ">Userroles", "user", getId(), Userrole.EM.class);
   userroles.load();
   checkRulesAtLoad(new StringBuilder());
 }
Example #3
0
 /**
  * Get List of userroles associated with entity.
  *
  * @return list of userroles
  */
 public List<Userrole> getUserroles() {
   return userroles.get();
 }
Example #4
0
 /**
  * Add set listener to userroles collections
  *
  * @param listener the set change listener to add
  */
 public void addUserroleSetChangeListener(Listener<SetChangeEventParams> listener) {
   userroles.addSetListener(listener);
 }
Example #5
0
 /**
  * remove set listener to userroles collections
  *
  * @param listener the set change listener to add
  */
 public void removeUserroleSetChangeListener(Listener<SetChangeEventParams> listener) {
   userroles.removeSetListener(listener);
 }
Example #6
0
 /**
  * Add a Userrole to this entity.
  *
  * @param e the userrole
  */
 public void addUserrole(Userrole e) {
   e.linkToParent(this);
   userroles.add(e);
 }
Example #7
0
 /**
  * Remove a Userrole from this entity.
  *
  * @param e the userrole
  */
 public void removeUserrole(Userrole e) {
   e.unlinkFromParent();
   userroles.remove(e);
 }
Example #8
0
 /**
  * Get List of userpermissions associated with entity.
  *
  * @return list of userpermissions
  */
 public List<Userpermission> getUserpermissions() {
   return userpermissions.get();
 }
Example #9
0
 /**
  * remove set listener to userpermissions collections
  *
  * @param listener the set change listener to add
  */
 public void removeUserpermissionSetChangeListener(Listener<SetChangeEventParams> listener) {
   userpermissions.removeSetListener(listener);
 }
Example #10
0
 /**
  * Add set listener to userpermissions collections
  *
  * @param listener the set change listener to add
  */
 public void addUserpermissionSetChangeListener(Listener<SetChangeEventParams> listener) {
   userpermissions.addSetListener(listener);
 }
Example #11
0
 /**
  * Remove a Userpermission from this entity.
  *
  * @param e the userpermission
  */
 public void removeUserpermission(Userpermission e) {
   e.unlinkFromParent();
   userpermissions.remove(e);
 }
Example #12
0
 /**
  * Add a Userpermission to this entity.
  *
  * @param e the userpermission
  */
 public void addUserpermission(Userpermission e) {
   e.linkToParent(this);
   userpermissions.add(e);
 }