Package org.ametys.plugins.workspaces
Class WorkspacesHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.WorkspacesHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
public class WorkspacesHelper extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
Utility classes for workspaces
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WorkspacesHelper.FileType
Enumeration for file type
-
Field Summary
Fields Modifier and Type Field Description private Context
_context
private URIPrefixHandler
_prefixHandler
static String
ROLE
Avalon role
-
Constructor Summary
Constructors Constructor Description WorkspacesHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Request
_getRequest()
void
contextualize(Context context)
String
getAvatar(UserIdentity userIdentity, String lang, int size)
Get user avatarWorkspacesHelper.FileType
getFileType(Resource file)
Get the file type of a resource fileBufferedImage
getImage(Resource file)
Get the buffered image from the resourceboolean
isImage(Resource file)
Determines if the resource file is an imagevoid
service(ServiceManager smanager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_prefixHandler
private URIPrefixHandler _prefixHandler
-
-
Constructor Detail
-
WorkspacesHelper
public WorkspacesHelper()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
isImage
public boolean isImage(Resource file)
Determines if the resource file is an image- Parameters:
file
- the resource- Returns:
- true if the resource file is an image
-
getImage
public BufferedImage getImage(Resource file)
Get the buffered image from the resource- Parameters:
file
- the resource- Returns:
- the buffered image or null if the resource is not a image or if failed to read image
-
getFileType
public WorkspacesHelper.FileType getFileType(Resource file)
Get the file type of a resource file- Parameters:
file
- the resource- Returns:
- the
WorkspacesHelper.FileType
-
getAvatar
public String getAvatar(UserIdentity userIdentity, String lang, int size)
Get user avatar- Parameters:
userIdentity
- the user identitylang
- the lang for user's contentsize
- the size in pixel of image- Returns:
- the avatar url
-
_getRequest
private Request _getRequest()
-
-