Package org.hoteia.qalingo.core.domain

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


        // SHIPMENT
        Set<OrderShipment> orderShipments = new HashSet<OrderShipment>();
        Set<DeliveryMethod> deliveryMethods = cart.getDeliveryMethods();
        if(deliveryMethods != null){
            for (Iterator<DeliveryMethod> iteratorDeliveryMethod = deliveryMethods.iterator(); iteratorDeliveryMethod.hasNext();) {
                DeliveryMethod deliveryMethod = (DeliveryMethod) iteratorDeliveryMethod.next();
                OrderShipment orderShipment = new OrderShipment();
                orderShipment.setName(deliveryMethod.getName());
                orderShipment.setExpectedDeliveryDate(null);
                orderShipment.setDeliveryMethodId(deliveryMethod.getId());
                orderShipment.setPrice(deliveryMethod.getPrice(cart.getCurrency().getId()));
               
                Set<CartItem> cartItems = cart.getCartItems();
                Set<OrderItem> orderItems = new HashSet<OrderItem>();
                for (Iterator<CartItem> iteratorCartItem = cartItems.iterator(); iteratorCartItem.hasNext();) {
                    CartItem cartItem = (CartItem) iteratorCartItem.next();
View Full Code Here


            // SUB PART : Shippings
            final List<CartDeliveryMethodViewBean> cartDeliveryMethodViewBeans = new ArrayList<CartDeliveryMethodViewBean>();
            final Set<DeliveryMethod> deliveryMethods = cart.getDeliveryMethods();
            if (deliveryMethods != null) {
                for (Iterator<DeliveryMethod> iterator = deliveryMethods.iterator(); iterator.hasNext();) {
                    final DeliveryMethod deliveryMethod = (DeliveryMethod) iterator.next();
                    if(deliveryMethod != null){
                        final CartDeliveryMethodViewBean cartDeliveryMethodViewBean = new CartDeliveryMethodViewBean();
                        cartDeliveryMethodViewBean.setLabel(deliveryMethod.getName());
                        cartDeliveryMethodViewBean.setAmountWithCurrencySign(deliveryMethod.getPriceWithStandardCurrencySign(cart.getCurrency().getId()));
                        Object[] params = { deliveryMethod.getName() };
                        cartDeliveryMethodViewBean.setLabel(getSpecificMessage(ScopeWebMessage.COMMON, "shoppingcart.amount.deliveryMethods", params, locale));
                        cartDeliveryMethodViewBeans.add(cartDeliveryMethodViewBean);
                    }
                }
                cartViewBean.setCartDeliveryMethods(cartDeliveryMethodViewBeans);
View Full Code Here

        if(StringUtils.isEmpty(deliveryMethodCode)){
            final String urlRedirect = backofficeUrlService.generateUrl(BoUrls.DELIVERY_METHOD_LIST, requestData);
            return new ModelAndView(new RedirectView(urlRedirect));
        }
       
    final DeliveryMethod deliveryMethod = deliveryMethodService.getDeliveryMethodByCode(deliveryMethodCode);
   
        // SANITY CHECK
    if(deliveryMethod != null){
          modelAndView.addObject(ModelConstants.DELIVERY_METHOD_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanDeliveryMethod(requestData, deliveryMethod));
    } else {
      final String url = requestUtil.getLastRequestUrl(request);
      return new ModelAndView(new RedirectView(url));
    }
   
        final List<WarehouseViewBean> warehouseViewBeans = new ArrayList<WarehouseViewBean>();
        final List<Warehouse> warehouses = warehouseService.findWarehousesByDeliveryMethodId(deliveryMethod.getId());
        for (Iterator<Warehouse> iterator = warehouses.iterator(); iterator.hasNext();) {
            Warehouse warehouse = (Warehouse) iterator.next();
            warehouseViewBeans.add(backofficeViewBeanFactory.buildViewBeanWarehouse(requestUtil.getRequestData(request), warehouse));
        }
        request.setAttribute(ModelConstants.WAREHOUSES_VIEW_BEAN, warehouseViewBeans);
       
        model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.DELIVERY_METHOD_LIST, requestData));
   
        Object[] params = {deliveryMethod.getName() + " (" + deliveryMethod.getCode() + ")"};
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, BoUrls.DELIVERY_METHOD_DETAILS.getKey(), params);

        return modelAndView;
  }
View Full Code Here

        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String deliveryMethodCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_DELIVERY_METHOD_CODE);
        if(StringUtils.isNotEmpty(deliveryMethodCode)){
            // EDIT MODE
            final DeliveryMethod deliveryMethod = deliveryMethodService.getDeliveryMethodByCode(deliveryMethodCode, FetchPlanGraphDeliveryMethod.fullDeliveryMethodFetchPlan());

            DeliveryMethodViewBean deliveryMethodViewBean = backofficeViewBeanFactory.buildViewBeanDeliveryMethod(requestData, deliveryMethod);
            request.setAttribute(ModelConstants.DELIVERY_METHOD_VIEW_BEAN, deliveryMethodViewBean);

            Object[] params = {deliveryMethod.getName() + " (" + deliveryMethod.getCode() + ")"};
            overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, BoUrls.DELIVERY_METHOD_EDIT.getKey(), params);

            model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.DELIVERY_METHOD_DETAILS, requestData, deliveryMethod));
        } else {
            // ADD MODE
View Full Code Here

    if (result.hasErrors()) {
      return deliveryMethodEdit(request, model, deliveryMethodForm);
    }

        DeliveryMethod deliveryMethod = null;
        if(StringUtils.isNotEmpty(deliveryMethodForm.getId())){
            deliveryMethod = deliveryMethodService.getDeliveryMethodById(deliveryMethodForm.getId());
        }

    try {
        // CREATE OR UPDATE DELIVERY METHOD
        DeliveryMethod savedDeliveryMethod = webBackofficeService.createOrUpdateDeliveryMethod(deliveryMethod, deliveryMethodForm);
       
            if (deliveryMethod == null) {
                addSuccessMessage(request, getSpecificMessage(ScopeWebMessage.DELIVERY_METHOD, "create_success_message", locale));
            } else {
                addSuccessMessage(request, getSpecificMessage(ScopeWebMessage.DELIVERY_METHOD, "update_success_message", locale));
View Full Code Here

    protected DeliveryMethodForm initDeliveryMethodForm(final HttpServletRequest request, final Model model) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String deliveryMethodCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_DELIVERY_METHOD_CODE);
        if(StringUtils.isNotEmpty(deliveryMethodCode)){
            final DeliveryMethod deliveryMethodEdit = deliveryMethodService.getDeliveryMethodByCode(deliveryMethodCode);
            return backofficeFormFactory.buildDeliveryMethodForm(requestData, deliveryMethodEdit);
        }
       
        return backofficeFormFactory.buildDeliveryMethodForm(requestData, null);
    }
View Full Code Here

   
    final List<DeliveryMethodViewBean> deliveryMethodViewBeans = new ArrayList<DeliveryMethodViewBean>();

    final List<DeliveryMethod> deliveryMethods = deliveryMethodService.findDeliveryMethodsByMarketAreaId(marketArea.getId());
    for (Iterator<DeliveryMethod> iterator = deliveryMethods.iterator(); iterator.hasNext();) {
      DeliveryMethod deliveryMethod = (DeliveryMethod) iterator.next();
      deliveryMethodViewBeans.add(backofficeViewBeanFactory.buildViewBeanDeliveryMethod(requestUtil.getRequestData(request), deliveryMethod));
    }
    deliveryMethodViewBeanPagedListHolder = new PagedListHolder<DeliveryMethodViewBean>(deliveryMethodViewBeans);
    deliveryMethodViewBeanPagedListHolder.setPageSize(Constants.PAGE_SIZE);
        request.getSession().setAttribute(sessionKey, deliveryMethodViewBeanPagedListHolder);
View Full Code Here

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

        criteria.add(Restrictions.eq("id", deliveryMethodId));
        DeliveryMethod deliveryMethod = (DeliveryMethod) criteria.uniqueResult();
        if(deliveryMethod != null){
            deliveryMethod.setFetchPlan(fetchPlan);
        }
        return deliveryMethod;
  }
View Full Code Here

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

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

        deliveryMethod.setDateUpdate(new Date());
        if (deliveryMethod.getId() != null) {
            if(em.contains(deliveryMethod)){
                em.refresh(deliveryMethod);
            }
            DeliveryMethod mergedDeliveryMethod = em.merge(deliveryMethod);
            em.flush();
            return mergedDeliveryMethod;
        } else {
            em.persist(deliveryMethod);
            return deliveryMethod;
View Full Code Here

TOP

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

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.