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
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected UserDirectoryHelperThe user directory helperstatic final StringAttribute path for user's imageFields inherited from class org.apache.cocoon.acting.ServiceableAction
managerFields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP -
Constructor Summary
Constructors -
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) voidservice(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:
servicein interfaceServiceable- Overrides:
servicein 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
-