Class IridaWorkflowsService
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.workflow.IridaWorkflowsService
-
@Service public class IridaWorkflowsService extends java.lang.Object
Class used to load up installed workflows in IRIDA.
-
-
Constructor Summary
Constructors Constructor Description IridaWorkflowsService(IridaWorkflowSet iridaWorkflows, IridaWorkflowIdSet defaultIridaWorkflows)
Builds a newIridaWorkflowsService
for loading up installed workflows.IridaWorkflowsService(IridaWorkflowSet iridaWorkflows, IridaWorkflowIdSet defaultIridaWorkflows, AnalysisTypeSet disabledAnalysisTypes)
Builds a newIridaWorkflowsService
for loading up installed workflows.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<AnalysisType,IridaWorkflow>
getAllDefaultWorkflowsByType(java.util.Set<AnalysisType> analysisTypes)
Gets all of the default workflows for a givenSet
ofAnalysisType
s.java.util.Set<IridaWorkflow>
getAllWorkflowsByType(AnalysisType analysisType)
Gets all the workflows for a givenAnalysisType
.IridaWorkflow
getDefaultWorkflowByType(AnalysisType analysisType)
Gets the default workflow for a given type of analysis.IridaWorkflow
getDisplayableIridaWorkflow(java.util.UUID workflowId)
Returns a workflow with the given id that is displayable.java.util.Set<AnalysisType>
getDisplayableWorkflowTypes()
Gets aSet
of disabledAnalysisType
s.IridaWorkflow
getIridaWorkflow(java.util.UUID workflowId)
Returns a workflow with the given id.IridaWorkflow
getIridaWorkflowOrUnknown(AnalysisSubmission analysisSubmission)
Returns a workflow associated with the givenAnalysisSubmission
, attempting to fill in as many details as possible if the workflow can't be found.IridaWorkflow
getIridaWorkflowOrUnknown(java.util.UUID iridaWorkflowId)
Returns a workflow associated with the givenUUID
, attempting to fill in as many details as possible if the workflow can't be found.java.util.List<java.lang.String>
getOutputNames(java.util.UUID workflowId)
Get list of workflow output names.java.util.Set<IridaWorkflow>
getRegisteredWorkflows()
Gets aSet
of all installed workflows.java.util.Set<AnalysisType>
getRegisteredWorkflowTypes()
Gets aSet
of all registeredAnalysisType
for all workflows.java.util.Set<java.util.UUID>
getSingleSampleWorkflows()
Get all registered single-sample workflow UUIDs for retrievingAnalysisOutputFile
info with a 1-to-1 mapping to aSample
void
registerWorkflow(IridaWorkflow iridaWorkflow)
Registers the given workflow with this service.void
registerWorkflows(java.util.Set<IridaWorkflow> iridaWorkflows)
Registers the set of workflows with IRIDA.void
setDefaultWorkflow(java.util.UUID workflowId)
Sets the given workflow as a default workflow for it's analysis type.void
setDefaultWorkflows(java.util.Set<java.util.UUID> defaultWorkflows)
Sets the given set of workflow ids as default workflows.
-
-
-
Constructor Detail
-
IridaWorkflowsService
public IridaWorkflowsService(IridaWorkflowSet iridaWorkflows, IridaWorkflowIdSet defaultIridaWorkflows) throws IridaWorkflowException
Builds a newIridaWorkflowsService
for loading up installed workflows.- Parameters:
iridaWorkflows
- AIridaWorkflowSet
ofIridaWorkflow
s to use in IRIDA.defaultIridaWorkflows
- AIridaWorkflowIdSet
ofUUID
s to use as the default workflows.- Throws:
IridaWorkflowException
- If there was an issue when attempting to register the workflows.
-
IridaWorkflowsService
@Autowired public IridaWorkflowsService(IridaWorkflowSet iridaWorkflows, IridaWorkflowIdSet defaultIridaWorkflows, AnalysisTypeSet disabledAnalysisTypes) throws IridaWorkflowException
Builds a newIridaWorkflowsService
for loading up installed workflows.- Parameters:
iridaWorkflows
- AIridaWorkflowSet
ofIridaWorkflow
s to use in IRIDA.defaultIridaWorkflows
- AIridaWorkflowIdSet
ofUUID
s to use as the default workflows.disabledAnalysisTypes
- ASet
of disabledAnalysisType
s.- Throws:
IridaWorkflowException
- If there was an issue when attempting to register the workflows.
-
-
Method Detail
-
setDefaultWorkflow
public void setDefaultWorkflow(java.util.UUID workflowId) throws IridaWorkflowNotFoundException, IridaWorkflowDefaultException
Sets the given workflow as a default workflow for it's analysis type.- Parameters:
workflowId
- The workflow id to set as default.- Throws:
IridaWorkflowNotFoundException
- If the given workflow cannot be found.IridaWorkflowDefaultException
- If the corresponding workflow type already has a default workflow set.
-
setDefaultWorkflows
public void setDefaultWorkflows(java.util.Set<java.util.UUID> defaultWorkflows) throws IridaWorkflowNotFoundException, IridaWorkflowDefaultException
Sets the given set of workflow ids as default workflows.- Parameters:
defaultWorkflows
- The set of workflow ids to set as defaults.- Throws:
IridaWorkflowNotFoundException
- If one of the workflow ids has no corresponding workflow.IridaWorkflowDefaultException
- If there was an issue setting a default workflow.
-
registerWorkflows
public void registerWorkflows(java.util.Set<IridaWorkflow> iridaWorkflows) throws IridaWorkflowException
Registers the set of workflows with IRIDA.- Parameters:
iridaWorkflows
- The set of workflows to register.- Throws:
IridaWorkflowException
- If there was an issue registering a workflow.
-
registerWorkflow
public void registerWorkflow(IridaWorkflow iridaWorkflow) throws IridaWorkflowException
Registers the given workflow with this service.- Parameters:
iridaWorkflow
- The workflow to register.- Throws:
IridaWorkflowException
- If there was an issue when registering the workflow.
-
getDefaultWorkflowByType
public IridaWorkflow getDefaultWorkflowByType(AnalysisType analysisType) throws IridaWorkflowNotFoundException
Gets the default workflow for a given type of analysis.- Parameters:
analysisType
- The type of analysis to search for.- Returns:
- An
IridaWorkflow
for this analysis type. - Throws:
IridaWorkflowNotFoundException
- if the workflow could not be found for the specified analysis type.
-
getAllDefaultWorkflowsByType
public java.util.Map<AnalysisType,IridaWorkflow> getAllDefaultWorkflowsByType(java.util.Set<AnalysisType> analysisTypes) throws IridaWorkflowNotFoundException
Gets all of the default workflows for a givenSet
ofAnalysisType
s.- Parameters:
analysisTypes
- ASet
ofAnalysisType
s.- Returns:
- A
Map
ofAnalysisType
toIridaWorkflow
all the passed analysis types. - Throws:
IridaWorkflowNotFoundException
- If one of the analysis types does not have any associated workflows.
-
getAllWorkflowsByType
public java.util.Set<IridaWorkflow> getAllWorkflowsByType(AnalysisType analysisType) throws IridaWorkflowNotFoundException
Gets all the workflows for a givenAnalysisType
.- Parameters:
analysisType
- TheAnalysisType
to search for workflows.- Returns:
- A
Set
ofIridaWorkflow
s for this analysis type. - Throws:
IridaWorkflowNotFoundException
- If not corresponding workflows could not be found.
-
getRegisteredWorkflowTypes
public java.util.Set<AnalysisType> getRegisteredWorkflowTypes()
Gets aSet
of all registeredAnalysisType
for all workflows.- Returns:
- A
Set
of all the types of all installed workflows.
-
getDisplayableWorkflowTypes
public java.util.Set<AnalysisType> getDisplayableWorkflowTypes()
Gets aSet
of disabledAnalysisType
s.- Returns:
- A
Set
of disabledAnalysisType
s.
-
getIridaWorkflow
public IridaWorkflow getIridaWorkflow(java.util.UUID workflowId) throws IridaWorkflowNotFoundException
Returns a workflow with the given id.- Parameters:
workflowId
- The identifier of the workflow to get.- Returns:
- An
IridaWorkflow
with the given identifier. - Throws:
IridaWorkflowNotFoundException
- If no workflow with the given identifier was found.
-
getDisplayableIridaWorkflow
public IridaWorkflow getDisplayableIridaWorkflow(java.util.UUID workflowId) throws IridaWorkflowNotDisplayableException, IridaWorkflowNotFoundException
Returns a workflow with the given id that is displayable.- Parameters:
workflowId
- The identifier of the workflow to get.- Returns:
- An
IridaWorkflow
with the given identifier that is displayable. - Throws:
IridaWorkflowNotDisplayableException
- If no workflow with the given identifier is not displayable.IridaWorkflowNotFoundException
- If the workflow was not found.
-
getOutputNames
public java.util.List<java.lang.String> getOutputNames(java.util.UUID workflowId) throws IridaWorkflowNotFoundException
Get list of workflow output names.- Parameters:
workflowId
- Workflow UUID.- Returns:
- List of workflow output names.
- Throws:
IridaWorkflowNotFoundException
- if no workflow with the given UUID found.
-
getRegisteredWorkflows
public java.util.Set<IridaWorkflow> getRegisteredWorkflows()
Gets aSet
of all installed workflows.- Returns:
- A
Set
of all installed workflows.
-
getSingleSampleWorkflows
public java.util.Set<java.util.UUID> getSingleSampleWorkflows()
Get all registered single-sample workflow UUIDs for retrievingAnalysisOutputFile
info with a 1-to-1 mapping to aSample
Since all automated analyses and many other pipelines at this time produce results that map 1-to-1 to a
Sample
and it is trivial to download multi-sample, collection-typeAnalysisOutputFile
s (they are zipped and contain all output for all Sample inputs), we want to enable easy retrieval of results for single-sample pipelines for batch download.- Returns:
- UUIDs for single-sample workflows
-
getIridaWorkflowOrUnknown
public IridaWorkflow getIridaWorkflowOrUnknown(java.util.UUID iridaWorkflowId)
Returns a workflow associated with the givenUUID
, attempting to fill in as many details as possible if the workflow can't be found.- Parameters:
iridaWorkflowId
- TheUUID
object to search for a workflow.- Returns:
- An
IridaWorkflow
with the given submission, or an 'unknown' workflow object if the associated workflow is not found.
-
getIridaWorkflowOrUnknown
public IridaWorkflow getIridaWorkflowOrUnknown(AnalysisSubmission analysisSubmission)
Returns a workflow associated with the givenAnalysisSubmission
, attempting to fill in as many details as possible if the workflow can't be found.- Parameters:
analysisSubmission
- TheAnalysisSubmission
object to search for a workflow.- Returns:
- An
IridaWorkflow
with the given submission, or an 'unknown' workflow object if the associated workflow is not found.
-
-