org.alfresco.repo.node
Class UndeletableAspect

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

public class UndeletableAspect
extends java.lang.Object
implements NodeServicePolicies.BeforeDeleteNodePolicy

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
 
Field Summary
 
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAME
 
Fields inherited from interface org.alfresco.repo.policy.Policy
NAMESPACE
 
Constructor Summary
UndeletableAspect()
           
 
Method Summary
 void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Ensures that undeletable nodes cannot be deleted by default.
 void init()
          Initialise method
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
          Set the node service
 void setPolicyComponent(PolicyComponent policyComponent)
          Set the policy component
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.