@Override protected final void entityRestoreState() { username = usernameOriginal; encodedpassword = encodedpasswordOriginal; usercode = usercodeOriginal; enabled = enabledOriginal; userpermissions.restoreState(); userroles.restoreState(); }
/** * 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()); }
/** * Get List of userroles associated with entity. * * @return list of userroles */ public List<Userrole> getUserroles() { return userroles.get(); }
/** * Add set listener to userroles collections * * @param listener the set change listener to add */ public void addUserroleSetChangeListener(Listener<SetChangeEventParams> listener) { userroles.addSetListener(listener); }
/** * remove set listener to userroles collections * * @param listener the set change listener to add */ public void removeUserroleSetChangeListener(Listener<SetChangeEventParams> listener) { userroles.removeSetListener(listener); }
/** * Add a Userrole to this entity. * * @param e the userrole */ public void addUserrole(Userrole e) { e.linkToParent(this); userroles.add(e); }
/** * Remove a Userrole from this entity. * * @param e the userrole */ public void removeUserrole(Userrole e) { e.unlinkFromParent(); userroles.remove(e); }
/** * Get List of userpermissions associated with entity. * * @return list of userpermissions */ public List<Userpermission> getUserpermissions() { return userpermissions.get(); }
/** * remove set listener to userpermissions collections * * @param listener the set change listener to add */ public void removeUserpermissionSetChangeListener(Listener<SetChangeEventParams> listener) { userpermissions.removeSetListener(listener); }
/** * Add set listener to userpermissions collections * * @param listener the set change listener to add */ public void addUserpermissionSetChangeListener(Listener<SetChangeEventParams> listener) { userpermissions.addSetListener(listener); }
/** * Remove a Userpermission from this entity. * * @param e the userpermission */ public void removeUserpermission(Userpermission e) { e.unlinkFromParent(); userpermissions.remove(e); }
/** * Add a Userpermission to this entity. * * @param e the userpermission */ public void addUserpermission(Userpermission e) { e.linkToParent(this); userpermissions.add(e); }