Hi,Ok, I'll talk you through some of the relevant code in VersionableAspect and hopefully it will answer your question.Lets say, for example, you would like a chunk of code to be executed every time an aspect of a particular type is applied to a node. In this example we are interested in binding behaviour to the 'onAddAspect' policy.You can think of a policy as a repository event. For example every time an aspect is applied to a node the repository triggers the onAddAspect policy. At this point any behaviours (like event handlers) that have been registered for that policy and meet the type restrictions defined, when the behaviour was bound, will be fired.To bind to behaviour to a policy we use code similar to this …
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
ContentModel.ASPECT_VERSIONABLE,
new JavaBehaviour(this, "onAddAspect"));
Here we are binding to the onAddAspect behaviour (1st parameter), this behaviour will only be fired if the node in question has the versionable aspect applied (2nd parameter). The behaviour implementation is the 3rd parameter and in this example its a method called "onAddAspect" in "this" class.This is what the method could look like …
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{
// Do some stuff ….
}
I hope this helps to explain things,Roy