Search in sources :

Example 1 with PageAttribute

use of org.broadleafcommerce.cms.page.domain.PageAttribute in project BroadleafCommerce by BroadleafCommerce.

the class PageServiceUtility method buildPageDTO.

public PageDTO buildPageDTO(Page page, boolean secure) {
    PageDTO pageDTO = new PageDTO();
    pageDTO.setId(page.getId());
    pageDTO.setDescription(page.getDescription());
    pageDTO.setUrl(page.getFullUrl());
    pageDTO.setPriority(page.getPriority());
    if (page.getPageTemplate() != null) {
        pageDTO.setTemplatePath(page.getPageTemplate().getTemplatePath());
        if (page.getPageTemplate().getLocale() != null) {
            pageDTO.setLocaleCode(page.getPageTemplate().getLocale().getLocaleCode());
        }
    }
    for (String fieldKey : page.getPageFields().keySet()) {
        addPageFieldToDTO(page, secure, pageDTO, fieldKey);
    }
    pageDTO.setRuleExpression(buildRuleExpression(page));
    if (page.getQualifyingItemCriteria() != null && page.getQualifyingItemCriteria().size() > 0) {
        pageDTO.setItemCriteriaDTOList(buildItemCriteriaDTOList(page));
    }
    for (Entry<String, PageAttribute> entry : page.getAdditionalAttributes().entrySet()) {
        pageDTO.getPageAttributes().put(entry.getKey(), entry.getValue().getValue());
    }
    pageDTO.getPageAttributes().put("title", page.getMetaTitle());
    pageDTO.getPageAttributes().put("metaDescription", page.getMetaDescription());
    return pageDTO;
}
Also used : PageDTO(org.broadleafcommerce.common.page.dto.PageDTO) PageAttribute(org.broadleafcommerce.cms.page.domain.PageAttribute)

Aggregations

PageAttribute (org.broadleafcommerce.cms.page.domain.PageAttribute)1 PageDTO (org.broadleafcommerce.common.page.dto.PageDTO)1