private UserWeb copyUserFromGUI(UserWeb updateUser) { UserWeb user = copyUser(updateUser); // Name user.setUsername(userName.getValue()); user.setFirstName(firstName.getValue()); user.setLastName(lastName.getValue()); // password if (passwordNew.getValue() != null && passwordConfirm.getValue() != null) { user.setPassword(passwordNew.getValue()); user.setConfirmPassword(passwordConfirm.getValue()); } user.setPasswordHint(passwordHint.getValue()); // Address user.setAddress(address.getValue()); user.setCity(city.getValue()); if (state.getValue() != null) { user.setState(state.getValue().getAbbr()); } user.setPostalCode(zip.getValue()); Country countryValue = country.getValue(); if (countryValue != null) { user.setCountry(countryValue.getName()); } // Phone user.setPhoneNumber(phoneNumber.getValue()); // Other user.setEmail(email.getValue()); user.setWebsite(webSite.getValue()); return user; }
private void displayRecords(UserWeb user) { // Name userName.setValue(user.getUsername()); firstName.setValue(user.getFirstName()); lastName.setValue(user.getLastName()); passwordHint.setValue(user.getPasswordHint()); // Address address.setValue(user.getAddress()); city.setValue(user.getCity()); for (State st : states.getModels()) { if (st.getAbbr().equals(user.getState())) state.setValue(st); } zip.setValue(user.getPostalCode()); for (Country co : countries.getModels()) { if (co.getName().equals(user.getCountry())) country.setValue(co); } // Phone phoneNumber.setValue(user.getPhoneNumber()); // Other email.setValue(user.getEmail()); emailConfirm.setValue(user.getEmail()); webSite.setValue(user.getWebsite()); }
private UserWeb copyUser(UserWeb user) { UserWeb updatingUser = new UserWeb(); updatingUser.setId(user.getId()); // Name updatingUser.setUsername(user.getUsername()); updatingUser.setFirstName(user.getFirstName()); updatingUser.setLastName(user.getLastName()); // Password updatingUser.setPassword(user.getPassword()); updatingUser.setConfirmPassword(user.getConfirmPassword()); updatingUser.setPasswordHint(user.getPasswordHint()); // Address updatingUser.setAddress(user.getAddress()); updatingUser.setCity(user.getCity()); updatingUser.setState(user.getState()); updatingUser.setPostalCode(user.getPostalCode()); updatingUser.setCountry(user.getCountry()); // Phone updatingUser.setPhoneNumber(user.getPhoneNumber()); // Other updatingUser.setEmail(user.getEmail()); updatingUser.setWebsite(user.getWebsite()); updatingUser.setVersion(user.getVersion()); updatingUser.setAccountExpired(user.getAccountExpired()); updatingUser.setAccountLocked(user.getAccountLocked()); updatingUser.setEnabled(user.getEnabled()); updatingUser.setCredentialsExpired(user.getCredentialsExpired()); // user roles updatingUser.setRoles(user.getRoles()); return updatingUser; }