public Object execute(InvocationContext invocationContext) throws Exception
{
AccessDecisionVoterContext voterContext =
CodiUtils.getContextualReferenceByClass(beanManager, AccessDecisionVoterContext.class, true);
Secured secured = null;
List<Annotation> annotatedTypeMetadata = extractMetadata(invocationContext);
for (Annotation annotation : annotatedTypeMetadata)
{
if(Secured.class.isAssignableFrom(annotation.annotationType()))
{
secured = (Secured)annotation;
}
else if(voterContext instanceof EditableAccessDecisionVoterContext)
{
((EditableAccessDecisionVoterContext)voterContext)
.addMetaData(annotation.annotationType().getName(), annotation);
}
}
if(secured != null)
{
Class<? extends AccessDecisionVoter>[] voterClasses = secured.value();
invokeVoters(invocationContext, this.beanManager, voterContext,
Arrays.asList(voterClasses), secured.errorView());
}
return invocationContext.proceed();
}