Class CategorySearchData

java.lang.Object
de.cxp.ocs.preprocessor.util.CategorySearchData

public class CategorySearchData extends Object
Takes a list of / separated category paths and splits them into separate levels. Also saves all leaf paths.
  • Field Details

  • Constructor Details

    • CategorySearchData

      public CategorySearchData()
      Creates a new instance and splits the category paths into levels and leafs.
  • Method Details

    • add

      public void add(Collection<String[]> categoryPaths)
    • getCategoryLvlDepth

      public int getCategoryLvlDepth()
      Returns the number of the deepest category level from the path list.
      Returns:
      the category depth.
    • getCategory

      public Collection<String> getCategory(int lvl)
      Returns a category by level.
      Parameters:
      lvl - the level of the category to return.
      Returns:
      the category.
      Throws:
      IndexOutOfBoundsException - if the level is lower than 0 or greater than getCategoryLvlDepth()
    • getCategoryLeaf

      public Collection<String> getCategoryLeaf()
      Returns the leaf entries of each path.
      Returns:
      the leaf entries.
    • toSourceItem

      public void toSourceItem(Map<String,Object> sourceData, String categoryFieldName)
      Copies the data of this instance into the sourceData map. The name of the category field is used as prefix, followed by either
      1. _lvl_x
      2. _leaf
      for each level and once for all leafs.
      Parameters:
      sourceData - the source item where the data will be stored.
      categoryFieldName - the category field which is used to obtain the name of the stored fields.