Package org.hoteia.qalingo.core.domain

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


        Criteria criteria = createDefaultCriteria(Warehouse.class);

        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

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


        Criteria criteria = createDefaultCriteria(Warehouse.class);

        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

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

        if (warehouse.getId() != null) {
            if (em.contains(warehouse)) {
                em.refresh(warehouse);
            }
            Warehouse mergedWarehouse = em.merge(warehouse);
            em.flush();
            return mergedWarehouse;
        } else {
            em.persist(warehouse);
            return warehouse;
View Full Code Here

    }
   
        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));
View Full Code Here

     */
    public List<WarehouseViewBean> buildListViewBeanWarehouse(final RequestData requestData, final List<Warehouse> warehouses) throws Exception {
        final List<WarehouseViewBean> warehouseViewBeans = new ArrayList<WarehouseViewBean>();
        if (warehouses != null) {
            for (Iterator<Warehouse> iterator = warehouses.iterator(); iterator.hasNext();) {
                Warehouse warehouse = (Warehouse) iterator.next();
                warehouseViewBeans.add(buildViewBeanWarehouse(requestData, warehouse));
            }
        }
        return warehouseViewBeans;
    }
View Full Code Here

        return retailerService.saveOrUpdateRetailer(retailer);
  }

    public Warehouse createOrUpdateWarehouse(final RequestData requestData, Warehouse warehouse, final WarehouseForm warehouseForm) {
        if (warehouse == null) {
            warehouse = new Warehouse();
            Set<WarehouseMarketAreaRel> warehouseMarketAreas = new HashSet<WarehouseMarketAreaRel>();
            WarehouseMarketAreaRel warehouseMarketArea = new WarehouseMarketAreaRel();
            warehouseMarketArea.setMarketArea(requestData.getMarketArea());
            warehouseMarketAreas.add(warehouseMarketArea);
            warehouse.setWarehouseMarketAreaRels(warehouseMarketAreas);
        }
        if (StringUtils.isNotEmpty(warehouseForm.getCode())) {
            warehouse.setCode(warehouseForm.getCode());
        }
        if (StringUtils.isNotEmpty(warehouseForm.getName())) {
            warehouse.setName(warehouseForm.getName());
        }
        warehouse.setDescription(warehouseForm.getDescription());

        warehouse.setAddress1(warehouseForm.getAddress1());
        warehouse.setAddress2(warehouseForm.getAddress2());
        warehouse.setAddressAdditionalInformation(warehouseForm.getAddressAdditionalInformation());
        warehouse.setPostalCode(warehouseForm.getPostalCode());
        warehouse.setCity(warehouseForm.getCity());
        warehouse.setStateCode(warehouseForm.getStateCode());
        warehouse.setCountryCode(warehouseForm.getCountryCode());

        warehouse.setLatitude(warehouseForm.getLatitude());
        warehouse.setLongitude(warehouseForm.getLongitude());
       
        Warehouse savedWarehouse = warehouseService.saveOrUpdateWarehouse(warehouse);
        return savedWarehouse;
    }
View Full Code Here

                    } else if (param instanceof AbstractRuleReferential) {
                        AbstractRuleReferential rule = (AbstractRuleReferential) param;
                        getParams.put(RequestConstants.REQUEST_PARAMETER_RULE_CODE, handleParamValue(rule.getCode().toString()));
                        break;
                    } else if (param instanceof Warehouse) {
                        Warehouse warehouse = (Warehouse) param;
                        getParams.put(RequestConstants.REQUEST_PARAMETER_WAREHOUSE_CODE, handleParamValue(warehouse.getCode().toString()));
                        break;
                    } else if (param instanceof DeliveryMethod) {
                        DeliveryMethod deliveryMethod = (DeliveryMethod) param;
                        getParams.put(RequestConstants.REQUEST_PARAMETER_DELIVERY_METHOD_CODE, handleParamValue(deliveryMethod.getCode().toString()));
                        break;
View Full Code Here

      List<ValueBean> warehousesValues = new ArrayList<ValueBean>();
    try {
          List<Warehouse> warehouses = warehouseService.findWarehouses();
          if(warehouses != null){
            for (Iterator<Warehouse> iterator = warehouses.iterator(); iterator.hasNext();) {
                Warehouse warehouseIt = (Warehouse) iterator.next();
                final String warehouseId = warehouseIt.getId().toString();
          warehousesValues.add(new ValueBean(warehouseId, warehouseIt.getName()));
            }
            Collections.sort(warehousesValues, new Comparator<ValueBean>() {
          @Override
          public int compare(ValueBean o1, ValueBean o2) {
            return o1.getValue().compareTo(o2.getValue());
View Full Code Here

        if(StringUtils.isEmpty(warehouseCode)){
            final String urlRedirect = backofficeUrlService.generateUrl(BoUrls.WAREHOUSE_LIST, requestData);
            return new ModelAndView(new RedirectView(urlRedirect));
        }
       
        final Warehouse warehouse = warehouseService.getWarehouseByCode(warehouseCode);

        // SANITY CHECK
        if(warehouse != null){
            modelAndView.addObject(ModelConstants.WAREHOUSE_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanWarehouse(requestData, warehouse));
        } else {
            final String url = requestUtil.getLastRequestUrl(request);
            return new ModelAndView(new RedirectView(url));
        }
       
        model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.WAREHOUSE_LIST, requestData));
       
        final List<DeliveryMethodViewBean> deliveryMethodViewBeans = new ArrayList<DeliveryMethodViewBean>();
        final List<DeliveryMethod> deliveryMethods = deliveryMethodService.findDeliveryMethodsByWarehouseId(warehouse.getId());
        for (Iterator<DeliveryMethod> iterator = deliveryMethods.iterator(); iterator.hasNext();) {
            DeliveryMethod deliveryMethod = (DeliveryMethod) iterator.next();
            deliveryMethodViewBeans.add(backofficeViewBeanFactory.buildViewBeanDeliveryMethod(requestUtil.getRequestData(request), deliveryMethod));
        }
        request.setAttribute(ModelConstants.DELIVERY_METHODS_VIEW_BEAN, deliveryMethodViewBeans);

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

        return modelAndView;
    }
View Full Code Here

        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String warehouseCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_WAREHOUSE_CODE);
        if(StringUtils.isNotEmpty(warehouseCode)){
            // EDIT MODE
            final Warehouse warehouse = warehouseService.getWarehouseByCode(warehouseCode);

            WarehouseViewBean warehouseViewBean = backofficeViewBeanFactory.buildViewBeanWarehouse(requestData, warehouse);
            request.setAttribute(ModelConstants.WAREHOUSE_VIEW_BEAN, warehouseViewBean);

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

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

TOP

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

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.