Class UndeletableAspect

  • All Implemented Interfaces:
    CopyServicePolicies.OnCopyNodePolicy, NodeServicePolicies.BeforeDeleteNodePolicy, ClassPolicy, Policy

    public class UndeletableAspect
    extends java.lang.Object
    implements NodeServicePolicies.BeforeDeleteNodePolicy, CopyServicePolicies.OnCopyNodePolicy
    Undeletable aspect behaviour bean. Deletions of nodes with the ContentModel.ASPECT_UNDELETABLE are not allowed by default. This class registers the behaviour that prevents the deletion.

    This aspect/behaviour combination allows for detailed application control of when node deletion is allowed or disallowed for particular nodes. It is not related to the normal permissions controls, which of course apply.

    An example of its usage is in the SiteService, where SiteModel.TYPE_SITE nodes are given the ContentModel.ASPECT_UNDELETABLE as a mandatory aspect. Therefore any attempt to delete such a node will result in an exception. However, this behaviour is disabled within the SiteService in order to allow site node deletion from within that service but from no other code.

    Since:
    3.5.0
    Author:
    Neil Mc Erlean
    • Constructor Detail

      • UndeletableAspect

        public UndeletableAspect()
    • Method Detail

      • setPolicyComponent

        public void setPolicyComponent​(PolicyComponent policyComponent)
        Set the policy component
        Parameters:
        policyComponent - policy component
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
        Set the node service
        Parameters:
        nodeService - node service
      • init

        public void init()
        Initialise method
      • beforeDeleteNode

        public void beforeDeleteNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Ensures that undeletable nodes cannot be deleted by default.
        Specified by:
        beforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicy
        Parameters:
        nodeRef - the node reference