use of ca.corefacility.bioinformatics.irida.model.enums.AnalysisType in project irida by phac-nml.
the class AnalysesListingService method getPagedSubmissions.
/**
* Get a {@link DataTablesResponse} for {@link AnalysisSubmission}s based upon the {@link User}, and the {@link Project}
*
* @param params {@link DataTablesParams}
* @param locale {@link Locale}
* @param user {@link User}
* @param project {@link Project}
* @return {@link DataTablesResponse}
* @throws IridaWorkflowNotFoundException If the requested workflow doesn't exist
* @throws ExecutionManagerException If the submission cannot be read properly
*/
public DataTablesResponse getPagedSubmissions(DataTablesParams params, Locale locale, User user, Project project) throws IridaWorkflowNotFoundException, ExecutionManagerException {
/*
Check the DataTableParams to see if any search conditions are present
*/
Map<String, String> searchMap = params.getSearchMap();
AnalysisState state = searchMap.containsKey("analysisState") ? AnalysisState.valueOf(searchMap.get("analysisState")) : null;
String name = searchMap.getOrDefault("name", null);
/*
Workflow Ids are a special consideration.
The actual ids need to be look up based on the name passed.
*/
Set<UUID> workflowIds = null;
if (searchMap.containsKey("workflow")) {
AnalysisType workflowType = AnalysisType.fromString(searchMap.get("workflow"));
Set<IridaWorkflow> workflows = iridaWorkflowsService.getAllWorkflowsByType(workflowType);
workflowIds = workflows.stream().map(IridaWorkflow::getWorkflowIdentifier).collect(Collectors.toSet());
}
Page<AnalysisSubmission> page;
PageRequest pageRequest = new PageRequest(params.getCurrentPage(), params.getLength(), params.getSort());
if (user != null) {
// if user is set, get submissions for the user
page = analysisSubmissionService.listSubmissionsForUser(params.getSearchValue(), name, state, user, workflowIds, pageRequest);
} else if (project != null) {
// if the project is set, get submissions for the project
page = analysisSubmissionService.listSubmissionsForProject(params.getSearchValue(), name, state, workflowIds, project, pageRequest);
} else {
// if neither is set, get admin page
page = analysisSubmissionService.listAllSubmissions(params.getSearchValue(), name, state, workflowIds, pageRequest);
}
/*
IRIDA DataTables response expects and object that implements the DataTablesResponseModel interface.
*/
List<DataTablesResponseModel> data = new ArrayList<>();
for (AnalysisSubmission submission : page.getContent()) {
// Each AnalysisSubmission needs to be converted into a DTAnalysis.
data.add(createDataTablesAnalysis(submission, locale));
}
return new DataTablesResponse(params, page, data);
}
use of ca.corefacility.bioinformatics.irida.model.enums.AnalysisType in project irida by phac-nml.
the class PipelineController method getPipelineLaunchPage.
/**
* Get the Pipeline Selection Page
*
* @param model
* {@link Model}
* @param locale
* Current users {@link Locale}
*
* @return location of the pipeline selection page.
*/
@RequestMapping
public String getPipelineLaunchPage(final Model model, Locale locale) {
Set<AnalysisType> workflows = workflowsService.getRegisteredWorkflowTypes();
List<Map<String, String>> flows = new ArrayList<>(workflows.size());
workflows.stream().forEach(type -> {
IridaWorkflow flow = null;
try {
flow = workflowsService.getDefaultWorkflowByType(type);
IridaWorkflowDescription description = flow.getWorkflowDescription();
String name = type.toString();
String key = "workflow." + name;
flows.add(ImmutableMap.of("name", name, "id", description.getId().toString(), "title", messageSource.getMessage(key + ".title", null, locale), "description", messageSource.getMessage(key + ".description", null, locale)));
} catch (IridaWorkflowNotFoundException e) {
logger.error("Workflow not found - See stack:", e);
}
});
flows.sort((f1, f2) -> f1.get("name").compareTo(f2.get("name")));
model.addAttribute("counts", getCartSummaryMap());
model.addAttribute("workflows", flows);
return URL_LAUNCH;
}
Aggregations