use of com.salesmanager.shop.model.content.page.ReadableContentPage in project shopizer by shopizer-ecommerce.
the class ContentFacadeImpl method getContentPages.
@SuppressWarnings("unchecked")
@Override
public ReadableEntityList<ReadableContentPage> getContentPages(MerchantStore store, Language language, int page, int count) {
Validate.notNull(store, "MerchantStore cannot be null");
@SuppressWarnings("rawtypes") ReadableEntityList items = new ReadableEntityList();
Page<Content> contentPages;
try {
contentPages = contentService.listByType(ContentType.PAGE, store, page, count);
items.setTotalPages(contentPages.getTotalPages());
items.setNumber(contentPages.getContent().size());
items.setRecordsTotal(contentPages.getNumberOfElements());
List<ReadableContentBox> boxes = contentPages.getContent().stream().map(content -> convertContentToReadableContentBox(store, language, content)).collect(Collectors.toList());
items.setItems(boxes);
return items;
} catch (ServiceException e) {
throw new ServiceRuntimeException("Exception while getting content ", e);
}
}
use of com.salesmanager.shop.model.content.page.ReadableContentPage in project shopizer by shopizer-ecommerce.
the class ContentFacadeImpl method contentDescriptionToReadableContent.
private ReadableContentPage contentDescriptionToReadableContent(MerchantStore store, Content content, ContentDescription contentDescription) {
ReadableContentPage page = new ReadableContentPage();
ContentDescription desc = new ContentDescription();
desc.setName(contentDescription.getName());
desc.setDescription(contentDescription.getDescription());
page.setId(content.getId());
desc.setSeUrl(contentDescription.getSeUrl());
page.setLinkToMenu(content.isLinkToMenu());
desc.setTitle(contentDescription.getTitle());
desc.setMetatagDescription(contentDescription.getMetatagDescription());
page.setContentType(ContentType.PAGE.name());
page.setCode(content.getCode());
page.setPath(fileUtils.buildStaticFilePath(store.getCode(), contentDescription.getSeUrl()));
return page;
}
use of com.salesmanager.shop.model.content.page.ReadableContentPage in project shopizer by shopizer-ecommerce.
the class ContentFacadeImpl method convertContentToReadableContentPage.
private ReadableContentPage convertContentToReadableContentPage(MerchantStore store, Language language, Content content) {
if (language != null) {
ReadableContentPage page = new ReadableContentPage();
Optional<ContentDescription> contentDescription = findAppropriateContentDescription(content.getDescriptions(), language);
if (contentDescription.isPresent()) {
com.salesmanager.shop.model.content.common.ContentDescription desc = this.contentDescription(contentDescription.get());
page.setDescription(desc);
}
page.setCode(content.getCode());
page.setId(content.getId());
page.setVisible(content.isVisible());
return page;
} else {
ReadableContentPageFull page = new ReadableContentPageFull();
List<com.salesmanager.shop.model.content.common.ContentDescription> descriptions = content.getDescriptions().stream().map(d -> this.contentDescription(d)).collect(Collectors.toList());
page.setDescriptions(descriptions);
page.setCode(content.getCode());
page.setId(content.getId());
page.setVisible(content.isVisible());
return page;
}
}
Aggregations