Ejemplo n.º 1
0
  /** {@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;
  }
Ejemplo n.º 2
0
  /** {@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;
  }