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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user provider.protected RightManagerThe right managerprotected WorkspaceModuleExtensionPointThe workspace module extension pointstatic final StringAvalon role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontextualize(Context context) getAvatar(UserIdentity userIdentity, String lang, int size) Get user avatargetFileType(String filename) Get the file type of a resource from its namegetFileType(Resource file) Get the file type of a resource fileGet the lang for this project, or en if none foundGet the lang for this project, or given default language if none foundGet current project from requesthandleTags(TaggableAmetysObject taggableAmetysObject, List<Object> tags, TraversableAmetysObject moduleRoot) Handle tags for the edition of a TaggableAmetysObjectbooleanDetermines if the resource file is an imagevoidservice(ServiceManager smanager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon role -
_rightManager
The right manager -
_workspaceModuleEP
The workspace module extension point -
_currentUserProvider
The current user provider.
-
-
Constructor Details
-
WorkspacesHelper
public WorkspacesHelper()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
isImage
Determines if the resource file is an image- Parameters:
file- the resource- Returns:
- true if the resource file is an image
-
getFileType
Get the file type of a resource file- Parameters:
file- the resource- Returns:
- the
WorkspacesHelper.FileType
-
getFileType
Get the file type of a resource from its name- Parameters:
filename- the resource's name- Returns:
- the
WorkspacesHelper.FileType
-
getAvatar
Get user avatar- Parameters:
userIdentity- the user identitylang- the lang for user's contentsize- the size in pixel of image- Returns:
- the avatar url
-
getProjectFromRequest
Get current project from request- Returns:
- the current project or null if not found.
-
handleTags
public List<Map<String,Object>> handleTags(TaggableAmetysObject taggableAmetysObject, List<Object> tags, TraversableAmetysObject moduleRoot) Handle tags for the edition of a TaggableAmetysObject- Parameters:
taggableAmetysObject- the object to edittags- the tagsmoduleRoot- the module root, used to check tag creation rights if needed- Returns:
- the created tags
-
getLang
Get the lang for this project, or en if none found- Parameters:
project- the project to check- Returns:
- a lang in this project, or en if none found
-
getLang
Get the lang for this project, or given default language if none found- Parameters:
project- the project to checkdefaultLanguage- the default language to return if no language is available for the project or if the site could not be found- Returns:
- a lang in this project or given default language
-