public Object aroundInvoke(InvocationContext invocation) throws Exception
{
Method method = invocation.getMethod();
if ( method.isAnnotationPresent(IfInvalid.class) )
{
IfInvalid ifInvalid = method.getAnnotation(IfInvalid.class);
InvalidValue[] invalidValues = getComponent().getValidator()
.getInvalidValues( invocation.getTarget() );
if (invalidValues.length==0)
{
return invocation.proceed();
}
else
{
log.debug("invalid component state: " + getComponent().getName());
for (InvalidValue iv : invalidValues)
{
log.debug("invalid value: " + iv);
if ( ifInvalid.refreshEntities() && iv.getBeanClass().isAnnotationPresent(Entity.class) )
{
refreshInvalidEntity( ifInvalid, iv.getBean() );
}
FacesMessages.instance().addToControl(iv);
}
String outcome = ifInvalid.outcome();
return Outcome.REDISPLAY.equals(outcome) ? null : outcome;
}
}
else
{