/** * <p>Set the passwordEncoder to be used by this class. * <p> * <p>This method will indirectly set one of the two PasswordEncoder member variables, depending on its type * by calling {@link #setupPasswordEncoder()} * * @param passwordEncoder Either Spring Security's new {@link PasswordEncoder}, or the deprecated {@link org.springframework.security.authentication.encoding.PasswordEncoder PasswordEncoder} */ public void setPasswordEncoder(Object passwordEncoder) { this.passwordEncoderBean = passwordEncoder; setupPasswordEncoder(); }
@Override public Customer createNewCustomer() { return createCustomerFromId(null); }
@Override public Phone copyPhone(Phone orig) { return copyPhone(null, orig); }
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { Customer customer = customerService.readCustomerByUsername(username, false); if (customer == null) { throw new UsernameNotFoundException("The customer was not found"); } boolean isActive = !customer.isDeactivated(); if (Status.class.isAssignableFrom(customer.getClass())) { isActive = isActive && ((Status) customer).isActive(); } List<GrantedAuthority> grantedAuthorities = createGrantedAuthorities(roleService.findCustomerRolesByCustomerId(customer.getId())); return new CustomerUserDetails(customer.getId(), username, customer.getPassword(), isActive, true, !customer.isPasswordChangeRequired(), true, grantedAuthorities); }
/** * Saves a customerAddress with state KY and country US. Requires that createCountry() and createState() have been called * @param customerAddress */ public CustomerAddress saveCustomerAddress(CustomerAddress customerAddress) { State state = stateService.findStateByAbbreviation("KY"); customerAddress.getAddress().setState(state); Country country = countryService.findCountryByAbbreviation("US"); customerAddress.getAddress().setCountry(country); customerAddress.getAddress().setIsoCountrySubdivision("US-KY"); ISOCountry isoCountry = isoService.findISOCountryByAlpha2Code("US"); customerAddress.getAddress().setIsoCountryAlpha2(isoCountry); return customerAddressService.saveCustomerAddress(customerAddress); }
/** * Renders the add address form during the multiship process * * @param request * @param response * @param model * @return the return path */ public String showMultishipAddAddress(HttpServletRequest request, HttpServletResponse response, Model model) { model.addAttribute("states", stateService.findStates()); model.addAttribute("countries", countryService.findCountries()); model.addAttribute("countrySubdivisions", countrySubdivisionService.findSubdivisions()); return getMultishipAddAddressView(); }
protected void copyCustomerPaymentAddressToBillingAddress(PaymentInfoForm paymentForm) { CustomerPayment customerPayment = customerPaymentService.readCustomerPaymentById(paymentForm.getCustomerPaymentId()); if (customerPayment != null) { Address address = customerPayment.getBillingAddress(); if (address != null) { paymentForm.setAddress(addressService.copyAddress(address)); } } }
public void createState() { State state = new StateImpl(); state.setAbbreviation("KY"); state.setName("Kentucky"); state.setCountry(countryService.findCountryByAbbreviation("US")); stateService.save(state); }
public Customer createCustomer() { Customer customer = customerService.createCustomerFromId(null); return customer; }
protected List<Country> populateCountries() { return countryService.findCountries(); }
protected List<State> populateStates() { return stateService.findStates(); }
/** * Remove the cart from the persistence layer. Subclasses may override for custom cart retrieval logic. * * @param customer the customer to remove */ protected void deleteCustomer(Customer customer) { //We delete the customer this way (rather than with a delete query) in order to ensure the cascades take place customerService.deleteCustomer(customer); }
@Override public Address copyAddress(Address orig) { return copyAddress(null, orig); }
public CustomerUserDetails withId(Long id) { setId(id); return this; }
public List<CountrySubdivision> getCountrySubOptionsByCountryAbbrev(String countryAbbreviation) { return countrySubdivisionService.findSubdivisions(countryAbbreviation); }
@Deprecated @Override public Object getSalt(Customer customer) { return getSalt(customer, ""); }
@Override @Transactional(TransactionUtils.DEFAULT_TRANSACTION_MANAGER) public GenericResponse sendForcedPasswordChangeNotification(String username, String resetPasswordUrl) { return sendForgotPasswordNotification(username, resetPasswordUrl); }
public Customer createCustomer() { Customer customer = customerService.createCustomerFromId(null); return customer; }
public List<Country> getCountryOptions() { return countryService.findCountries(); }
@Override public Customer createCustomer() { return createCustomerFromId(null); }