public void register(UserVO userVO, UserDAO userDAO, Md5PasswordEncoder pwdEncoder) throws UserNameDuplicateException, EmailDuplicateException, InvalidInputException { if (userVO == null || userVO.getDeliveryInfo() == null || userDAO == null) { throw new IllegalArgumentException("user or userDAO is null"); } validate(userVO, userDAO); populate(userVO, pwdEncoder); dateCreated = new Date(Calendar.getInstance().getTimeInMillis() - TimeZone.getDefault().getRawOffset()); }
// <editor-fold defaultstate="collapsed" desc="Validate"> private void validate(UserVO userVO, UserDAO userDAO) throws UserNameDuplicateException, EmailDuplicateException, InvalidInputException { validateCredentials(userVO.getUserName(), userVO.getPassword(), userDAO); validateDeliveryInfo(userVO.getDeliveryInfo(), userDAO); }
// <editor-fold defaultstate="collapsed" desc="populate"> private void populate(UserVO user, Md5PasswordEncoder pwdEncoder) { populateCredentials(user.getUserName(), user.getPassword(), pwdEncoder); populateDeliveryInfo(user.getDeliveryInfo()); }