use of com.salesmanager.shop.model.content.ContentImage in project shopizer by shopizer-ecommerce.
the class ContentFacadeImpl method getContentFolder.
@Override
public ContentFolder getContentFolder(String folder, MerchantStore store) throws Exception {
try {
List<String> imageNames = Optional.ofNullable(contentService.getContentFilesNames(store.getCode(), FileContentType.IMAGE)).orElseThrow(() -> new ResourceNotFoundException("No Folder found for path : " + folder));
// images from CMS
List<ContentImage> contentImages = imageNames.stream().map(name -> convertToContentImage(name, store)).collect(Collectors.toList());
ContentFolder contentFolder = new ContentFolder();
if (!StringUtils.isBlank(folder)) {
contentFolder.setPath(URLEncoder.encode(folder, "UTF-8"));
}
contentFolder.getContent().addAll(contentImages);
return contentFolder;
} catch (ServiceException e) {
throw new ServiceRuntimeException("Error while getting folder " + e.getMessage(), e);
}
}
use of com.salesmanager.shop.model.content.ContentImage in project shopizer by shopizer-ecommerce.
the class ContentFacadeImpl method convertToContentImage.
private ContentImage convertToContentImage(String name, MerchantStore store) {
String path = absolutePath(store, null);
ContentImage contentImage = new ContentImage();
contentImage.setName(name);
contentImage.setPath(path);
return contentImage;
}
Aggregations