Ejemplo n.º 1
0
  @Override
  public Customer populateCustomerModel(
      Customer customerModel,
      PersistableCustomer customer,
      MerchantStore merchantStore,
      Language language)
      throws Exception {
    LOG.info("Starting to populate customer model from customer data");
    CustomerPopulator populator = new CustomerPopulator();
    populator.setCountryService(countryService);
    populator.setCustomerOptionService(customerOptionService);
    populator.setCustomerOptionValueService(customerOptionValueService);
    populator.setLanguageService(languageService);
    populator.setLanguageService(languageService);
    populator.setZoneService(zoneService);

    customerModel = populator.populate(customer, customerModel, merchantStore, language);
    // set groups
    // if(!StringUtils.isBlank(customerModel.getPassword()) &&
    // !StringUtils.isBlank(customerModel.getNick())) {
    //	customerModel.setPassword(passwordEncoder.encodePassword(customer.getPassword(), null));
    //	setCustomerModelDefaultProperties(customerModel, merchantStore);
    // }

    LOG.info("About to persist customer to database.");
    customerService.saveOrUpdate(customerModel);
    return customerModel;
  }
Ejemplo n.º 2
0
  @Override
  public Customer getCustomerModel(
      final PersistableCustomer customer, final MerchantStore merchantStore, Language language)
      throws Exception {

    LOG.info("Starting to populate customer model from customer data");
    Customer customerModel = null;
    CustomerPopulator populator = new CustomerPopulator();
    populator.setCountryService(countryService);
    populator.setCustomerOptionService(customerOptionService);
    populator.setCustomerOptionValueService(customerOptionValueService);
    populator.setLanguageService(languageService);
    populator.setLanguageService(languageService);
    populator.setZoneService(zoneService);

    customerModel = populator.populate(customer, merchantStore, language);
    // set groups
    if (!StringUtils.isBlank(customerModel.getPassword())
        && !StringUtils.isBlank(customerModel.getNick())) {
      customerModel.setPassword(passwordEncoder.encodePassword(customer.getClearPassword(), null));
      setCustomerModelDefaultProperties(customerModel, merchantStore);
    }

    return customerModel;
  }