Class Suggestion

java.lang.Object
org.nuxeo.ecm.platform.suggestbox.service.Suggestion
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DocumentSuggestion, GroupSuggestion, UserSuggestion

public abstract class Suggestion extends Object implements Serializable
Base class for building data transfer objects for results of requests to the SuggestionService.
Author:
ogrisel
See Also:
  • Field Details

    • DATE_FORMAT_PATTERN

      public static final String DATE_FORMAT_PATTERN
      See Also:
    • id

      protected final String id
    • type

      protected final String type
    • label

      protected final String label
    • iconURL

      protected final String iconURL
    • thumbnailURL

      protected String thumbnailURL
    • description

      protected String description
    • highlights

      protected Map<String,List<String>> highlights
    • disabled

      protected boolean disabled
  • Constructor Details

  • Method Details

    • getId

      public String getId()
      The id of the object associated to the suggestion.
      Since:
      6.0
    • getType

      public String getType()
      A string marker to give the type (i.e. category) of the suggested user action / intent. The type is used to broadcast the selected suggestion to the correct handler.
    • getLabel

      public String getLabel()
      The i18n label to display to the user for this suggestion.
    • getIconURL

      public String getIconURL()
      Relative URL path to download an icon (can represent the type of suggestion or the specific instance such as the mimetype icon of a document suggestion or the avatar icon of a user profile suggestion).
    • getDescription

      public String getDescription()
    • withDescription

      public Suggestion withDescription(String description)
    • getIsDisabled

      public boolean getIsDisabled()
      Disabled suggestions can be useful to display suggestions that might have been relevant if the context was slightly different (e.g. if the user was logged in instead of anonymous): the UI should not make them selectable but the description should give information to the user on how to make that suggestion enabled (e.g. by logging in). The SuggestionService will throw an exception if the user selects a disabled suggestion.
    • getThumbnailURL

      public String getThumbnailURL()
      Since:
      8.4
    • withHighlights

      public Suggestion withHighlights(Map<String,List<String>> highlights)
      Since:
      9.2
    • withThumbnailURL

      public Suggestion withThumbnailURL(String thumbnailURL)
      Since:
      8.4
    • disable

      public Suggestion disable()
    • getObjectUrl

      public abstract String getObjectUrl()
      Returns:
      the url to access to the object. It used by the navigation in the select2.
      Since:
      6.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getHighlights

      public Map<String,List<String>> getHighlights()
      Get the map of highlights associated to the suggested result. The key of a map entry item represents the highlighted field, the value is the list of segment.
      Since:
      9.2