Search in sources :

Example 16 with RelatedProjectJoin

use of ca.corefacility.bioinformatics.irida.model.joins.impl.RelatedProjectJoin in project irida by phac-nml.

the class ProjectSettingsAssociatedProjectsController method ajaxAssociatedProjects.

/**
 * Get a list of the local associated projects.
 *
 * @param projectId
 * 		{@link Long} identifier for the current {@link Project}
 *
 * @return a list of the associated projects for the given project
 */
@RequestMapping("/ajax/associated")
@ResponseBody
public List<Project> ajaxAssociatedProjects(@PathVariable Long projectId) {
    Project project = projectService.read(projectId);
    List<RelatedProjectJoin> relatedProjectJoins = projectService.getRelatedProjects(project);
    return relatedProjectJoins.stream().map(RelatedProjectJoin::getObject).collect(Collectors.toList());
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) RelatedProjectJoin(ca.corefacility.bioinformatics.irida.model.joins.impl.RelatedProjectJoin) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

RelatedProjectJoin (ca.corefacility.bioinformatics.irida.model.joins.impl.RelatedProjectJoin)16 Project (ca.corefacility.bioinformatics.irida.model.project.Project)14 Test (org.junit.Test)10 User (ca.corefacility.bioinformatics.irida.model.user.User)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 Principal (java.security.Principal)3 Map (java.util.Map)3 WithMockUser (org.springframework.security.test.context.support.WithMockUser)3 ExtendedModelMap (org.springframework.ui.ExtendedModelMap)3 List (java.util.List)2 PageImpl (org.springframework.data.domain.PageImpl)2 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Sort (org.springframework.data.domain.Sort)1 Transactional (org.springframework.transaction.annotation.Transactional)1