Class UndeletableAspect

java.lang.Object
org.alfresco.repo.node.UndeletableAspect
All Implemented Interfaces:
CopyServicePolicies.OnCopyNodePolicy, NodeServicePolicies.BeforeDeleteNodePolicy, ClassPolicy, Policy

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 Details

    • UndeletableAspect

      public UndeletableAspect()
  • Method Details

    • setPolicyComponent

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

      public void setNodeService(NodeService nodeService)
      Set the node service
      Parameters:
      nodeService - node service
    • init

      public void init()
      Initialise method
    • beforeDeleteNode

      public void beforeDeleteNode(NodeRef nodeRef)
      Ensures that undeletable nodes cannot be deleted by default.
      Specified by:
      beforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicy
      Parameters:
      nodeRef - the node reference
    • getCopyCallback

      public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails)
      Description copied from interface: CopyServicePolicies.OnCopyNodePolicy
      Called for all types and aspects before copying a node.
      Specified by:
      getCopyCallback in interface CopyServicePolicies.OnCopyNodePolicy
      Parameters:
      classRef - the type or aspect qualified name
      copyDetails - the details of the impending copy
      Returns:
      Return the callback that will be used to modify the copy behaviour for this dictionary class. Return null to assume the default.
      See Also: