Longoria traded to Giants after 10 years with Rays