{
return next.invoke( proxy, method, args );
}
else
{
Usecase usecase = usecase();
return invokeWithCommit( proxy, method, args, module.newUnitOfWork( usecase ) );
}
}
else if( propagationPolicy == UnitOfWorkPropagation.Propagation.MANDATORY )
{
if( !module.isUnitOfWorkActive() )
{
throw new IllegalStateException( "UnitOfWork was required but there is no available unit of work." );
}
}
else if( propagationPolicy == UnitOfWorkPropagation.Propagation.REQUIRES_NEW )
{
Usecase usecase = usecase();
return invokeWithCommit( proxy, method, args, module.newUnitOfWork( usecase ) );
}
return next.invoke( proxy, method, args );
}