Package org.ametys.plugins.workspaces
Class AbstractWorkspaceDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workspaces.AbstractWorkspaceDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
- Direct Known Subclasses:
AbstractCalendarDAO
,AbstractWorkspaceTaskDAO
,AbstractWorkspaceThreadDAO
public abstract class AbstractWorkspaceDAO
extends AbstractLogEnabled
implements Serviceable, Component, Contextualizable
Abstract class for workspace modules DAO's
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
The avalon contextprotected CurrentUserProvider
The current user provider.protected ObservationManager
Observer manager.protected ProjectManager
Workspaces project managerprotected ProjectTagsDAO
The project tags DAOprotected AmetysObjectResolver
Ametys resolverprotected RichTextTransformer
Rich text transformerprotected RightManager
The rights managerprotected UserManager
User managerprotected WorkflowHelper
The workflow helperprotected WorkflowProvider
The workflow providerprotected WorkspacesHelper
The Workspaces helperprotected WorkspaceModuleExtensionPoint
The workspace module EP -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_checkUserReadingRights
(AmetysObject objectToCheck) Check user reading rightsprotected void
_checkUserRights
(AmetysObject objectToCheck, String rightId) Check user rightsprotected Project
Get the projectprotected String
Get the project nameprotected String
Get the sitemap languageprotected String
Get the site name_handleTags
(TaggableAmetysObject taggableAmetysObject, List<Object> tags) Handle tags for the edition of a TaggableAmetysObjectprotected boolean
_hasAfterSubComments
(AbstractComment comment, List<AbstractComment> subComments) Check if a given comment should be deleted or removedprotected void
_setAttachments
(AttachableAmetysObject attachableAmetysObject, List<Part> newFiles, List<String> newFileNames, List<String> deleteFiles) Edit the attachments of an AttachableAmetysObject<T extends AbstractComment>
TanswerComment
(CommentableAmetysObject<T> commentableAmetysObject, String commentId, String commentText, ModifiableTraversableAmetysObject moduleRoot) Answer to a commentableAmetysObject commentvoid
contextualize
(Context context) <T extends AbstractComment>
TcreateComment
(CommentableAmetysObject<T> commentableAmetysObject, String commentText, ModifiableTraversableAmetysObject moduleRoot) Comment a commentableAmetysObjectdeleteComment
(CommentableAmetysObject commentableAmetysObject, String commentId, ModifiableTraversableAmetysObject moduleRoot) Edit a commentableAmetysObject commenteditComment
(CommentableAmetysObject commentableAmetysObject, String commentId, String commentText, ModifiableTraversableAmetysObject moduleRoot) Edit a commentableAmetysObject commentlikeOrUnlikeComment
(CommentableAmetysObject commentableAmetysObject, String commentId, Boolean liked, ModifiableTraversableAmetysObject moduleRoot) Answer to a commentableAmetysObject commentvoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_resolver
Ametys resolver -
_observationManager
Observer manager. -
_currentUserProvider
The current user provider. -
_rightManager
The rights manager -
_userManager
User manager -
_workflowProvider
The workflow provider -
_workflowHelper
The workflow helper -
_projectManager
Workspaces project manager -
_context
The avalon context -
_workspaceModuleEP
The workspace module EP -
_projectTagsDAO
The project tags DAO -
_workspaceHelper
The Workspaces helper -
_richTextTransformer
Rich text transformer
-
-
Constructor Details
-
AbstractWorkspaceDAO
public AbstractWorkspaceDAO()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
_getProjectName
Get the project name- Returns:
- the project name
-
_getProject
Get the project- Returns:
- the project
-
_getSitemapLanguage
Get the sitemap language- Returns:
- the sitemap language
-
_getSiteName
Get the site name- Returns:
- the site name
-
_checkUserRights
protected void _checkUserRights(AmetysObject objectToCheck, String rightId) throws IllegalAccessException Check user rights- Parameters:
objectToCheck
- the object to checkrightId
- the right id- Throws:
IllegalAccessException
- if a right error occurred
-
_checkUserReadingRights
Check user reading rights- Parameters:
objectToCheck
- the object to check- Throws:
IllegalAccessException
- if a right error occurred
-
_handleTags
protected List<Map<String,Object>> _handleTags(TaggableAmetysObject taggableAmetysObject, List<Object> tags) Handle tags for the edition of a TaggableAmetysObject- Parameters:
taggableAmetysObject
- the object to edittags
- the tags- Returns:
- the created tags
-
_setAttachments
protected void _setAttachments(AttachableAmetysObject attachableAmetysObject, List<Part> newFiles, List<String> newFileNames, List<String> deleteFiles) Edit the attachments of an AttachableAmetysObject- Parameters:
attachableAmetysObject
- the ametys object to editnewFiles
- list of new filesnewFileNames
- list of new files namesdeleteFiles
- list of names of old files to delete
-
createComment
public <T extends AbstractComment> T createComment(CommentableAmetysObject<T> commentableAmetysObject, String commentText, ModifiableTraversableAmetysObject moduleRoot) Comment a commentableAmetysObject- Type Parameters:
T
- type of the value to retrieve- Parameters:
commentableAmetysObject
- the commentableAmetysObjectcommentText
- the comment textmoduleRoot
- the module root- Returns:
- The commentableAmetysObject
-
editComment
public CommentableAmetysObject editComment(CommentableAmetysObject commentableAmetysObject, String commentId, String commentText, ModifiableTraversableAmetysObject moduleRoot) throws IllegalAccessException Edit a commentableAmetysObject comment- Parameters:
commentableAmetysObject
- the commentableAmetysObjectcommentId
- the comment IdcommentText
- the comment textmoduleRoot
- the module root- Returns:
- The commentableAmetysObject
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
deleteComment
public CommentableAmetysObject deleteComment(CommentableAmetysObject commentableAmetysObject, String commentId, ModifiableTraversableAmetysObject moduleRoot) Edit a commentableAmetysObject comment- Parameters:
commentableAmetysObject
- the commentableAmetysObjectcommentId
- the comment IdmoduleRoot
- the module root- Returns:
- The commentableAmetysObject
-
_hasAfterSubComments
Check if a given comment should be deleted or removed- Parameters:
comment
- the commentsubComments
- the subcomments- Returns:
- true if the comment should be deleted, false if the comment should be removed instead
-
answerComment
public <T extends AbstractComment> T answerComment(CommentableAmetysObject<T> commentableAmetysObject, String commentId, String commentText, ModifiableTraversableAmetysObject moduleRoot) Answer to a commentableAmetysObject comment- Type Parameters:
T
- type of the value to retrieve- Parameters:
commentableAmetysObject
- the commentableAmetysObjectcommentId
- the parent comment IdcommentText
- the comment textmoduleRoot
- the module root- Returns:
- The commentableAmetysObject
-
likeOrUnlikeComment
public CommentableAmetysObject likeOrUnlikeComment(CommentableAmetysObject commentableAmetysObject, String commentId, Boolean liked, ModifiableTraversableAmetysObject moduleRoot) Answer to a commentableAmetysObject comment- Parameters:
commentableAmetysObject
- the commentableAmetysObjectcommentId
- the parent comment Idliked
- true if the comment is liked, otherwise the comment is unlikedmoduleRoot
- the module root- Returns:
- The commentableAmetysObject
-