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 helperFields 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 cropSize, boolean download) Get the default image uri for a userprotected String
_getProfileImageUri
(UserIdentity user, String lang, int cropSize, 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
-
_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 cropSize, boolean download) throws ResourceNotFoundException Get the profile image uri- Parameters:
user
- the user identity. Can be null.lang
- the languagecropSize
- the image dimension. The image will be cropped.download
- true if the uri is for download purposes.- Returns:
- the profile image uri
- Throws:
ResourceNotFoundException
- if no image for user was found
-
_getDefaultImageUri
protected String _getDefaultImageUri(UserIdentity user, String lang, int cropSize, boolean download) Get the default image uri for a user- Parameters:
user
- the user identitylang
- the content languagecropSize
- the 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
-