Module org.cruk.clarity.api
Class ClarityProcessAutomationImpl
java.lang.Object
org.cruk.clarity.api.automation.impl.ClarityProcessAutomationImpl
- All Implemented Interfaces:
ClarityProcessAutomation
Helper for moving Clarity processes through their stages
using the "click through" newer methods rather than the API's
ExecutableProcess
end point.- Since:
- 2.31.2
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
advanceStep
(ProcessStep step) Move a process step on to the next stage.beginProcessStep
(StepCreation stepCreation) Start a protocol step as if running through Clarity.findProtocol
(String name) Find a protocol by name.Find a stage in a work flow by name.Find a step in a protocol by name.findWorkflow
(String name) Find a work flow by name.int
getWait()
Get the time to wait between polls.int
Get the number of times to ask for a state change before stopping.void
setClarityAPI
(ClarityAPI api) Set the API.void
setWait
(int wait) Set the wait time between polls.void
setWaitAttempts
(int waitAttempts) Set the number of times to ask for a state change before stopping.startProgram
(AvailableProgram program) Start execution of an EPP as part of a process step moving through Clarity.void
waitUntilProcessInState
(ProcessStep step, ProcessState desiredState) Wait until a process has reached a certain state.void
waitUntilProgramCompletes
(AvailableProgram program, ProgramStatus status) Wait for an EPP to finish running.
-
Field Details
-
logger
Logger. -
api
Clarity API.
-
-
Constructor Details
-
ClarityProcessAutomationImpl
public ClarityProcessAutomationImpl()Constructor. -
ClarityProcessAutomationImpl
Constructor.- Parameters:
api
- The Clarity API.
-
-
Method Details
-
setClarityAPI
Set the API.- Parameters:
api
- The Clarity API.
-
getWait
public int getWait()Get the time to wait between polls.- Specified by:
getWait
in interfaceClarityProcessAutomation
- Returns:
- The wait time, in milliseconds.
-
setWait
public void setWait(int wait) Set the wait time between polls.- Specified by:
setWait
in interfaceClarityProcessAutomation
- Parameters:
wait
- The wait time, in milliseconds.
-
getWaitAttempts
public int getWaitAttempts()Get the number of times to ask for a state change before stopping.- Specified by:
getWaitAttempts
in interfaceClarityProcessAutomation
- Returns:
- The number of polls.
-
setWaitAttempts
public void setWaitAttempts(int waitAttempts) Set the number of times to ask for a state change before stopping.- Specified by:
setWaitAttempts
in interfaceClarityProcessAutomation
- Parameters:
waitAttempts
- The number of polls.
-
beginProcessStep
Start a protocol step as if running through Clarity. This is a call through to the same method on the Java client API, provided here to allow the whole process to be run through this utility.- Specified by:
beginProcessStep
in interfaceClarityProcessAutomation
- Parameters:
stepCreation
- The step creation object. See Genologics' API documentation.- Returns:
- The
ProcessStep
object for the step started. - See Also:
-
advanceStep
Move a process step on to the next stage. Tries this a number of times, testing and waiting for that change to complete.- Specified by:
advanceStep
in interfaceClarityProcessAutomation
- Parameters:
step
- The step to advance.- Throws:
InterruptedException
- if the thread is interrupted while waiting for the state to change.- See Also:
-
waitUntilProcessInState
public void waitUntilProcessInState(ProcessStep step, ProcessState desiredState) throws InterruptedException Wait until a process has reached a certain state. Tries this a number of times, testing and waiting for the state to reach that asked for.- Specified by:
waitUntilProcessInState
in interfaceClarityProcessAutomation
- Parameters:
step
- The step to advance.desiredState
- The state we're waiting for.- Throws:
InterruptedException
- if the thread is interrupted while waiting for the state to change.
-
startProgram
Start execution of an EPP as part of a process step moving through Clarity. This is a call through to the same method on the Java client API, provide here to allow the whole program to be run through this utility.- Specified by:
startProgram
in interfaceClarityProcessAutomation
- Parameters:
program
- The program, as listed in theProcessStep
object.- Returns:
- An updated program status structure.
- See Also:
-
waitUntilProgramCompletes
public void waitUntilProgramCompletes(AvailableProgram program, ProgramStatus status) throws InterruptedException Wait for an EPP to finish running. Tries this a number of times, testing and waiting for the program to finish.- Specified by:
waitUntilProgramCompletes
in interfaceClarityProcessAutomation
- Parameters:
program
- The program that is being run.status
- The program status object. This is updated in place.- Throws:
InterruptedException
- if the thread is interrupted while waiting for the program to end.
-
findWorkflow
Find a work flow by name.- Specified by:
findWorkflow
in interfaceClarityProcessAutomation
- Parameters:
name
- The name of the work flow.- Returns:
- The Workflow object.
-
findStage
Find a stage in a work flow by name.- Specified by:
findStage
in interfaceClarityProcessAutomation
- Parameters:
workflow
- The workflow object.name
- The name of the stage.- Returns:
- The Stage object.
-
findProtocol
Find a protocol by name.- Specified by:
findProtocol
in interfaceClarityProcessAutomation
- Parameters:
name
- The name of the protocol.- Returns:
- The Protocol object.
-
findStep
Find a step in a protocol by name.- Specified by:
findStep
in interfaceClarityProcessAutomation
- Parameters:
protocol
- The protocol object.name
- The name of the step.- Returns:
- The ProtocolStep object.
-