use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.config.DataTablesRequest in project irida by phac-nml.
the class ProjectExportController method getExportsForProject.
/**
* Ajax method for getting the {@link NcbiExportSubmission}s for a given
* {@link Project}
*
* @param projectId {@link Project} id
* @param params Parameters from the datatables request
* @return DatatablesResponse of Map of submission params
*/
@RequestMapping("/ajax/projects/{projectId}/export/list")
@ResponseBody
public DataTablesResponse getExportsForProject(@DataTablesRequest DataTablesParams params, @PathVariable Long projectId) {
Project project = projectService.read(projectId);
List<NcbiExportSubmission> submissions = exportSubmissionService.getSubmissionsForProject(project);
List<DataTablesResponseModel> dtExportSubmissions = submissions.stream().map(s -> new DTExportSubmission(s)).collect(Collectors.toList());
return new DataTablesResponse(params, submissions.size(), dtExportSubmissions);
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.config.DataTablesRequest in project irida by phac-nml.
the class AnnouncementsController method getUserAnnouncementInfoTable.
/**
* Get user read status for current announcement
* @param announcementID {@link Long} identifier for the {@link Announcement}
* @param params {@link DataTablesParams} parameters for current DataTable
* @return {@link DataTablesResponse} containing the list of users.
*/
@RequestMapping(value = "/{announcementID}/details/ajax/list", method = RequestMethod.GET)
@PreAuthorize("hasRole('ROLE_ADMIN')")
@ResponseBody
public DataTablesResponse getUserAnnouncementInfoTable(@PathVariable Long announcementID, @DataTablesRequest final DataTablesParams params) {
final Announcement currentAnnouncement = announcementService.read(announcementID);
final Page<User> page = userService.search(UserSpecification.searchUser(params.getSearchValue()), new PageRequest(params.getCurrentPage(), params.getLength(), params.getSort()));
final List<DataTablesResponseModel> announcementUsers = page.getContent().stream().map(user -> new DTAnnouncementUser(user, userHasRead(user, currentAnnouncement))).collect(Collectors.toList());
return new DataTablesResponse(params, page, announcementUsers);
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.config.DataTablesRequest in project irida by phac-nml.
the class GroupsController method getGroups.
/**
* Search/filter/page with datatables for {@link UserGroup}.
* @param params {@link DataTablesParams} for the current DataTable
* @param principal Currently logged in user
* @return {@link DataTablesResponse} for the current table base on the parameters.
*/
@RequestMapping("/ajax/list")
@ResponseBody
public DataTablesResponse getGroups(@DataTablesRequest final DataTablesParams params, final Principal principal) {
Page<UserGroup> groups = userGroupService.search(UserGroupSpecification.searchUserGroup(params.getSearchValue()), new PageRequest(params.getCurrentPage(), params.getLength(), params.getSort()));
User currentUser = userService.getUserByUsername(principal.getName());
List<DataTablesResponseModel> groupsWithOwnership = groups.getContent().stream().map(ug -> new DTUserGroup(ug, isGroupOwner(currentUser, ug), currentUser.getSystemRole().equals(Role.ROLE_ADMIN))).collect(Collectors.toList());
return new DataTablesResponse(params, groups, groupsWithOwnership);
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.config.DataTablesRequest in project irida by phac-nml.
the class SequencingRunController method listSequencingRuns.
/**
* Get a list of all the sequencing runs
*
* @param params a {@link DataTablesParams} of the sort and paging options
* @param locale the locale used by the browser for the current request.
* @return A DatatablesResponse of DTSequencingRun of the runs
*/
@RequestMapping(value = "/ajax/list")
@ResponseBody
public DataTablesResponse listSequencingRuns(@DataTablesRequest DataTablesParams params, Locale locale) {
Sort sort = params.getSort();
Page<SequencingRun> list = sequencingRunService.list(params.getCurrentPage(), params.getLength(), sort);
List<DTSequencingRun> runs = list.getContent().stream().map(s -> new DTSequencingRun(s, messageSource.getMessage(UPLOAD_STATUS_MESSAGE_BASE + s.getUploadStatus().toString(), null, locale))).collect(Collectors.toList());
return new DataTablesResponse(params, list, runs);
}
Aggregations