Class ContentTypesDisplayMapper
- java.lang.Object
-
- com.atlassian.confluence.util.actions.ContentTypesDisplayMapper
-
- All Implemented Interfaces:
DisplayMapper
public class ContentTypesDisplayMapper extends Object implements DisplayMapper
Map Confluence content types to display information such as a CSS type or an Icon URL. When possible, use ContentUiSupport instead. This returns CSS classes of the form "content-type-page" etc. which are not sprite based, where ContentUiSupport would return icon-page, which are sprite based and are the preferred CSS styling of icons in Confluence.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CSS_CLASS_PREFIX
static String
DEFAULT_ATTACHMENT_CLASS_NAME
static String
DEFAULT_CLASS_NAME
static org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description ContentTypesDisplayMapper(UserProfilePictureAccessor userProfilePictureAccessor, ConfluenceUserResolver userResolver, ContentUiSupport<?> contentUiSupport)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getClassName(SearchResult result)
Get the CSS class name for the supplied SearchResult.String
getClassName(SearchResult result)
Get the CSS class name for the supplied SearchResult.static String
getIconForAttachment(String contentType, String fileName)
Decide the icon for an attachment based firstly on it's contentType.String
getIconUriReferenceForUsername(String username)
String
getIconUrlForUsername(String username)
Deprecated.since 5.10 usegetIconUriReferenceForUsername(java.lang.String)
-
-
-
Field Detail
-
log
public static final org.slf4j.Logger log
-
CSS_CLASS_PREFIX
public static final String CSS_CLASS_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_CLASS_NAME
public static final String DEFAULT_CLASS_NAME
- See Also:
- Constant Field Values
-
DEFAULT_ATTACHMENT_CLASS_NAME
public static final String DEFAULT_ATTACHMENT_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContentTypesDisplayMapper
public ContentTypesDisplayMapper(UserProfilePictureAccessor userProfilePictureAccessor, ConfluenceUserResolver userResolver, ContentUiSupport<?> contentUiSupport)
- Since:
- 7.16
-
-
Method Detail
-
getClassName
public String getClassName(SearchResult result)
Get the CSS class name for the supplied SearchResult. If the class cannot be determined from the result then the default class will be returned.- Parameters:
result
- the SearchResult that a CSS class is required for.- Returns:
- the CSS class name for the given
SearchResult
.
-
getClassName
public String getClassName(SearchResult result)
Get the CSS class name for the supplied SearchResult. If the class cannot be determined from the result then the default class will be returned.- Specified by:
getClassName
in interfaceDisplayMapper
- Parameters:
result
- the SearchResult that a CSS class is required for.- Returns:
- the CSS class name for the given
SearchResult
.
-
getIconForAttachment
public static String getIconForAttachment(String contentType, String fileName)
Decide the icon for an attachment based firstly on it's contentType. If it has no content type then the extension of it's filename will be used.- Parameters:
contentType
-fileName
-- Returns:
- the icon to be used for the attachment or the default icon if there is no specific one
-
getIconUrlForUsername
@Deprecated public String getIconUrlForUsername(String username)
Deprecated.since 5.10 usegetIconUriReferenceForUsername(java.lang.String)
- Parameters:
username
- the username to find an icon for.- Returns:
- the URL (relative to the application's base URI excluding context path) for the icon for this username. If the user has no avatar then the URL of a default will be returned.
-
getIconUriReferenceForUsername
public String getIconUriReferenceForUsername(String username)
- Parameters:
username
- the username to find an icon for.- Returns:
- a "URI reference" (a URL that is either relative to the application's base URI including context path or an absolute URL) for the icon for this username. If the user has no avatar then the URL of a default will be returned.
-
-