Package org.hoteia.qalingo.core.domain

Examples of org.hoteia.qalingo.core.domain.Customer


 
  protected Customer setCommonCustomerInformation(final HttpServletRequest request, final Customer customer) throws Exception {
      final RequestData requestData = requestUtil.getRequestData(request);
      final Market market = requestData.getMarket();
        final MarketArea marketArea = requestData.getMarketArea();
        Customer savedCustomer = webManagementService.buildAndSaveNewCustomer(requestData, market, marketArea, customer);
        return savedCustomer;
  }
View Full Code Here


      final String email = userPojo.getEmails().getPreferred();
      final String firstName = userPojo.getFirstName();
      final String lastName = userPojo.getLastName();
      final String gender = userPojo.getGender();
      final String locale = userPojo.getLocale();
      Customer customer = customerService.getCustomerByLoginOrEmail(email);
     
      if(customer == null){
        // CREATE A NEW CUSTOMER
        customer = new Customer();
        customer = setCommonCustomerInformation(request, customer);

        customer.setLogin(email);
        customer.setPassword(securityUtil.generatePassword());
        customer.setEmail(email);
        customer.setFirstname(firstName);
        customer.setLastname(lastName);
        if(StringUtils.isNotEmpty(gender)){
          customer.setGender(gender);
        }
       
        customer.setNetworkOrigin(CustomerNetworkOrigin.WINDOWS_LIVE);
       
        CustomerAttribute attribute = new CustomerAttribute();
        AttributeDefinition attributeDefinition = attributeService.getAttributeDefinitionByCode(CustomerAttribute.CUSTOMER_ATTRIBUTE_SCREENAME);
        attribute.setAttributeDefinition(attributeDefinition);
        String screenName = "";
        if(StringUtils.isNotEmpty(lastName)){
          if(StringUtils.isNotEmpty(lastName)){
            screenName = lastName;
            if(screenName.length() > 1){
              screenName = screenName.substring(0, 1);
            }
            if(!screenName.endsWith(".")){
              screenName = screenName + ". ";
            }
          }
        }
        screenName = screenName + firstName;
        attribute.setShortStringValue(screenName);
        customer.getAttributes().add(attribute);
       
        if(StringUtils.isNotEmpty(locale)){
          customer.setDefaultLocale(locale);
        }
       
        customerService.saveOrUpdateCustomer(customer);
      }

      // Redirect to the edit page
      if(StringUtils.isNotEmpty(customer.getEmail())){
       
        // Login the new customer
        securityUtil.authenticationCustomer(request, customer);
       
        // Update the customer session
View Full Code Here

  @Resource(name="assembler")
  protected Assembler assembler;

  @Transactional(readOnly = true)
  public org.springframework.security.core.userdetails.User loadUserByUsername(String usernameOrEmail) throws UsernameNotFoundException, DataAccessException {
    Customer customerDetails = null;
    customerDetails = customerService.getCustomerByLoginOrEmail(usernameOrEmail);
    if (customerDetails == null) {
      throw new UsernameNotFoundException("user not found");
    }
    return assembler.buildUserFromCustomerEntity(customerDetails);
View Full Code Here

  @RequestMapping(value = FoUrls.CUSTOMER_DETAILS_URL, method = RequestMethod.GET)
  public ModelAndView customerDetails(final HttpServletRequest request, final Model model) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.CUSTOMER_DETAILS.getVelocityPage());
   
    final String permalink = request.getParameter(RequestConstants.REQUEST_PARAMETER_CUSTOMER_PERMALINK);
    final Customer customer = customerService.getCustomerByPermalink(permalink);
   
    // WE RELOAD THE CUSTOMER FOR THE PERSISTANCE PROXY FILTER
    // IT AVOIDS LazyInitializationException: could not initialize proxy - no Session
    final Customer reloadedCustomer = customerService.getCustomerByLoginOrEmail(customer.getLogin());
   
    final CustomerViewBean customerView = frontofficeViewBeanFactory.buildViewBeanCustomer(requestUtil.getRequestData(request), reloadedCustomer);
    model.addAttribute(ModelConstants.CUSTOMER_DETAILS_VIEW_BEAN, customerView);
   
    Object[] params = { customer.getLastname(), customer.getFirstname() };
View Full Code Here

 
  @RequestMapping(value = FoUrls.PERSONAL_DETAILS_URL, method = RequestMethod.GET)
  public ModelAndView personalDetails(final HttpServletRequest request, final Model model) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_DETAILS.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);
        final Customer currentCustomer = requestData.getCustomer();
   
    // Customer is already set by the abstract

    Object[] params = { currentCustomer.getLastname(), currentCustomer.getFirstname() };
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, FoUrls.PERSONAL_DETAILS.getKey(), params);

        return modelAndView;
  }
View Full Code Here

 
  @RequestMapping(value = FoUrls.PERSONAL_EDIT_URL, method = RequestMethod.GET)
  public ModelAndView displayPersonalEdit(final HttpServletRequest request, final Model model, @ModelAttribute("customerEditForm") CustomerEditForm customerEditForm) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_EDIT.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);
        final Customer currentCustomer = requestData.getCustomer();
   
    // WE RELOAD THE CUSTOMER FOR THE PERSISTANCE PROXY FILTER
    // IT AVOIDS LazyInitializationException: could not initialize proxy - no Session
    final Customer reloadedCustomer = customerService.getCustomerByLoginOrEmail(currentCustomer.getLogin());
       
    if(customerEditForm == null
            || customerEditForm.equals(new CustomerEditForm())){
      customerEditForm = formFactory.buildCustomerEditForm(requestData, reloadedCustomer);
      model.addAttribute("customerEditForm", customerEditForm);
View Full Code Here

    if (result.hasErrors()) {
      return displayPersonalEdit(request, model, customerEditForm);
    }
   
    final String newEmail = customerEditForm.getEmail();
        final Customer currentCustomer = requestData.getCustomer();
    final Customer checkCustomer = customerService.getCustomerByLoginOrEmail(newEmail);
    if(checkCustomer != null
        && !currentCustomer.getEmail().equalsIgnoreCase(newEmail)) {
      final String forgottenPasswordUrl = urlService.generateUrl(FoUrls.FORGOTTEN_PASSWORD, requestData);
      final Object[] objects = {forgottenPasswordUrl};
      result.rejectValue("email", "fo.customer.error_form_create_account_account_already_exist", objects,"This email customer account already exist! Go on this <a href=\"${0}\" alt=\"\">page</a> to get a new password.");
View Full Code Here

      addInfoMessage(request, getSpecificMessage(ScopeWebMessage.PRODUCT_MARKETING, "comment_form_empty_warning_message",  locale));
      return displayProductCommentForm(request, productCode, model, productCommentForm);
    }
   
    final ProductMarketing product = productService.getProductMarketingByCode(productCode);
    final Customer customer = requestData.getCustomer();
   
    if (qualityOfService != 0) {
      ProductMarketingCustomerRate productCustomerRate = new ProductMarketingCustomerRate();
      productCustomerRate.setRate(qualityOfService);
      productCustomerRate.setProductMarketingId(product.getId());
      productCustomerRate.setCustomerId(customer.getId());
      productCustomerRate.setType(Constants.PRODUCT_QUALITY_RATING_TYPE);
      productService.saveOrUpdateProductMarketingCustomerRate(productCustomerRate);
    }
   
    if (ratioQualityPrice != 0) {
      ProductMarketingCustomerRate productCustomerRate = new ProductMarketingCustomerRate();
      productCustomerRate.setRate(ratioQualityPrice);
      productCustomerRate.setProductMarketingId(product.getId());
      productCustomerRate.setCustomerId(customer.getId());
      productCustomerRate.setType(Constants.PRODUCT_PRICE_RATING_TYPE);
      productService.saveOrUpdateProductMarketingCustomerRate(productCustomerRate);
    }
   
    if (priceScore != 0) {
      ProductMarketingCustomerRate productCustomerRate = new ProductMarketingCustomerRate();
      productCustomerRate.setRate(priceScore);
      productCustomerRate.setProductMarketingId(product.getId());
      productCustomerRate.setCustomerId(customer.getId());
      productCustomerRate.setType(Constants.PRODUCT_VALUE_RATING_TYPE);
      productService.saveOrUpdateProductMarketingCustomerRate(productCustomerRate);
    }
   
    if (StringUtils.isNotEmpty(productCommentForm.getComment())) {
View Full Code Here

 
  @RequestMapping(FoUrls.PERSONAL_ADDRESS_LIST_URL)
  public ModelAndView customerListAddress(final HttpServletRequest request, final Model model) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_ADDRESS_LIST.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);
        final Customer currentCustomer = requestData.getCustomer();
   
    // WE RELOAD THE CUSTOMER FOR THE PERSISTANCE PROXY FILTER
    // IT AVOIDS LazyInitializationException: could not initialize proxy - no Session
    final Customer reloadedCustomer = customerService.getCustomerByLoginOrEmail(currentCustomer.getLogin());
   
    Object[] params = { currentCustomer.getLastname(), currentCustomer.getFirstname() };
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, FoUrls.PERSONAL_ADDRESS_LIST.getKey(), params);
       
    final CustomerAddressListViewBean customerAdressesViewBean = frontofficeViewBeanFactory.buildViewBeanCustomerAddressList(requestUtil.getRequestData(request), reloadedCustomer);
View Full Code Here

 
  @RequestMapping(value = FoUrls.PERSONAL_ADD_ADDRESS_URL, method = RequestMethod.GET)
  public ModelAndView displayCustomerAddAddress(final HttpServletRequest request, final Model model, @ModelAttribute("customerAddressForm") CustomerAddressForm customerAddressForm) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_ADD_ADDRESS.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final Customer currentCustomer = requestData.getCustomer();

        // WE RELOAD THE CUSTOMER FOR THE PERSISTANCE PROXY FILTER
        // IT AVOIDS LazyInitializationException: could not initialize proxy - no Session
        final Customer reloadedCustomer = customerService.getCustomerByLoginOrEmail(currentCustomer.getLogin());

        final CustomerAddressListViewBean customerAdressesViewBean = frontofficeViewBeanFactory.buildViewBeanCustomerAddressList(requestUtil.getRequestData(request), reloadedCustomer);
        model.addAttribute(ModelConstants.CUSTOMER_ADDRESSES_VIEW_BEAN, customerAdressesViewBean);

        Object[] params = { currentCustomer.getLastname(), currentCustomer.getFirstname() };
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.domain.Customer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.