Class SuggesterGroupDescriptor

java.lang.Object
org.nuxeo.ecm.platform.suggestbox.service.descriptors.SuggesterGroupDescriptor
All Implemented Interfaces:
Descriptor

public class SuggesterGroupDescriptor extends Object implements Descriptor
  • Field Details

  • Constructor Details

    • SuggesterGroupDescriptor

      public SuggesterGroupDescriptor()
  • Method Details

    • getId

      public String getId()
      Description copied from interface: Descriptor
      The descriptor id, descriptors with same id are merged.

      To forbid multiple descriptors use UNIQUE_DESCRIPTOR_ID.

      To forbid merge use a unique value, non-overriden toString() for exemple.

      Specified by:
      getId in interface Descriptor
    • getName

      public String getName()
    • getSuggesters

      public List<SuggesterGroupItemDescriptor> getSuggesters()
    • merge

      public Descriptor merge(Descriptor o)
      Description copied from interface: Descriptor
      Returns a descriptor representing other merged into this

      Default implementation returns other.

      Specified by:
      merge in interface Descriptor
      Returns:
      the merged descriptor
    • remove

      protected static boolean remove(SuggesterGroupDescriptor merged, String suggesterName)
      Removes the suggester named suggesterName from the #suggesters list.
      Parameters:
      merged - the descriptor to merged into
      suggesterName - the suggester name
      Returns:
      true, if a suggester was removed
    • indexOf

      protected static int indexOf(SuggesterGroupDescriptor merged, String suggesterName)
      Returns the index of the first occurrence of the element named suggesterName in the #suggesters list, or -1 if suggesterName is null or if this list does not contain the element.
      Parameters:
      merged - the descriptor to merged into
      suggesterName - the suggester name
      Returns:
      the index of the first occurrence of the element named suggesterName in the #suggesters list, or -1 if suggesterName is null or if this list does not contain the element
    • appendBefore

      protected static boolean appendBefore(SuggesterGroupDescriptor merged, String suggesterName, String newSuggesterName)
      Unless a suggester named newSuggesterName already exists in the #suggesters list, appends a new SuggesterGroupItemDescriptor named newSuggesterName just before the suggester named suggesterName in the #suggesters list. If the suggester named suggesterName does not exist, appends the new suggester at the beginning of the list.
      Parameters:
      merged - the descriptor to merged into
      suggesterName - the suggester name
      newSuggesterName - the name of the suggester to append
      Returns:
      true, if the suggester named newSuggesterName was appended to the #suggesters list
    • appendAfter

      protected static boolean appendAfter(SuggesterGroupDescriptor merged, String suggesterName, String newSuggesterName)
      Unless a suggester named newSuggesterName already exists in the #suggesters list, appends a new SuggesterGroupItemDescriptor named newSuggesterName just after the suggester named suggesterName in the #suggesters list. If the suggester named suggesterName does not exist, appends the new suggester at the end of the list.
      Parameters:
      merged - the descriptor to merged into
      suggesterName - the suggester name
      newSuggesterName - the name of the suggester to append
      Returns:
      true, if the suggester named newSuggesterName was appended to the #suggesters list
    • append

      protected static boolean append(SuggesterGroupDescriptor merged, String suggesterName, String newSuggesterName, boolean before)
      Unless a suggester named newSuggesterName already exists in the #suggesters list, appends a new SuggesterGroupItemDescriptor named newSuggesterName just before (if before is true) or after the suggester named suggesterName in the #suggesters list. If the suggester named suggesterName does not exist, appends the new suggester at the beginning or the end of the list, depending on before.
      Parameters:
      suggesterName - the suggester name
      newSuggesterName - the name of the suggester to append
      Returns:
      true, if the suggester named newSuggesterName was appended to the #suggesters list
    • logExistingSuggesterName

      protected void logExistingSuggesterName(String newSuggesterName)
      Logs that the suggester named newSuggesterName already exists in the #suggesters list and therefore won't be appended to it.
      Parameters:
      newSuggesterName - the new suggester name