A characterization of groups of closed orientable surfaces in 4-space