Search in sources :

Example 1 with IridaWorkflowDefaultException

use of ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowDefaultException in project irida by phac-nml.

the class IridaWorkflowsService method setDefaultWorkflow.

/**
 * Sets the given workflow as a default workflow for it's analysis type.
 *
 * @param workflowId
 *            The workflow id to set as default.
 * @throws IridaWorkflowNotFoundException
 *             If the given workflow cannot be found.
 * @throws IridaWorkflowDefaultException
 *             If the corresponding workflow type already has a default
 *             workflow set.
 */
public void setDefaultWorkflow(UUID workflowId) throws IridaWorkflowNotFoundException, IridaWorkflowDefaultException {
    checkNotNull(workflowId, "workflowId is null");
    IridaWorkflow iridaWorkflow = getIridaWorkflow(workflowId);
    AnalysisType analysisType = iridaWorkflow.getWorkflowDescription().getAnalysisType();
    if (defaultWorkflowForAnalysis.containsKey(analysisType)) {
        throw new IridaWorkflowDefaultException("Cannot set workflow " + workflowId + " as default, already exists default workflow for \"" + analysisType + "\"");
    } else {
        defaultWorkflowForAnalysis.put(analysisType, workflowId);
    }
}
Also used : AnalysisType(ca.corefacility.bioinformatics.irida.model.enums.AnalysisType) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) IridaWorkflowDefaultException(ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowDefaultException)

Aggregations

IridaWorkflowDefaultException (ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowDefaultException)1 AnalysisType (ca.corefacility.bioinformatics.irida.model.enums.AnalysisType)1 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)1