Class Suggestion
- java.lang.Object
-
- org.nuxeo.ecm.platform.suggestbox.service.Suggestion
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DocumentSuggestion,GroupSuggestion,SearchDocumentsSuggestion,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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATE_FORMAT_PATTERNprotected Stringdescriptionprotected booleandisabledprotected Map<String,List<String>>highlightsprotected StringiconURLprotected Stringidprotected Stringlabelprotected StringthumbnailURLprotected Stringtype
-
Constructor Summary
Constructors Constructor Description Suggestion(String id, String type, String label, String iconURL)Suggestion(String id, String type, String label, String iconURL, String thumbnailURL)Suggestion(String id, String type, String label, String iconURL, String thumbnailURL, Map<String,List<String>> highlights)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Suggestiondisable()StringgetDescription()Map<String,List<String>>getHighlights()Get the map of highlights associated to the suggested result.StringgetIconURL()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).StringgetId()The id of the object associated to the suggestion.booleangetIsDisabled()Disabled suggestions can be useful to display suggestions that might have been relevant if the context was slightly different (e.g.StringgetLabel()The i18n label to display to the user for this suggestion.abstract StringgetObjectUrl()StringgetThumbnailURL()StringgetType()A string marker to give the type (i.e.StringtoString()SuggestionwithDescription(String description)SuggestionwithHighlights(Map<String,List<String>> highlights)SuggestionwithThumbnailURL(String thumbnailURL)
-
-
-
Field Detail
-
DATE_FORMAT_PATTERN
public static final String DATE_FORMAT_PATTERN
- See Also:
- Constant Field Values
-
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
-
disabled
protected boolean disabled
-
-
Method Detail
-
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
-
-