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 String
DATE_FORMAT_PATTERN
protected String
description
protected boolean
disabled
protected Map<String,List<String>>
highlights
protected String
iconURL
protected String
id
protected String
label
protected String
thumbnailURL
protected String
type
-
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 Suggestion
disable()
String
getDescription()
Map<String,List<String>>
getHighlights()
Get the map of highlights associated to the suggested result.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).String
getId()
The id of the object associated to the suggestion.boolean
getIsDisabled()
Disabled suggestions can be useful to display suggestions that might have been relevant if the context was slightly different (e.g.String
getLabel()
The i18n label to display to the user for this suggestion.abstract String
getObjectUrl()
String
getThumbnailURL()
String
getType()
A string marker to give the type (i.e.String
toString()
Suggestion
withDescription(String description)
Suggestion
withHighlights(Map<String,List<String>> highlights)
Suggestion
withThumbnailURL(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
-
-