Transaction-level Policies. Modify AuditableAspect and ContentHits example to make use of transaction policies so they only trigger once.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2651 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2006-04-12 16:15:20 +00:00
parent 776314da72
commit 0330f2cdb7
14 changed files with 1102 additions and 71 deletions

View File

@@ -43,6 +43,9 @@ public class JavaBehaviour implements Behaviour
// The method name
private String method;
// Notification Frequency
private NotificationFrequency frequency;
// Cache of interface proxies (by interface class)
private Map<Class, Object> proxies = new HashMap<Class, Object>();
@@ -58,11 +61,23 @@ public class JavaBehaviour implements Behaviour
* @param method the method name
*/
public JavaBehaviour(Object instance, String method)
{
this(instance, method, NotificationFrequency.EVERY_EVENT);
}
/**
* Construct.
*
* @param instance the object instance holding the method
* @param method the method name
*/
public JavaBehaviour(Object instance, String method, NotificationFrequency frequency)
{
ParameterCheck.mandatory("Instance", instance);
ParameterCheck.mandatory("Method", method);
this.instance = instance;
this.method = method;
this.frequency = frequency;
}
@@ -114,6 +129,15 @@ public class JavaBehaviour implements Behaviour
return stack.search(hashCode()) == -1;
}
/* (non-Javadoc)
* @see org.alfresco.repo.policy.Behaviour#getNotificationFrequency()
*/
public NotificationFrequency getNotificationFrequency()
{
return frequency;
}
@Override
public String toString()
{