Package org.hoteia.qalingo.core.web.mvc.viewbean

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.SearchFacetViewBean


    /**
     *
     */
    public SearchFacetViewBean buildViewBeanCatalogSearchFacet(final RequestData requestData, final FacetField facetField) throws Exception {
        final SearchFacetViewBean searchFacetViewBean = new SearchFacetViewBean();
        final Localization localization = requestData.getMarketAreaLocalization();
        final String localeCode = localization.getCode();
       
        if(ProductMarketingResponseBean.PRODUCT_MARKETING_DEFAULT_FACET_FIELD.equalsIgnoreCase(facetField.getName())){
          searchFacetViewBean.setName(facetField.getName());
            List<ValueBean> values = new ArrayList<ValueBean>();
            for (Iterator<Count> iterator = facetField.getValues().iterator(); iterator.hasNext();) {
                Count count = (Count) iterator.next();
                final CatalogCategoryMaster catalogCategoryMaster = catalogCategoryService.getMasterCatalogCategoryByCode(count.getName(), requestData.getMasterCatalogCode());
                ValueBean valueBean = new ValueBean(catalogCategoryMaster.getCode(), catalogCategoryMaster.getI18nName(localeCode) + "(" + count.getCount() + ")");               
                values.add(valueBean);
            }
            searchFacetViewBean.setValues(values);
        }
       
        return searchFacetViewBean;
    }
View Full Code Here


    /**
     *
     */
    public SearchFacetViewBean buildViewBeanStoreSearchFacet(final RequestData requestData, final FacetField facetField) throws Exception {
        final SearchFacetViewBean searchFacetViewBean = new SearchFacetViewBean();

        // TODO : Denis : facet like country ? city ? online/corner etc
        if(StoreResponseBean.STORE_DEFAULT_FACET_FIELD.equalsIgnoreCase(facetField.getName())){
          searchFacetViewBean.setName(facetField.getName());
            List<ValueBean> values = new ArrayList<ValueBean>();
            for (Iterator<Count> iterator = facetField.getValues().iterator(); iterator.hasNext();) {
                Count count = (Count) iterator.next();
                ValueBean valueBean = new ValueBean();
                valueBean.setValue(count.getName()+ "(" + count.getCount() + ")");
                valueBean.setKey(count.getName());
                values.add(valueBean);
            }
            Collections.sort(values, new Comparator<ValueBean>() {

        @Override
        public int compare(ValueBean o1, ValueBean o2) {
          return o1.getValue().compareTo(o2.getValue());
        }
             
      });
           
            searchFacetViewBean.setValues(values);
        }
       
        if(StoreResponseBean.STORE_SECOND_FACET_FIELD.equalsIgnoreCase(facetField.getName())){
          searchFacetViewBean.setName(facetField.getName());
            List<ValueBean> values = new ArrayList<ValueBean>();
            for (Iterator<Count> iterator = facetField.getValues().iterator(); iterator.hasNext();) {
                Count count = (Count) iterator.next();
                ValueBean valueBean = new ValueBean();
                valueBean.setValue(count.getName()+ "(" + count.getCount() + ")");
                valueBean.setKey(count.getName());
                values.add(valueBean);
            }
            Collections.sort(values, new Comparator<ValueBean>() {

        @Override
        public int compare(ValueBean o1, ValueBean o2) {
          return o1.getValue().compareTo(o2.getValue());
        }
             
      });
           
            searchFacetViewBean.setValues(values);
        }
        return searchFacetViewBean;
    }
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.web.mvc.viewbean.SearchFacetViewBean

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.