af::Msg* UserContainer::generateJobsList( int id) { UserContainerIt usersIt( this); UserAf* user = usersIt.getUser( id); if( user == NULL) return NULL; MCAfNodes mcjobs; user->jobsinfo( mcjobs); return new af::Msg( af::Msg::TJobsList, &mcjobs); }
af::Msg* UserContainer::generateJobsList( const std::vector<int32_t> & ids, const std::string & i_type_name, bool json) { UserContainerIt usersIt( this); MCAfNodes mcjobs; std::ostringstream stream; bool has_jobs = false; if( json ) { stream << "{\"" << i_type_name << "\":[\n"; } for( int i = 0; i < ids.size(); i++) { UserAf* user = usersIt.getUser( ids[i]); if( user == NULL) continue; if( json ) { if(( i != 0 ) && ( has_jobs )) stream << ",\n"; has_jobs = user->getJobs( stream); } else user->jobsinfo( mcjobs); } if( json ) { stream << "\n]}"; return af::jsonMsg( stream); } af::Msg * msg = new af::Msg(); msg->set( af::Msg::TJobsList, &mcjobs); return msg; }