/** {@inheritDoc} */
  @Cacheable(value = "contentService-contentBody")
  public String getContentBody(final String contentUri, final long shopId, final String locale) {

    if (StringUtils.isBlank(contentUri)) {
      return null;
    }

    final Shop shop = shopService.getById(shopId);

    if (shop == null) {
      return null;
    }

    final String shopContentUri = shop.getCode().concat("_").concat(contentUri);

    final Long shopSpecificContentId = contentService.findContentIdBySeoUri(shopContentUri);

    if (shopSpecificContentId != null
        && shopService.getShopContentIds(shopId).contains(shopSpecificContentId)) {
      return contentService.getContentBody(shopSpecificContentId, locale);
    }

    final Long contentId = contentService.findContentIdBySeoUri(contentUri);
    if (contentId != null && shopService.getShopContentIds(shopId).contains(contentId)) {
      return contentService.getContentBody(contentId, locale);
    }

    return null;
  }
  /** {@inheritDoc} */
  public String getDynamicContentBody(
      final String contentUri,
      final long shopId,
      final String locale,
      final Map<String, Object> context) {

    if (StringUtils.isBlank(contentUri)) {
      return null;
    }

    final Shop shop = shopService.getById(shopId);

    if (shop == null) {
      return null;
    }

    final String shopContentUri = shop.getCode().concat("_").concat(contentUri);

    final Long shopSpecificContentId = contentService.findContentIdBySeoUri(shopContentUri);

    if (shopSpecificContentId != null
        && shopService.getShopContentIds(shopId).contains(shopSpecificContentId)) {
      return contentService.getDynamicContentBody(shopSpecificContentId, locale, context);
    }

    final Long contentId = contentService.findContentIdBySeoUri(contentUri);
    if (contentId != null && shopService.getShopContentIds(shopId).contains(contentId)) {
      return contentService.getDynamicContentBody(contentId, locale, context);
    }

    return null;
  }
 /** {@inheritDoc} */
 public String getDynamicContentBody(
     final long contentId,
     final long shopId,
     final String locale,
     final Map<String, Object> context) {
   if (contentId > 0L && shopService.getShopContentIds(shopId).contains(contentId)) {
     return contentService.getDynamicContentBody(contentId, locale, context);
   }
   return null;
 }
  /** {@inheritDoc} */
  public List<String> getItemsPerPageOptionsConfig(final long contentId, final long shopId) {

    if (contentId > 0L && shopService.getShopContentIds(shopId).contains(contentId)) {

      final String size =
          contentService.getContentAttributeRecursive(
              null, contentId, AttributeNamesKeys.Category.CATEGORY_ITEMS_PER_PAGE, null);
      if (StringUtils.isNotBlank(size)) {
        return Arrays.asList(StringUtils.split(size, ','));
      }
    }

    return Constants.DEFAULT_ITEMS_ON_PAGE;
  }
  private Pair<String, String> getImageSizeConfig(
      final long categoryId,
      final long shopId,
      final String[] widthAndHeightAttribute,
      final Pair<String, String> defaultWidthAndHeight) {

    if (categoryId > 0L && shopService.getShopContentIds(shopId).contains(categoryId)) {

      final String[] size =
          contentService.getContentAttributeRecursive(null, categoryId, widthAndHeightAttribute);
      if (size != null && size.length == 2) {
        return new Pair<String, String>(size[0], size[1]);
      }
    }

    return defaultWidthAndHeight;
  }
  private int getLimitSizeConfig(
      final long categoryId,
      final long shopId,
      final String limitAttribute,
      final int defaultLimit) {

    if (categoryId > 0L && shopService.getShopContentIds(shopId).contains(categoryId)) {

      final String size =
          contentService.getContentAttributeRecursive(null, categoryId, limitAttribute, null);
      if (size != null) {
        return NumberUtils.toInt(size, defaultLimit);
      }
    }

    return defaultLimit;
  }
  /** {@inheritDoc} */
  @Cacheable(value = "categoryService-currentCategoryMenu")
  public List<Category> getCurrentContentMenu(final long currentContentId, final long shopId) {

    if (currentContentId > 0L && shopService.getShopContentIds(shopId).contains(currentContentId)) {

      final List<Category> categories =
          new ArrayList<Category>(contentService.getChildContent(currentContentId));
      final Iterator<Category> itCat = categories.iterator();
      while (itCat.hasNext()) {
        final Category cat = itCat.next();
        if (CentralViewLabel.INCLUDE.equals(cat.getUitemplate())) {
          itCat.remove();
        }
      }
      return categories;
    }

    return Collections.emptyList();
  }
 /** {@inheritDoc} */
 public String getContentBody(final long contentId, final long shopId, final String locale) {
   if (contentId > 0L && shopService.getShopContentIds(shopId).contains(contentId)) {
     return contentService.getContentBody(contentId, locale);
   }
   return null;
 }
 /** {@inheritDoc} */
 public Category getContent(final long contentId, final long shopId) {
   if (contentId > 0L && shopService.getShopContentIds(shopId).contains(contentId)) {
     return contentService.getById(contentId);
   }
   return null;
 }