Package org.broadleafcommerce.common.web

Examples of org.broadleafcommerce.common.web.BroadleafRequestContext


    public List<StructuredContentDTO> lookupStructuredContentItemsByName(StructuredContentType contentType,
                                                            String contentName, org.broadleafcommerce.common.locale.domain.Locale locale,
                                                            Integer count, Map<String, Object> ruleDTOs, boolean secure) {
        List<StructuredContentDTO> contentDTOList = null;
        Locale languageOnlyLocale = findLanguageOnlyLocale(locale);
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        String cacheKey = buildNameKey(context.getSandBox(), languageOnlyLocale, contentType.getName(), contentName);
        cacheKey = cacheKey+"-"+secure;
        if (context.isProductionSandBox()) {
            contentDTOList = getStructuredContentListFromCache(cacheKey);
        }
        if (contentDTOList == null) {
            List<StructuredContent> productionContentList = structuredContentDao.findActiveStructuredContentByNameAndType(
                    contentType, contentName, locale, languageOnlyLocale);
            contentDTOList = buildStructuredContentDTOList(productionContentList, secure);
            if (context.isProductionSandBox()) {
                addStructuredContentListToCache(cacheKey, contentDTOList);
            }
        }

        return evaluateAndPriortizeContent(contentDTOList, count, ruleDTOs);
View Full Code Here


    public List<StructuredContentDTO> lookupStructuredContentItemsByName(String contentName,
                                                             org.broadleafcommerce.common.locale.domain.Locale locale,
                                                             Integer count, Map<String, Object> ruleDTOs, boolean secure) {
        List<StructuredContentDTO> contentDTOList = null;
        Locale languageOnlyLocale = findLanguageOnlyLocale(locale);
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        String cacheKey = buildNameKey(context.getSandBox(), languageOnlyLocale, "any", contentName);
        cacheKey = cacheKey+"-"+secure;
        if (context.isProductionSandBox()) {
            contentDTOList = getStructuredContentListFromCache(cacheKey);
        }
        if (contentDTOList == null) {
            List<StructuredContent> productionContentList = structuredContentDao.findActiveStructuredContentByName(contentName, locale, languageOnlyLocale);
            contentDTOList = buildStructuredContentDTOList(productionContentList, secure);
            if (context.isProductionSandBox()) {
                addStructuredContentListToCache(cacheKey, contentDTOList);
            }
        }

        return evaluateAndPriortizeContent(contentDTOList, count, ruleDTOs);
View Full Code Here

                    identifier = Long.parseLong(prop.getValue());
                } else {
                    identifier = prop.getValue();
                }
                valueInstance = (Serializable) getPersistenceManager().getDynamicEntityDao().find(valueClass, identifier);
                BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
                if (sandBoxHelper.isSandBoxable(valueInstance.getClass().getName()) &&
                        context != null && !context.isProductionSandBox()) {
                    if (sandBoxHelper.isPromote() && !sandBoxHelper.isReject()) {
                        //if this is a prod record (i.e. the destination map has deleted our record), then duplicate our value
                        //so it's available in this sandbox
                        valueInstance = getPersistenceManager().getDynamicEntityDao().merge(valueInstance);
                    } else {
View Full Code Here

        return property.getName().startsWith("defaultSku");
    }
   
    @Override
    protected Locale getLocale(ExtractValueRequest extractValueRequest, Property property) {
        BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
        return brc.getJavaLocale();
    }
View Full Code Here

            Sku s = (Sku) extractValueRequest.getEntity();
            bc = s.getCurrency();
        }
       
        if (bc == null) {
            BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
            return brc.getJavaCurrency();
        } else {
            return Currency.getInstance(bc.getCurrencyCode());
        }
    }
View Full Code Here

            FieldDTO fieldDTO = new FieldDTO();
            fieldDTO.setLabel(field.getFieldLabel());
           
            //translate the label to display
            String label = field.getFieldLabel();
            BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
            MessageSource messages = context.getMessageSource();
            label = messages.getMessage(label, null, label, context.getJavaLocale());
            fieldDTO.setLabel(label);
           
            fieldDTO.setName(field.getFieldName());
            fieldDTO.setOperators(field.getOperators());
            fieldDTO.setOptions(field.getOptions());
View Full Code Here

            setFields(new ArrayList<FieldData>());
           
            // This cannot be null during startup as we do not want to remove the null safety checks in a multi-tenant env.
            boolean contextWasNull = false;
            if (BroadleafRequestContext.getBroadleafRequestContext() == null) {
                BroadleafRequestContext brc = new BroadleafRequestContext();
                brc.setIgnoreSite(true);
                BroadleafRequestContext.setBroadleafRequestContext(brc);
                contextWasNull = true;
            }

            try {
View Full Code Here

        if (adminUser == null) {
            //clear any sandbox
            session.removeAttribute(SANDBOX_ADMIN_ID_VAR);
            SandBoxContext.setSandBoxContext(null);
        } else {
            BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
            if (brc != null) {
                brc.getAdditionalProperties().put("adminUser", adminUser);
            }

            Long overrideSandBoxId = adminUser.getOverrideSandBox() == null ? null : adminUser.getOverrideSandBox().getId();
            SandBox sandBox = sandBoxService.retrieveUserSandBox(adminUser.getId(), overrideSandBoxId, adminUser.getLogin());
            session.setAttribute(SANDBOX_ADMIN_ID_VAR, sandBox.getId());
View Full Code Here

        }

        Site site = determineSite(request);
        SandBox currentSandbox = determineSandbox(request, site);

        BroadleafRequestContext brc = new BroadleafRequestContext();
        brc.setLocale(determineLocale(request, site));
        brc.setSandBox(currentSandbox);
        brc.setRequest(request);
        brc.setResponse(response);
        BroadleafRequestContext.setBroadleafRequestContext(brc);

        try {
            URLProcessor urlProcessor = null;
View Full Code Here

     *
     * @return true if this URLProcessor is able to process the passed in request
     */
    @Override
    public boolean canProcessURL(String key) {
        BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
        PageDTO p = pageService.findPageByURI(context.getLocale(), key, buildMvelParameters(context.getRequest()), context.isSecure());
        context.getRequest().setAttribute(PAGE_ATTRIBUTE_NAME, p);
        return (p != null);
    }
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.common.web.BroadleafRequestContext

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.