@Test public void testGetForm() { PersonForm personForm = userAccountHelper.getForm(TEST_USER_NAME); assertEquals(personForm.getId(), 10000l); assertEquals(personForm.getUsername(), TEST_USER_NAME); Map<String, StringListAttribute> personAttributes = personForm.getAttributes(); assertNotNull(personAttributes); StringListAttribute attributeValues = personAttributes.get(TEST_ATTRIBUTE_NAME); List<String> values = attributeValues.getValue(); assertEquals(values.get(0), CURRENT_ATTRIBUTE_VALUES.get(0)); }
public PersonForm getForm(String username) { ILocalAccountPerson person = accountDao.getPerson(username); PersonForm form = new PersonForm(accountEditAttributes); form.setUsername(person.getName()); form.setId(person.getId()); Set<String> attributeNames = accountDao.getCurrentAttributeNames(); for (String name : attributeNames) { List<String> values = new ArrayList<String>(); List<Object> attrValues = person.getAttributeValues(name); if (attrValues != null) { for (Object value : person.getAttributeValues(name)) { values.add((String) value); } } form.getAttributes().put(name, new StringListAttribute(values)); } return form; }
UserAccountHelper { public PersonForm getForm(String username) { ILocalAccountPerson person = accountDao.getPerson(username); PersonForm form = new PersonForm(accountEditAttributes); form.setUsername(person.getName()); form.setId(person.getId()); Set<String> attributeNames = accountDao.getCurrentAttributeNames(); for (String name : attributeNames) { List<String> values = new ArrayList<String>(); List<Object> attrValues = person.getAttributeValues(name); if (attrValues != null) { for (Object value : person.getAttributeValues(name)) { values.add((String) value); } } form.getAttributes().put(name, new StringListAttribute(values)); } return form; } }
UserAccountHelper { public PersonForm getForm(String username) { ILocalAccountPerson person = accountDao.getPerson(username); PersonForm form = new PersonForm(accountEditAttributes); form.setUsername(person.getName()); form.setId(person.getId()); Set<String> attributeNames = accountDao.getCurrentAttributeNames(); for (String name : attributeNames) { List<String> values = new ArrayList<String>(); List<Object> attrValues = person.getAttributeValues(name); if (attrValues != null) { for (Object value : person.getAttributeValues(name)) { values.add((String) value); } } form.getAttributes().put(name, new StringListAttribute(values)); } return form; }  }
UserAccountHelper { public PersonForm getForm(String username) { ILocalAccountPerson person = accountDao.getPerson(username); PersonForm form = new PersonForm(accountEditAttributes); form.setUsername(person.getName()); form.setId(person.getId()); Set<String> attributeNames = accountDao.getCurrentAttributeNames(); for (String name : attributeNames) { List<String> values = new ArrayList<String>(); List<Object> attrValues = person.getAttributeValues(name); if (attrValues != null) { for (Object value : person.getAttributeValues(name)) { values.add((String) value); } } form.getAttributes().put(name, new StringListAttribute(values)); } return form; }  @Autowired void setLocaleStore(ILocaleStore localeStore); @Autowired void setLocaleManagerFactory(LocaleManagerFactory localeManagerFactory); @Autowired void setLocalAccountDao(ILocalAccountDao accountDao); @Autowired void setPortalPasswordService(IPortalPasswordService passwordService); @Resource(name = "accountEditAttributes") void setAccountEditAttributes(List<Preference> accountEditAttributes); @Autowired void setPortalUrlProvider(IPortalUrlProvider urlProvider); @Autowired void setMessageSource(MessageSource messageSource); @Autowired void setPersonManager(IPersonManager personManager); @Autowired void setGroupListHelper(IGroupListHelper groupListHelper); @Autowired void setPasswordResetNotification(IPasswordResetNotification passwordResetNotification); @Value("${org.apereo.portal.folder.login-layout:welcome}") void setLoginPortletFolderName(String loginPortletFolderName); PersonForm getNewAccountForm(); PersonForm getForm(String username); List<JsonEntityBean> getParentGroups(String target); boolean canEditUser(IPerson currentUser, String target); List<Preference> getEditableUserAttributes(IPerson currentUser); List<GroupedPersonAttribute> groupPersonAttributes(
            final IPersonAttributes user, final HttpServletRequest request); boolean canDeleteUser(IPerson currentUser, String target); void deleteAccount(IPerson currentUser, String target); void updateAccount(IPerson currentUser, PersonForm form); String getRandomToken(); boolean validateLoginToken(String username, String token); void sendLoginToken(HttpServletRequest request, ILocalAccountPerson account); void sendLoginToken(
            HttpServletRequest request,
            ILocalAccountPerson account,
            IPasswordResetNotification notification); void createPassword(PersonForm form, String token); }
UserAccountHelper { public PersonForm getForm(String username) { ILocalAccountPerson person = accountDao.getPerson(username); PersonForm form = new PersonForm(accountEditAttributes); form.setUsername(person.getName()); form.setId(person.getId()); Set<String> attributeNames = accountDao.getCurrentAttributeNames(); for (String name : attributeNames) { List<String> values = new ArrayList<String>(); List<Object> attrValues = person.getAttributeValues(name); if (attrValues != null) { for (Object value : person.getAttributeValues(name)) { values.add((String) value); } } form.getAttributes().put(name, new StringListAttribute(values)); } return form; }  @Autowired void setLocaleStore(ILocaleStore localeStore); @Autowired void setLocaleManagerFactory(LocaleManagerFactory localeManagerFactory); @Autowired void setLocalAccountDao(ILocalAccountDao accountDao); @Autowired void setPortalPasswordService(IPortalPasswordService passwordService); @Resource(name = "accountEditAttributes") void setAccountEditAttributes(List<Preference> accountEditAttributes); @Autowired void setPortalUrlProvider(IPortalUrlProvider urlProvider); @Autowired void setMessageSource(MessageSource messageSource); @Autowired void setPersonManager(IPersonManager personManager); @Autowired void setGroupListHelper(IGroupListHelper groupListHelper); @Autowired void setPasswordResetNotification(IPasswordResetNotification passwordResetNotification); @Value("${org.apereo.portal.folder.login-layout:welcome}") void setLoginPortletFolderName(String loginPortletFolderName); PersonForm getNewAccountForm(); PersonForm getForm(String username); List<JsonEntityBean> getParentGroups(String target); boolean canEditUser(IPerson currentUser, String target); List<Preference> getEditableUserAttributes(IPerson currentUser); List<GroupedPersonAttribute> groupPersonAttributes(
            final IPersonAttributes user, final HttpServletRequest request); boolean canDeleteUser(IPerson currentUser, String target); void deleteAccount(IPerson currentUser, String target); void updateAccount(IPerson currentUser, PersonForm form); String getRandomToken(); boolean validateLoginToken(String username, String token); void sendLoginToken(HttpServletRequest request, ILocalAccountPerson account); void sendLoginToken(
            HttpServletRequest request,
            ILocalAccountPerson account,
            IPasswordResetNotification notification); void createPassword(PersonForm form, String token);  }