in validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java [56:147]
public void afterPhase(PhaseEvent event)
{
try
{
CrossValidationStorage crossValidationStorage = CrossValidationUtils.getOrInitCrossValidationStorage();
FacesContext facesContext = FacesContext.getCurrentInstance();
for (CrossValidationStorageEntry entry : crossValidationStorage.getCrossValidationStorageEntries())
{
try
{
if(!ExtValUtils.executeGlobalBeforeValidationInterceptors(
facesContext,
entry.getComponent(),
entry.getConvertedObject(),
CrossValidationStorageEntry.class.getName(),
entry,
PropertyValidationModuleKey.class))
{
continue;
}
//call init-method
if(entry.getValidationStrategy() instanceof AbstractCrossValidationStrategy)
{
ReflectionUtils.tryToInvokeMethod(
entry.getValidationStrategy(),
ReflectionUtils.tryToGetMethod(
ProxyUtils.getUnproxiedClass(entry.getValidationStrategy().getClass()),
"initCrossValidation",
CrossValidationStorageEntry.class),
entry);
}
/*
* validation
*/
entry.getValidationStrategy().processCrossValidation(entry, crossValidationStorage);
}
catch (ValidatorException validatorException)
{
boolean addMessage = true;
if(entry.getValidationStrategy() instanceof AbstractCrossValidationStrategy)
{
try
{
addMessage = (Boolean)ReflectionUtils.tryToInvokeMethod(
entry.getValidationStrategy(),
ReflectionUtils.tryToGetMethod(
ProxyUtils.getUnproxiedClass(entry.getValidationStrategy().getClass()),
"processAfterCrossValidatorException",
CrossValidationStorageEntry.class,
validatorException.getClass()),
entry,
validatorException);
}
catch (Exception e)
{
throw new FacesException(e);
}
}
if(addMessage)
{
FacesMessage facesMessage = validatorException.getFacesMessage();
if (facesMessage != null &&
facesMessage.getSummary() != null && facesMessage.getDetail() != null)
{
ExtValUtils.tryToAddViolationMessageForComponentId(entry.getClientId(), facesMessage);
}
ExtValUtils.tryToBlocksNavigationForComponentId(entry.getClientId(), facesMessage);
}
}
finally
{
ExtValUtils.executeGlobalAfterValidationInterceptors(
facesContext,
entry.getComponent(),
entry.getConvertedObject(),
CrossValidationStorageEntry.class.getName(),
entry,
PropertyValidationModuleKey.class);
}
}
}
finally
{
CrossValidationUtils.resetCrossValidationStorage();
}
}