private boolean isCategoryVisibleInShop(final Long categoryId){
  final Set<Long> catIds=shopService.getShopCategoriesIds(ShopCodeContext.getShopId());
  Category category=categoryService.getById(categoryId);
  final Date now=new Date();
  while (category != null && DomainApiUtils.isObjectAvailableNow(true,category.getAvailablefrom(),category.getAvailableto(),now) && category.getCategoryId() != category.getParentId()) {
    if (catIds.contains(categoryId)) {
      return true;
    }
    category=categoryService.getById(category.getParentId());
  }
  return false;
}

private boolean isCategoryVisibleInShop ( final Long categoryId ) { final Set < Long > catIds = shopService . getShopCategoriesIds ( ShopCodeContext . getShopId ( ) ) ; Category category = categoryService . getById ( categoryId ) ; final Date now = new Date ( ) ; while ( category != null && DomainApiUtils . isObjectAvailableNow ( true , category . getAvailablefrom ( ) , category . getAvailableto ( ) , now ) && category . getCategoryId ( ) != category . getParentId ( ) ) { if ( catIds . contains ( categoryId ) ) { return true ; } category = categoryService . getById ( category . getParentId ( ) ) ; } return false ; }
check if given category is visible in current shop . criteria to satisfy : 1 . category or its parent must belong to a shopcategory for given shop 2 . all categories in hierarchy leading to shopcategory must satisfy availablefrom / availableto time frame
