}
return dtoList;
}
protected PageDTO buildPageDTOInternal(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());
}
}
String cmsPrefix = staticAssetPathService.getStaticAssetUrlPrefix();
for (String fieldKey : page.getPageFields().keySet()) {
PageField pf = page.getPageFields().get(fieldKey);
String originalValue = pf.getValue();
if (StringUtils.isNotBlank(originalValue) && StringUtils.isNotBlank(cmsPrefix) && originalValue.contains(cmsPrefix)) {
//This may either be an ASSET_LOOKUP image path or an HTML block (with multiple <img>) or a plain STRING that contains the cmsPrefix.
//If there is an environment prefix configured (e.g. a CDN), then we must replace the cmsPrefix with this one.
String fldValue = staticAssetPathService.convertAllAssetPathsInContent(originalValue, secure);
pageDTO.getPageFields().put(fieldKey, fldValue);
} else {
pageDTO.getPageFields().put(fieldKey, originalValue);
}
}
pageDTO.setRuleExpression(buildRuleExpression(page));
if (page.getQualifyingItemCriteria() != null && page.getQualifyingItemCriteria().size() > 0) {
pageDTO.setItemCriteriaDTOList(buildItemCriteriaDTOList(page));
}
return pageDTO;
}