Package org.hoteia.qalingo.core.domain

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


        Criteria criteria = createDefaultCriteria(Customer.class);
       
        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

        criteria.add(Restrictions.eq("code", handleCodeValue(code)));
        Customer customer = (Customer) criteria.uniqueResult();
        if(customer != null){
            customer.setFetchPlan(fetchPlan);
        }
        return customer;
  }
View Full Code Here


        Criteria criteria = createDefaultCriteria(Customer.class);
       
        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

        criteria.add(Restrictions.eq("permalink", permalink));
        Customer customer = (Customer) criteria.uniqueResult();
        if(customer != null){
            customer.setFetchPlan(fetchPlan);
        }
        return customer;
  }
View Full Code Here

        Criteria criteria = createDefaultCriteria(Customer.class);
       
        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

        criteria.add(Restrictions.or(Restrictions.eq("login", usernameOrEmail), Restrictions.eq("email", usernameOrEmail)));
        Customer customer = (Customer) criteria.uniqueResult();
        if(customer != null){
            customer.setFetchPlan(fetchPlan);
        }
        return customer;
  }
View Full Code Here

        }
        if (customer.getId() != null) {
            if(em.contains(customer)){
                em.refresh(customer);
            }
            Customer mergedCustomer = em.merge(customer);
            em.flush();
            return mergedCustomer;
        } else {
            em.persist(customer);
            return customer;
View Full Code Here

    @RequestMapping(value = "/documents/**", method = RequestMethod.GET)
    public ResponseEntity<byte[]> customerDetails(final HttpServletRequest request, final Model model) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final String requestURL = request.getRequestURL().toString();
        final Customer customer = requestData.getCustomer();

        if (customer != null) {
            final List<OrderCustomer> orders = orderCustomerService.findOrdersByCustomerId(customer.getId().toString());
            for (Iterator<OrderCustomer> iterator = orders.iterator(); iterator.hasNext();) {
                OrderCustomer order = (OrderCustomer) iterator.next();
                if(requestURL.contains(order.getPrefixHashFolder())){
                    String filename = null;
                    String filePath = null;
                    if(requestURL.contains(OrderDocumentType.ORDER_CONFIRMATION.getPropertyKey())){
                        filename = documentService.buildOrderConfirmationFileName(order);
                        filePath = documentService.getOrderConfirmationFilePath(order);
                       
                    } else if(requestURL.contains(OrderDocumentType.SHIPPING_CONFIRMATION.getPropertyKey())){
                        filename = documentService.buildShippingConfirmationFileName(order);
                        filePath = documentService.getShippingConfirmationFilePath(order);
                       
                    } else if(requestURL.contains(OrderDocumentType.INVOICE.getPropertyKey())){
                        filename = documentService.buildInvoiceFileName(order);
                        filePath = documentService.getInvoiceFilePath(order);
                    }
                   
                    if(StringUtils.isNotEmpty(filename)
                            && StringUtils.isNotEmpty(filePath)){
                        Path path = Paths.get(filePath);
                        byte[] contents = Files.readAllBytes(path);
                       
                        HttpHeaders headers = new HttpHeaders();
                        headers.setContentType(MediaType.parseMediaType("application/pdf"));
                        headers.setContentDispositionFormData(filename, filename);
                        headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
                        ResponseEntity<byte[]> response = new ResponseEntity<byte[]>(contents, headers, HttpStatus.OK);
                        return response;
                    }
                }
            }
            logger.warn("This request can't be display, customer " + customer.getEmail() + " is logged, but the Hash doesn't matched:" + requestURL);
        } else {
            logger.warn("This request can't be display, customer is not logged:" + requestURL);
        }
        return null;
    }
View Full Code Here

  @RequestMapping(FoUrls.PERSONAL_PRODUCT_COMMENT_LIST_URL)
  public ModelAndView customerProductComments(final HttpServletRequest request, final Model model) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_PRODUCT_COMMENT_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());
   
    final CustomerProductCommentsViewBean customerProductCommentsViewBean = frontofficeViewBeanFactory.buildViewBeanCustomerProductComments(requestUtil.getRequestData(request), reloadedCustomer);
    model.addAttribute("customerProductComments", customerProductCommentsViewBean);

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

        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (!(authentication instanceof AnonymousAuthenticationToken)) {
            String currentCustomerName = authentication.getName();
           
            if(StringUtils.isNotEmpty(currentCustomerName)){
                Customer customer = customerService.getCustomerByLoginOrEmail(currentCustomerName);

                if(StringUtils.isNotEmpty(getCartPojoRequest.getMarketAreaCode())){
                    MarketArea marketArea = marketService.getMarketAreaByCode(getCartPojoRequest.getMarketAreaCode());
                    try {
                        CartPojo cartPojo = checkoutPojoService.getCart(marketArea, customer);
View Full Code Here

            Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
            if (!(authentication instanceof AnonymousAuthenticationToken)) {
                String currentCustomerName = authentication.getName();
               
                if(StringUtils.isNotEmpty(currentCustomerName)){
                    Customer customer = customerService.getCustomerByLoginOrEmail(currentCustomerName);
                    cart = cartService.newCustomerCart(marketArea, customer);
                } else {
                    cart = cartService.newGuestCart(marketArea);
                }
            } else {
View Full Code Here

        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (!(authentication instanceof AnonymousAuthenticationToken)) {
            String currentCustomerName = authentication.getName();
           
            if(StringUtils.isNotEmpty(currentCustomerName)){
                Customer customer = customerService.getCustomerByLoginOrEmail(currentCustomerName);

                if(StringUtils.isNotEmpty(addressCartPojoRequest.getCartId())){
                    Cart cart = cartService.getCartById(addressCartPojoRequest.getCartId());
                    String customerAddressId = addressCartPojoRequest.getCustomerAddressId();
                    checkoutPojoService.setShippingAddress(cart, customer, customerAddressId);
View Full Code Here

        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (!(authentication instanceof AnonymousAuthenticationToken)) {
            String currentCustomerName = authentication.getName();
           
            if(StringUtils.isNotEmpty(currentCustomerName)){
                Customer customer = customerService.getCustomerByLoginOrEmail(currentCustomerName);

                if(StringUtils.isNotEmpty(addressCartPojoRequest.getCartId())){
                    Cart cart = cartService.getCartById(addressCartPojoRequest.getCartId());
                    String customerAddressId = addressCartPojoRequest.getCustomerAddressId();
                    checkoutPojoService.setBillingAddress(cart, customer, customerAddressId);
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.