Package org.hoteia.qalingo.core.domain

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


        try {
            final RequestData requestData = requestUtil.getRequestData(request);
           
            modelAndView.getModelMap().put(ModelConstants.COMMON_VIEW_BEAN, frontofficeViewBeanFactory.buildViewBeanCommon(requestData));
           
            final Customer customer = requestData.getCustomer();
            if(customer != null){
                modelAndView.getModelMap().put(ModelConstants.CUSTOMER_VIEW_BEAN, frontofficeViewBeanFactory.buildViewBeanCustomer(requestData, customer));
            }
           
            modelAndView.getModelMap().put(ModelConstants.LEGAl_TERMS_VIEW_BEAN, frontofficeViewBeanFactory.buildViewBeanLegalTerms(requestData));
View Full Code Here


    /**
     *
     */
    protected Customer getCurrentCustomer(final HttpServletRequest request) throws Exception {
        EngineEcoSession engineEcoSession = getCurrentEcoSession(request);
        Customer customer = engineEcoSession.getCurrentCustomer();
        if (customer == null) {
            // CHECK
            if (SecurityContextHolder.getContext().getAuthentication() != null) {
                String username = SecurityContextHolder.getContext().getAuthentication().getName();
                if (StringUtils.isNotEmpty(username) && !username.equalsIgnoreCase("anonymousUser")) {
View Full Code Here

    /**
     *
     */
    public boolean hasKnownCustomerLogged(final HttpServletRequest request) throws Exception {
        final Customer customer = getCurrentCustomer(request);
        if (customer != null) {
            return true;
        }
        return false;
    }
View Full Code Here

    /**
     *
     */
    public Long getCurrentCustomerId(final HttpServletRequest request) throws Exception {
        Customer customer = getCurrentCustomer(request);
        if (customer == null) {
            return null;
        }
        return customer.getId();
    }
View Full Code Here

    /**
     *
     */
    public String getCurrentCustomerLogin(final HttpServletRequest request) throws Exception {
        EngineEcoSession engineEcoSession = getCurrentEcoSession(request);
        Customer customer = engineEcoSession.getCurrentCustomer();
        if (customer == null) {
            return null;
        }
        return customer.getLogin();
    }
View Full Code Here

            requestData.setBackofficeLocalization(getCurrentBackofficeLocalization(requestData));

        } else {
            // SPECIFIC FRONTOFFICE
            Customer customer = getCurrentCustomer(request);
            if (customer != null) {
                requestData.setCustomer(customer);
            }
           
            requestData.setCart(getCurrentCart(request));
View Full Code Here

      final String email = "";

      final String firstName = userPojo.getName();
      final String lastName = userPojo.getName();
      final String locale = userPojo.getLang();
      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);
       
        customer.setNetworkOrigin(CustomerNetworkOrigin.TWITTER);

        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

            final String email = userPojo.getEmailAccount();
            final String firstName = userPojo.getFirstName();
            final String lastName = userPojo.getLastName();
            final String gender = userPojo.getGender();
            final String username = userPojo.getNickname();
            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.GOOGLE_ACCOUNT);

                CustomerAttribute attribute = new CustomerAttribute();
                AttributeDefinition attributeDefinition = attributeService.getAttributeDefinitionByCode(CustomerAttribute.CUSTOMER_ATTRIBUTE_SCREENAME);
                attribute.setAttributeDefinition(attributeDefinition);
                String screenName = username;
                if (StringUtils.isEmpty(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);

                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

      final String firstName = userPojo.getFirstName();
      final String lastName = userPojo.getLastName();
      final String gender = userPojo.getGender();
      final String locale = userPojo.getLocale();
      final String username = userPojo.getUsername();
      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.FACEBOOK);
       
        CustomerAttribute attribute = new CustomerAttribute();
        AttributeDefinition attributeDefinition = attributeService.getAttributeDefinitionByCode(CustomerAttribute.CUSTOMER_ATTRIBUTE_SCREENAME);
        attribute.setAttributeDefinition(attributeDefinition);
        String screenName = username;
        if(StringUtils.isEmpty(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

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.