Package fr.becpg.repo.comment.policy
Class CommentPermissionPolicy
java.lang.Object
fr.becpg.repo.policy.AbstractBeCPGPolicy
fr.becpg.repo.comment.policy.CommentPermissionPolicy
- All Implemented Interfaces:
org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy,org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy,org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy,org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy,org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy,org.alfresco.repo.policy.ClassPolicy,org.alfresco.repo.policy.Policy
public class CommentPermissionPolicy
extends AbstractBeCPGPolicy
implements org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy, org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
Refuses the edition and the deletion of a comment when the
CommentPermissionService does not allow it,
whatever the way the comment is reached (Share, REST API, script).
The system user, the creation of the comment itself, the cascade deletion of the commented node and the moves out
of the archive store (restoration or purge from the trashcan) are let through.- Author:
- valentin
-
Nested Class Summary
Nested classes/interfaces inherited from class fr.becpg.repo.policy.AbstractBeCPGPolicy
AbstractBeCPGPolicy.BeCPGPolicyTransactionListenerNested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
org.alfresco.repo.policy.Policy.Arg -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CommentPermissionServiceprivate org.alfresco.repo.forum.CommentServiceprivate static final StringFields inherited from class fr.becpg.repo.policy.AbstractBeCPGPolicy
ASSOC_REGISTRY, KEY_PENDING_DELETE_NODES, KEY_REGISTRY, lockService, nodeService, policyBehaviourFilter, policyComponent, postTransactionListener, transactionListenerFields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy
QNAMEFields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy
ARG_0, ARG_1, QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
ARG_0, ARG_1, ARG_2, QNAMEFields inherited from interface org.alfresco.repo.policy.Policy
NAMESPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) private voidcheckCanModify(org.alfresco.service.cmr.repository.NodeRef commentNodeRef, String refusalMessage) voiddoInit()doInit.private booleanisArchived(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) private booleanisCreatedInCurrentTransaction(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) private booleanisDiscussableNodeBeingDeleted(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) voidonCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef) voidonUpdateProperties(org.alfresco.service.cmr.repository.NodeRef commentNodeRef, Map<org.alfresco.service.namespace.QName, Serializable> before, Map<org.alfresco.service.namespace.QName, Serializable> after) voidsetCommentPermissionService(CommentPermissionService commentPermissionService) Setter for the fieldcommentPermissionService.voidsetCommentService(org.alfresco.repo.forum.CommentService commentService) Setter for the fieldcommentService.Methods inherited from class fr.becpg.repo.policy.AbstractBeCPGPolicy
containsNodeInQueue, containsNodeInQueue, disableOnCopyBehaviour, doAfterAssocsCommit, doAfterCommit, doBeforeAssocsCommit, doBeforeCommit, generateDefaultKey, getCopyCallback, getKeyRegistry, init, isBeCPGVersion, isEntityTemplate, isNotLocked, isPendingDelete, isPropChanged, isVersionNode, isVersionStoreNode, isWorkingCopyOrVersion, onCopyComplete, queueAssoc, queueAssoc, queueNode, queueNode, setLockService, setNodeService, setPolicyBehaviourFilter, setPolicyComponent, unQueueNode, unQueueNode
-
Field Details
-
KEY_COMMENTS_CREATED_IN_TXN
-
commentPermissionService
-
commentService
private org.alfresco.repo.forum.CommentService commentService
-
-
Constructor Details
-
CommentPermissionPolicy
public CommentPermissionPolicy()
-
-
Method Details
-
setCommentPermissionService
Setter for the field
commentPermissionService.- Parameters:
commentPermissionService- aCommentPermissionServiceobject
-
setCommentService
public void setCommentService(org.alfresco.repo.forum.CommentService commentService) Setter for the field
commentService.- Parameters:
commentService- aCommentServiceobject
-
doInit
public void doInit()doInit.
- Specified by:
doInitin classAbstractBeCPGPolicy
-
onCreateNode
public void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef) - Specified by:
onCreateNodein interfaceorg.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
-
onUpdateProperties
public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef commentNodeRef, Map<org.alfresco.service.namespace.QName, Serializable> before, Map<org.alfresco.service.namespace.QName, Serializable> after) - Specified by:
onUpdatePropertiesin interfaceorg.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
-
beforeDeleteNode
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) - Specified by:
beforeDeleteNodein interfaceorg.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
-
checkCanModify
private void checkCanModify(org.alfresco.service.cmr.repository.NodeRef commentNodeRef, String refusalMessage) -
isArchived
private boolean isArchived(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) -
isCreatedInCurrentTransaction
private boolean isCreatedInCurrentTransaction(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) -
isDiscussableNodeBeingDeleted
private boolean isDiscussableNodeBeingDeleted(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)
-