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; }
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; }