Package org.hoteia.qalingo.core.pojo.cart

Examples of org.hoteia.qalingo.core.pojo.cart.FoAddToWishlistPojo


        final Localization localization = requestData.getMarketAreaLocalization();
        final Locale locale = requestData.getLocale();
        final String catalogCategoryCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_CATALOG_CATEGORY_CODE);
        final String productSkuCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_PRODUCT_SKU_CODE);
       
        final FoAddToWishlistPojo addToWishlist = new FoAddToWishlistPojo();

        // INJECT PRODUCT SKU
        final ProductSku productSku = productService.getProductSkuByCode(productSkuCode);
        addToWishlist.setProductSku(catalogPojoService.buildProductSku(productSku));

        addToWishlist.setWishListDetailsUrl(urlService.generateUrl(FoUrls.PERSONAL_WISHLIST, requestData));
        try {
            webManagementService.addProductSkuToWishlist(requestData, catalogCategoryCode, productSkuCode);
           
            FoMessagePojo successMessage = new FoMessagePojo();
            successMessage.setId("success-add-to-wishlist-product-sku");
            Object[] messageParams = { productSku.getI18nName(localization.getCode()) };
            successMessage.setMessage(getSpecificMessage(ScopeWebMessage.WISHLIST, "add_to_wishlist_success_message", messageParams, locale));
            addToWishlist.getSuccessMessages().add(successMessage);
            return addToWishlist;
           
        } catch (ProductAlreadyExistInWishlistException e) {
            logger.error("", e);
            FoMessagePojo errorMessage = new FoMessagePojo();
            Object[] messageParams = { productSku.getI18nName(localization.getCode()) };
            errorMessage.setMessage(getSpecificMessage(ScopeWebMessage.ERROR, ProductAlreadyExistInWishlistException.MESSAGE_KEY, messageParams, locale));
            addToWishlist.getErrorMessages().add(errorMessage);
            addToWishlist.setStatuts(false);
            return addToWishlist;
           
        } catch (Exception e) {
            logger.error("", e);
            FoMessagePojo errorMessage = new FoMessagePojo();
            errorMessage.setId("error-add-to-wishlist-product-sku");
            Object[] messageParams = { productSku.getI18nName(localization.getCode()) };
            errorMessage.setMessage(getSpecificMessage(ScopeWebMessage.WISHLIST, "add_to_wishlist_error_message", messageParams, locale));
            addToWishlist.getErrorMessages().add(errorMessage);
            addToWishlist.setStatuts(false);
            return addToWishlist;
        }
    }
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.pojo.cart.FoAddToWishlistPojo

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.