mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -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()
|
||||
{
|
||||
|
Reference in New Issue
Block a user