Class GetProfileImageUriAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.plugins.userdirectory.action.GetProfileImageUriAction
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
Get the internal uri of a user's avatar
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected UserDirectoryHelper
The user directory helperstatic final String
Attribute path for user's imageFields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
_getDefaultImageUri
(UserIdentity user, String lang, int size, int maxSize, boolean download) Get the default image uri for a userprotected String
_getDefaultImageUriForAnonymous
(int size, int maxSize, boolean download) Get the image uri for anonymous userprotected String
_getImageUriFromUserContent
(UserIdentity user, String lang, int size, int maxSize, boolean download) Get the image uri from user content if existsprotected String
_getProfileImageUri
(UserIdentity user, String lang, int size, int maxSize, boolean download) Get the profile image uriprotected UserIdentity
_getUser
(Parameters parameters) Get the user from parametersact
(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) void
service
(ServiceManager smanager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
USER_CONTENT_IMAGE_PATH
Attribute path for user's image- See Also:
-
_currentUserProvider
The current user provider -
_userDirectoryHelper
The user directory helper
-
-
Constructor Details
-
GetProfileImageUriAction
public GetProfileImageUriAction()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
_getProfileImageUri
protected String _getProfileImageUri(UserIdentity user, String lang, int size, int maxSize, boolean download) Get the profile image uri- Parameters:
user
- the user identity. Can be null.lang
- the languagesize
- the image dimensionmaxSize
- the max image dimensiondownload
- true if the uri is for download purposes.- Returns:
- the profile image uri
-
_getDefaultImageUriForAnonymous
Get the image uri for anonymous user- Parameters:
size
- the image dimensionmaxSize
- the max image dimensiondownload
- true if the uri is for download purposes.- Returns:
- the image uri when user is null
-
_getImageUriFromUserContent
protected String _getImageUriFromUserContent(UserIdentity user, String lang, int size, int maxSize, boolean download) Get the image uri from user content if exists- Parameters:
user
- the user identitylang
- the content languagesize
- the image dimensionmaxSize
- the max image dimensiondownload
- true if the uri is for download purposes.- Returns:
- the image uri or null if not found
-
_getDefaultImageUri
protected String _getDefaultImageUri(UserIdentity user, String lang, int size, int maxSize, boolean download) Get the default image uri for a user- Parameters:
user
- the user identitylang
- the content languagesize
- the image dimensionmaxSize
- the max image dimensiondownload
- true if the uri is for download purposes.- Returns:
- the image uri
-
_getUser
Get the user from parameters- Parameters:
parameters
- the sitemap parameters- Returns:
- the user identity
-