mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed compilation issue
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/ENFORCE@105294 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,17 +39,17 @@ import org.springframework.context.ApplicationContextAware;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Classification method interceptor
|
* Classification method interceptor
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ClassificationMethodInterceptor implements MethodInterceptor, ApplicationContextAware
|
public class ClassificationMethodInterceptor implements MethodInterceptor, ApplicationContextAware
|
||||||
{
|
{
|
||||||
private static final String KEY_PROCESSING = GUID.generate();
|
private static final String KEY_PROCESSING = GUID.generate();
|
||||||
|
|
||||||
/** application context */
|
/** application context */
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param applicationContext application context
|
* @param applicationContext application context
|
||||||
* @throws BeansException
|
* @throws BeansException
|
||||||
@@ -59,12 +59,12 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
{
|
{
|
||||||
this.applicationContext = applicationContext;
|
this.applicationContext = applicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AuthenticationUtil getAuthenticationUtil()
|
protected AuthenticationUtil getAuthenticationUtil()
|
||||||
{
|
{
|
||||||
return (AuthenticationUtil)applicationContext.getBean("rm.authenticationUtil");
|
return (AuthenticationUtil)applicationContext.getBean("rm.authenticationUtil");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@link ContentClassificationService} content classification service
|
* @return {@link ContentClassificationService} content classification service
|
||||||
*/
|
*/
|
||||||
@@ -72,22 +72,22 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
{
|
{
|
||||||
return (ContentClassificationService)applicationContext.getBean("contentClassificationService");
|
return (ContentClassificationService)applicationContext.getBean("contentClassificationService");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlfrescoTransactionSupport getAlfrescoTransactionSupport()
|
protected AlfrescoTransactionSupport getAlfrescoTransactionSupport()
|
||||||
{
|
{
|
||||||
return (AlfrescoTransactionSupport)applicationContext.getBean("rm.alfrescoTransactionSupport");
|
return (AlfrescoTransactionSupport)applicationContext.getBean("rm.alfrescoTransactionSupport");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RetryingTransactionHelper getRetryingTransactionHelper()
|
protected RetryingTransactionHelper getRetryingTransactionHelper()
|
||||||
{
|
{
|
||||||
return ((TransactionService)applicationContext.getBean("transactionService")).getRetryingTransactionHelper();
|
return ((TransactionService)applicationContext.getBean("transactionService")).getRetryingTransactionHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ClassificationServiceBootstrap getClassificationServiceBootstrap()
|
protected ClassificationServiceBootstrap getClassificationServiceBootstrap()
|
||||||
{
|
{
|
||||||
return (ClassificationServiceBootstrap)applicationContext.getBean("classificationServiceBootstrap");
|
return (ClassificationServiceBootstrap)applicationContext.getBean("classificationServiceBootstrap");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NodeService getNodeService()
|
protected NodeService getNodeService()
|
||||||
{
|
{
|
||||||
return (NodeService)applicationContext.getBean("dbNodeService");
|
return (NodeService)applicationContext.getBean("dbNodeService");
|
||||||
@@ -96,31 +96,31 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
/**
|
/**
|
||||||
* Check that the current user is cleared to see the items passed as parameters to the current
|
* Check that the current user is cleared to see the items passed as parameters to the current
|
||||||
* method invocation.
|
* method invocation.
|
||||||
*
|
*
|
||||||
* @param invocation method invocation
|
* @param invocation method invocation
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public void checkClassification(MethodInvocation invocation)
|
public void checkClassification(final MethodInvocation invocation)
|
||||||
{
|
{
|
||||||
// do in transaction
|
// do in transaction
|
||||||
getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
|
getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
|
||||||
{
|
{
|
||||||
public Void execute() throws Throwable
|
public Void execute() throws Throwable
|
||||||
{
|
{
|
||||||
// ensure classification service has been bootstrapped
|
// ensure classification service has been bootstrapped
|
||||||
if (getClassificationServiceBootstrap().isInitialised())
|
if (getClassificationServiceBootstrap().isInitialised())
|
||||||
{
|
{
|
||||||
// check that we are not already processing a classification check
|
// check that we are not already processing a classification check
|
||||||
Object value = getAlfrescoTransactionSupport().getResource(KEY_PROCESSING);
|
Object value = getAlfrescoTransactionSupport().getResource(KEY_PROCESSING);
|
||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
// check that we have an authenticated user and that they aren't "system"
|
// check that we have an authenticated user and that they aren't "system"
|
||||||
if (getAuthenticationUtil().getFullyAuthenticatedUser() != null &&
|
if (getAuthenticationUtil().getFullyAuthenticatedUser() != null &&
|
||||||
!getAuthenticationUtil().isRunAsUserTheSystemUser())
|
!getAuthenticationUtil().isRunAsUserTheSystemUser())
|
||||||
{
|
{
|
||||||
Method method = invocation.getMethod();
|
Method method = invocation.getMethod();
|
||||||
Class[] params = method.getParameterTypes();
|
Class[] params = method.getParameterTypes();
|
||||||
|
|
||||||
int position = 0;
|
int position = 0;
|
||||||
for (Class param : params)
|
for (Class param : params)
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
{
|
{
|
||||||
// get the value of the parameter
|
// get the value of the parameter
|
||||||
NodeRef testNodeRef = (NodeRef) invocation.getArguments()[position];
|
NodeRef testNodeRef = (NodeRef) invocation.getArguments()[position];
|
||||||
|
|
||||||
// if node exists then see if the current user has clearance
|
// if node exists then see if the current user has clearance
|
||||||
if (getNodeService().exists(testNodeRef) &&
|
if (getNodeService().exists(testNodeRef) &&
|
||||||
!getContentClassificaitonService().hasClearance(testNodeRef))
|
!getContentClassificaitonService().hasClearance(testNodeRef))
|
||||||
@@ -148,13 +148,13 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
getAlfrescoTransactionSupport().unbindResource(KEY_PROCESSING);
|
getAlfrescoTransactionSupport().unbindResource(KEY_PROCESSING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
@@ -168,13 +168,13 @@ public class ClassificationMethodInterceptor implements MethodInterceptor, Appli
|
|||||||
{
|
{
|
||||||
// pre method invocation check
|
// pre method invocation check
|
||||||
checkClassification(invocation);
|
checkClassification(invocation);
|
||||||
|
|
||||||
// method proceed
|
// method proceed
|
||||||
Object result = invocation.proceed();
|
Object result = invocation.proceed();
|
||||||
|
|
||||||
// post method invocation processing
|
// post method invocation processing
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user