Package org.hoteia.qalingo.core.domain

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


  @RequestMapping(value = BoUrls.ASSET_DETAILS_URL, method = RequestMethod.GET)
  public ModelAndView assetDetails(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.ASSET_DETAILS.getVelocityPage());

    final String currentAssetId = request.getParameter(RequestConstants.REQUEST_PARAMETER_ASSET_ID);
    final Asset asset = productMarketingService.getProductMarketingAssetById(currentAssetId);
   
    if(asset != null){
      initRuleDetailsPage(request, response, modelAndView, asset);
    } else {
      final String url = requestUtil.getLastRequestUrl(request);
View Full Code Here


  public ModelAndView display(final HttpServletRequest request, final HttpServletResponse response, ModelMap modelMap) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.ASSET_EDIT.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);
    final String currentAssetId = request.getParameter(RequestConstants.REQUEST_PARAMETER_ASSET_ID);
    if(StringUtils.isNotEmpty(currentAssetId)){
      final Asset asset = productMarketingService.getProductMarketingAssetById(currentAssetId);

      modelAndView.addObject(ModelConstants.ASSET_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanAsset(requestUtil.getRequestData(request), asset));
      modelAndView.addObject(ModelConstants.ASSET_FORM, backofficeFormFactory.buildProductMarketingAssetForm(requestData, asset));
      return modelAndView;
    } else {
View Full Code Here

    if (result.hasErrors()) {
      return display(request, response, modelMap);
    }
   
    final String currentAssetId = assetForm.getId();
    final Asset asset = productMarketingService.getProductMarketingAssetById(currentAssetId);
   
    MultipartFile multipartFile = assetForm.getFile();
    if(multipartFile != null){
      long size = multipartFile.getSize();
      asset.setFileSize(size);
    }
   
    try {
      if (multipartFile.getSize() > 0) {
        String pathProductMarketingImage = multipartFile.getOriginalFilename();
        String assetFileRootPath = engineSettingService.getSettingAssetFileRootPath().getDefaultValue();
        assetFileRootPath.replaceAll("\\\\", "/");
        if(assetFileRootPath.endsWith("/")){
          assetFileRootPath = assetFileRootPath.substring(0, assetFileRootPath.length() - 1);
        }
        String assetProductMarketingFilePath = engineSettingService.getSettingAssetProductMarketingFilePath().getDefaultValue();
        assetProductMarketingFilePath.replaceAll("\\\\", "/");
        if(assetProductMarketingFilePath.endsWith("/")){
          assetProductMarketingFilePath = assetProductMarketingFilePath.substring(0, assetProductMarketingFilePath.length() - 1);
        }
        if(!assetProductMarketingFilePath.startsWith("/")){
          assetProductMarketingFilePath = "/" + assetProductMarketingFilePath;
        }
       
        String absoluteFilePath = assetFileRootPath + assetProductMarketingFilePath + "/" + asset.getType().toLowerCase() + "/"  + pathProductMarketingImage;
       
        InputStream inputStream = multipartFile.getInputStream();
        URI url = new URI(absoluteFilePath);
        File fileAsset;
        try {
          fileAsset = new File(url);
        } catch(IllegalArgumentException e) {
          fileAsset = new File(url.getPath());
        }
        OutputStream outputStream = new FileOutputStream(fileAsset);
        int readBytes = 0;
        byte[] buffer = new byte[8192];
        while ((readBytes = inputStream.read(buffer, 0, 8192)) != -1) {
          outputStream.write(buffer, 0, readBytes);
        }
        outputStream.close();
        inputStream.close();
        asset.setPath(pathProductMarketingImage);
      }
     
      // UPDATE ASSET
      webBackofficeService.createOrUpdateProductMarketingAsset(asset, assetForm);
View Full Code Here

                    final MarketArea marketArea = requestData.getMarketArea();
                    final Retailer retailer = requestData.getMarketAreaRetailer();
                    final Localization localization = requestData.getMarketAreaLocalization();
                    final String localizationCode = localization.getCode();
                   
                    final Asset defaultPackshotImage = cartItem.getProductSku().getDefaultPackshotImage(ImageSize.SMALL.name());
                    if (defaultPackshotImage != null) {
                        String summaryImage = engineSettingService.getProductMarketingImageWebPath(defaultPackshotImage);
                        cartItemPojo.setSummaryImage(summaryImage);
                    } else {
                        cartItemPojo.setSummaryImage("");
                    }
                   
                    cartItemPojo.setI18nName(cartItem.getProductSku().getI18nName(localizationCode));
                   
                    cartItemPojo.setProductDetailsUrl(urlService.generateUrl(FoUrls.PRODUCT_DETAILS, requestData, cartItem.getCatalogCategory(), cartItem.getProductMarketing(), cartItem.getProductSku()));

                    cartItemPojo.setPriceWithStandardCurrencySign(cartItem.getPriceWithStandardCurrencySign(marketArea.getId(), retailer.getId()));
                    cartItemPojo.setTotalAmountWithStandardCurrencySign(cartItem.getTotalAmountWithStandardCurrencySign(marketArea.getId(), retailer.getId()));

                } catch (Exception e) {
                    logger.error("postWritingDestinationValue error with FoCartItemPojo", e);
                }
            }
        } else if(event.getDestinationObject() instanceof ProductSkuPojo){
            if(event.getFieldMap().getDestFieldName().equals("code")){
                // INJECT BACKOFFICE URLS
                ProductSku productSku = (ProductSku) event.getSourceObject();
                ProductSkuPojo productSkuPojo = (ProductSkuPojo) event.getDestinationObject();
                try {
                    final RequestData requestData = requestUtil.getRequestData(httpServletRequest);
                    final MarketArea marketArea = requestData.getMarketArea();
                    final Retailer retailer = requestData.getMarketAreaRetailer();
                    final Localization localization = requestData.getMarketAreaLocalization();
                    final String localizationCode = localization.getCode();
                   
                    final Asset defaultPackshotImage = productSku.getDefaultPackshotImage(ImageSize.SMALL.name());
                    if (defaultPackshotImage != null) {
                        String summaryImage = engineSettingService.getProductMarketingImageWebPath(defaultPackshotImage);
                        productSkuPojo.setDefaultPackshotImage(summaryImage);
                    } else {
                        productSkuPojo.setDefaultPackshotImage("");
View Full Code Here

        Map<String, String> getParams = new HashMap<String, String>();
        getParams.put(RequestConstants.REQUEST_PARAMETER_PRODUCT_SKU_CODE, productSku.getCode());

        searchItemViewBean.setAddToCartUrl(urlService.generateUrl(FoUrls.CART_ADD_ITEM, requestData, getParams));
       
        final Asset defaultBackgroundImage = productMarketing.getDefaultBackgroundImage();
        if (defaultBackgroundImage != null) {
            final String backgroundImage = engineSettingService.getProductMarketingImageWebPath(defaultBackgroundImage);
            searchItemViewBean.setBackgroundImage(backgroundImage);
        } else {
          searchItemViewBean.setBackgroundImage("");
        }
       
        final Asset defaultPackshotImage = productMarketing.getDefaultPackshotImage(ImageSize.SMALL.name());
        if (defaultPackshotImage != null) {
            final String carouselImage = engineSettingService.getProductMarketingImageWebPath(defaultPackshotImage);
            searchItemViewBean.setCarouselImage(carouselImage);
        } else {
          searchItemViewBean.setCarouselImage("");
        }
       
        final Asset defaultIconImage = productMarketing.getDefaultThumbnailImage();
        if (defaultIconImage != null) {
            final String iconImage = engineSettingService.getProductMarketingImageWebPath(defaultIconImage);
            searchItemViewBean.setIconImage(iconImage);
        } else {
          searchItemViewBean.setIconImage("");
View Full Code Here

        searchItemViewBean.setName(storeSolr.getName());
        searchItemViewBean.setCode(storeCode);

        searchItemViewBean.setDetailsUrl(urlService.generateUrl(FoUrls.STORE_DETAILS, requestData, store));

        final Asset defaultBackgroundImage = store.getDefaultBackgroundImage();
        if (defaultBackgroundImage != null) {
            final String backgroundImage = engineSettingService.getRetailerOrStoreImageWebPath(defaultBackgroundImage);
            searchItemViewBean.setBackgroundImage(backgroundImage);
        } else {
            searchItemViewBean.setBackgroundImage("");
        }
       
        final Asset defaultIconImage = store.getDefaultThumbnailImage();
        if (defaultIconImage != null) {
            final String iconImage = engineSettingService.getRetailerOrStoreImageWebPath(defaultIconImage);
            searchItemViewBean.setIconImage(iconImage);
        } else {
            searchItemViewBean.setIconImage("");
        }
       
        final Asset carouselImage = store.getDefaultPackshotImage(ImageSize.SMALL.name());
        if (carouselImage != null) {
            final String iconImage = engineSettingService.getRetailerOrStoreImageWebPath(carouselImage);
            searchItemViewBean.setCarouselImage(iconImage);
        } else {
            searchItemViewBean.setIconImage("");
View Full Code Here

                    } else if (param instanceof ProductSku) {
                        ProductSku productSku = (ProductSku) param;
                        getParams.put(RequestConstants.REQUEST_PARAMETER_PRODUCT_SKU_CODE, handleParamValue(productSku.getCode().toString()));
                        break;
                    } else if (param instanceof Asset) {
                        Asset asset = (Asset) param;
                        getParams.put(RequestConstants.REQUEST_PARAMETER_ASSET_ID, handleParamValue(asset.getId().toString()));
                        break;
                    } else if (param instanceof AbstractRuleReferential) {
                        AbstractRuleReferential rule = (AbstractRuleReferential) param;
                        getParams.put(RequestConstants.REQUEST_PARAMETER_RULE_CODE, handleParamValue(rule.getCode().toString()));
                        break;
View Full Code Here

TOP

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

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.