Interface CategoryService

  • All Known Implementing Classes:
    DefaultCategoryService

    public interface CategoryService
    Provides methods for working with CategoryModel. Please be aware that since CategoryModel is catalog version aware, all methods of this service will work according to the active session catalog versions (see CatalogVersionService.setSessionCatalogVersions(Collection) for more details). So in consequence, the methods may return different results for different session users. If required, the following example shows how to temporarily switch these active catalog versions without changing the enclosing callers session context:
     SessionService sessionService = ...;
     CatalogVersionService catalogVersionService = ...;
     CatalogVersionModel myCatalogVersion = ...;
    
     Collection<CategoryModel> rootCategories = (Collection<CategoryModel>) sessionService
                    .executeInLocalView(new SessionExecutionBody()
            {
                            public Object execute()
                {
                                    catalogVersionService.setSessionCatalogVersions(Collections.singleton(myCatalogVersion));
    
                                    return categoryService.getRootCategoriesForCatalogVersion(myCatalogVersion);
                }
            });
     
    See Also:
    CatalogVersionService
    Spring Bean ID:
    categoryService