use of org.broadleafcommerce.cms.structure.domain.StructuredContentItemCriteria in project BroadleafCommerce by BroadleafCommerce.
the class StructuredContentServiceImpl method buildStructuredContentDTO.
/**
* Converts a StructuredContent into a StructuredContentDTO. If the item contains fields with
* broadleaf cms urls, the urls are converted to utilize the domain.
* <p/>
* The StructuredContentDTO is built via the {@link EntityConfiguration}. To override the actual type that is returned,
* include an override in an applicationContext like any other entity override.
*
* @param sc
* @param secure
* @return
*/
@Override
public StructuredContentDTO buildStructuredContentDTO(StructuredContent sc, boolean secure) {
StructuredContentDTO scDTO = entityConfiguration.createEntityInstance(StructuredContentDTO.class.getName(), StructuredContentDTO.class);
Set<StructuredContentItemCriteria> qualifyingItemCriteria = SetUtils.emptyIfNull(sc.getQualifyingItemCriteria());
scDTO.setContentName(sc.getContentName());
scDTO.setContentType(sc.getStructuredContentType().getName());
scDTO.setId(sc.getId());
scDTO.setPriority(sc.getPriority());
if (sc.getLocale() != null) {
scDTO.setLocaleCode(sc.getLocale().getLocaleCode());
}
scDTO.setRuleExpression(buildRuleExpression(sc));
buildFieldValues(sc, scDTO, secure);
if (qualifyingItemCriteria.size() > 0) {
scDTO.setItemCriteriaDTOList(buildItemCriteriaDTOList(sc));
}
return scDTO;
}
use of org.broadleafcommerce.cms.structure.domain.StructuredContentItemCriteria in project BroadleafCommerce by BroadleafCommerce.
the class StructuredContentServiceImpl method buildItemCriteriaDTOList.
protected List<ItemCriteriaDTO> buildItemCriteriaDTOList(StructuredContent sc) {
List<ItemCriteriaDTO> itemCriteriaDTOList = new ArrayList<>();
Set<StructuredContentItemCriteria> qualifyingItemCriteria = SetUtils.emptyIfNull(sc.getQualifyingItemCriteria());
for (StructuredContentItemCriteria criteria : qualifyingItemCriteria) {
ItemCriteriaDTO criteriaDTO = entityConfiguration.createEntityInstance(ItemCriteriaDTO.class.getName(), ItemCriteriaDTO.class);
criteriaDTO.setMatchRule(criteria.getMatchRule());
criteriaDTO.setQty(criteria.getQuantity());
itemCriteriaDTOList.add(criteriaDTO);
}
return itemCriteriaDTOList;
}
Aggregations