Package co.ecg.alpaca.toolkit.task
Class IterableProcess<T extends IterableProcess<T,E>,E extends java.lang.Enum<E>>
java.lang.Object
co.ecg.alpaca.toolkit.task.GenericProcess
co.ecg.alpaca.toolkit.task.IterableProcess<T,E>
- All Implemented Interfaces:
Loggable
- Direct Known Subclasses:
BroadWorksProcess
public abstract class IterableProcess<T extends IterableProcess<T,E>,E extends java.lang.Enum<E>> extends GenericProcess
An abstract iterable process in which the process execution can occur through steps defined in an enumeration.
- Author:
- Matthew Keathley on 5/23/16.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description IterableProcess(GenericProcess parentProcess, java.lang.Class<E> stepClazz)
Creates an iterable process with the provided BroadWorksServer and step class enum.IterableProcess(java.lang.String processId, java.lang.Class<E> stepClazz)
Creates an iterable process with the provided BroadWorksServer and step class enum. -
Method Summary
Modifier and Type Method Description T
addStep(E... step)
Adds the provided step(s) to the step list.T
addStep(E step, java.lang.Object[] data)
Adds the provided step with additional data.T
all()
Perform All StepsT
allBut(E... step)
Perform all Steps except the listed stepsint
getStepCount()
Returns the current step count.boolean
isConcurrent()
Returns true IFF the process is allowed to return before completingT
only(E... step)
Adds the provided step(s) to the step list after clearing the list.void
onStep(java.util.function.Consumer<java.lang.Integer> onStepConsumer)
Set call back to occur on step changeT
removeStep(E... step)
Removes the provided step(s) to the step list.T
setConcurrent(boolean concurrent)
Sets if the operation should return before the underyling threads have completedprotected void
step()
Increments the step count.protected boolean
step(E... step)
Checks if any of the steps in the parameter list have been added to the step list.Methods inherited from class co.ecg.alpaca.toolkit.task.GenericProcess
addError, addError, addWarning, addWarning, checkValidity, errorCount, exception, exception, fail, getErrors, getLogIdentifier, getParentProcess, getProcessContext, getProcessId, getReport, getReportList, getReportList, getWarnings, hasErrors, hasWarnings, isDescendantOf, isError, isError, isError, isErrorsAsWarnings, printReport, setErrorsAsWarnings, setExceptionOnErrors, setParentProcess, setProcessId
-
Field Details
-
Constructor Details
-
IterableProcess
Creates an iterable process with the provided BroadWorksServer and step class enum.- Parameters:
parentProcess
- The parent process.stepClazz
- The class of the step enumeration list.
-
IterableProcess
Creates an iterable process with the provided BroadWorksServer and step class enum.- Parameters:
processId
- The process ID for this iterable process.stepClazz
- The class of the step enumeration list.
-
-
Method Details
-
step
protected final void step()Increments the step count. Used for finishing the iterable process. -
step
Checks if any of the steps in the parameter list have been added to the step list.- Parameters:
step
- The steps to check for existence in the step list.- Returns:
- True IFF the step list contains a provided step.
-
all
Perform All Steps- Returns:
- IterableProcess
-
allBut
Perform all Steps except the listed steps- Returns:
- IterableProcess
-
only
Adds the provided step(s) to the step list after clearing the list.- Returns:
- IterableProcess
-
addStep
Adds the provided step(s) to the step list.- Returns:
- IterableProcess
-
addStep
Adds the provided step with additional data.- Returns:
- IterableProcess
-
isConcurrent
public boolean isConcurrent()Returns true IFF the process is allowed to return before completing- Returns:
- A boolean value of isConcurrent
-
setConcurrent
Sets if the operation should return before the underyling threads have completed- Parameters:
concurrent
- The desired concurrency value- Returns:
- IterableProcess
-
removeStep
Removes the provided step(s) to the step list.- Returns:
- IterableProcess
-
getStepCount
public int getStepCount()Returns the current step count.- Returns:
- The step count as an int.
-
onStep
public void onStep(java.util.function.Consumer<java.lang.Integer> onStepConsumer)Set call back to occur on step change
-