Suppression and azimuthal anisotropy of prompt and nonprompt J/ψ production in PbPb collisions at sNN=2.76 TeV