Search in sources :

Example 6 with BroadleafTemplateElement

use of org.broadleafcommerce.presentation.model.BroadleafTemplateElement in project BroadleafCommerce by BroadleafCommerce.

the class UncacheableDataProcessor method getReplacementModel.

@Override
public BroadleafTemplateModel getReplacementModel(String tagName, Map<String, String> tagAttributes, BroadleafTemplateContext context) {
    StringBuffer sb = new StringBuffer();
    sb.append("<SCRIPT>\n");
    sb.append("  var params = \n  ");
    sb.append(buildContentMap(context)).append(";\n  ");
    sb.append(getUncacheableDataFunction(context, tagAttributes));
    sb.append("</SCRIPT>");
    // Add contentNode to the document
    BroadleafTemplateModel model = context.createModel();
    BroadleafTemplateElement script = context.createTextElement(sb.toString());
    model.addElement(script);
    return model;
}
Also used : BroadleafTemplateElement(org.broadleafcommerce.presentation.model.BroadleafTemplateElement) BroadleafTemplateModel(org.broadleafcommerce.presentation.model.BroadleafTemplateModel)

Aggregations

BroadleafTemplateElement (org.broadleafcommerce.presentation.model.BroadleafTemplateElement)6 BroadleafTemplateModel (org.broadleafcommerce.presentation.model.BroadleafTemplateModel)5 HashMap (java.util.HashMap)3 Map (java.util.Map)2 BroadleafTemplateModelModifierDTO (org.broadleafcommerce.presentation.model.BroadleafTemplateModelModifierDTO)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 ServiceException (org.broadleafcommerce.common.exception.ServiceException)1 PaymentRequestDTO (org.broadleafcommerce.common.payment.dto.PaymentRequestDTO)1 PaymentException (org.broadleafcommerce.common.vendor.service.exception.PaymentException)1 Order (org.broadleafcommerce.core.order.domain.Order)1 BroadleafTemplateNonVoidElement (org.broadleafcommerce.presentation.model.BroadleafTemplateNonVoidElement)1