Examples of BroadleafRequestContext


Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

     *
     * @param code
     * @return the message
     */
    public static String getMessage(String code, Object... args) {
        BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
        return getMessageSource().getMessage(code, args, brc.getJavaLocale());
    }
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

               
                processedLocaleCodes.add(localeCode);
               
                TranslationConsiderationContext.setTranslationConsiderationContext(getTranslationEnabled());
                TranslationConsiderationContext.setTranslationService(translationService);
                BroadleafRequestContext tempContext = BroadleafRequestContext.getBroadleafRequestContext();
                if (tempContext == null) {
                    tempContext = new BroadleafRequestContext();
                }
                tempContext.setLocale(locale);
                BroadleafRequestContext.setBroadleafRequestContext(tempContext);

                final Object propertyValue;
                if (propertyName.contains(ATTR_MAP)) {
                    propertyValue = PropertyUtils.getMappedProperty(product, ATTR_MAP, propertyName.substring(ATTR_MAP.length() + 1));
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

public class OfferTimeZoneProcessorImpl implements OfferTimeZoneProcessor {

    private static final Log LOG = LogFactory.getLog(OfferTimeZoneProcessorImpl.class);

    public TimeZone getTimeZone(Offer offer) {
        BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
        return (brc != null) ? brc.getTimeZone() : TimeZone.getDefault();
    }
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

        return searchService;
    }

    @Override
    public String getExpectedTemplateName(HttpServletRequest request) {
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        if (context != null) {
            Category category = (Category) context.getRequest().getAttribute(CATEGORY_ATTRIBUTE_NAME);
            if (category != null && category.getDisplayTemplate() != null) {
                return category.getDisplayTemplate();
            }
        }
        return getDefaultCategoryView();
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

    @Value("${request.uri.encoding}")
    public String charEncoding;

    @Override
    protected Object getHandlerInternal(HttpServletRequest request) throws Exception {
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        if (context != null && context.getRequestURIWithoutContext() != null) {
            String requestUri = URLDecoder.decode(context.getRequestURIWithoutContext(), charEncoding);
            Product product = catalogService.findProductByURI(requestUri);
            if (product != null) {
                context.getRequest().setAttribute(CURRENT_PRODUCT_ATTRIBUTE_NAME, product);
                return controllerName;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

    public String charEncoding;

    @Override
    protected Object getHandlerInternal(HttpServletRequest request)
            throws Exception {     
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        if (context != null && context.getRequestURIWithoutContext() != null) {
            String requestUri = URLDecoder.decode(context.getRequestURIWithoutContext(), charEncoding);
            Category category = catalogService.findCategoryByURI(requestUri);

            if (category != null) {
                context.getRequest().setAttribute(CURRENT_CATEGORY_ATTRIBUTE_NAME, category);
                return controllerName;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

     * @param resultHolder
     * @return
     */
    public ExtensionResultStatusType updateAndValidateCart(Order cart, ExtensionResultHolder resultHolder) {
        if (BroadleafRequestContext.hasLocale()) {
            BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
            if (!brc.getLocale().getLocaleCode().matches(cart.getLocale().getLocaleCode())) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("The cart Locale [" + cart.getLocale().getLocaleCode() +
                            "] does not match the current locale [" + brc.getLocale().getLocaleCode() + "]");
                }

                if (getClearCartOnLocaleSwitch()) {
                    resultHolder.getContextMap().put("clearCart", Boolean.TRUE);
                } else {
                    fixTranslations(cart);
                    cart.setLocale(brc.getLocale());
                    resultHolder.getContextMap().put("saveCart", Boolean.TRUE);
                }
            }
        }
        return ExtensionResultStatusType.HANDLED_CONTINUE;
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

        this.defaultProductView = defaultProductView;
    }
   
    @Override
    public String getExpectedTemplateName(HttpServletRequest request) {
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        if (context != null) {
            Product product = (Product) context.getRequest().getAttribute(ProductHandlerMapping.CURRENT_PRODUCT_ATTRIBUTE_NAME);
            if (product != null && product.getDisplayTemplate() != null) {
                return product.getDisplayTemplate();
            }
        }
        return getDefaultProductView();
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

    protected <T> void addDeepLink(ModelAndView model, DeepLinkService<T> service, T item) {
        if (service == null) {
            return;
        }

        BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
        if (brc.getSandBox() != null) {
            List<DeepLink> links = service.getLinks(item);
            if (links.size() == 1) {
                model.addObject("adminDeepLink", links.get(0));
            } else {
                model.addObject("adminDeepLink", links);
View Full Code Here

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext

        this.displayOrder = displayOrder;
    }

    @Override
    public List<ProductOptionXref> getProductXrefs() {
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        if (context != null && context.getAdditionalProperties().containsKey("blProductOptionEntityExtensionManager")) {
            ProductOptionEntityExtensionManager extensionManager = (ProductOptionEntityExtensionManager) context.getAdditionalProperties().get("blProductOptionEntityExtensionManager");
            ExtensionResultHolder holder = new ExtensionResultHolder();
            ExtensionResultStatusType result = extensionManager.getProxy().getProductXrefs(this, holder);
            if (ExtensionResultStatusType.HANDLED.equals(result)) {
                return (List<ProductOptionXref>) holder.getResult();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.