public abstract class ProcessStep extends ProcessFragment
RelationTypeModifier.TRANSIENT
set. Further
information about the serialization of processes can be found in the
documentation of class Process
.
A process step can be set to be wrapped inside a history group or a
transaction by setting one of the flags HistoryManager.HISTORIZED
or
MetaTypes.TRANSACTIONAL
, respectively. The execute()
method
will then be invoked after a transaction and a history group have been
started. History always includes a transaction to combine the writing of the
history and persistent changes by the step.
Modifier and Type | Field and Description |
---|---|
static org.obrel.core.RelationType<java.lang.String> |
NEXT_STEP
The next step's name
|
MSG_PARAM_NOT_SET
Constructor and Description |
---|
ProcessStep()
Default constructor, which must be provided by any subclass.
|
Modifier and Type | Method and Description |
---|---|
protected void |
abort()
This method will be invoked on the currently suspended step if the parent
process is rolled back.
|
void |
addDisplayParameters(java.util.Collection<? extends org.obrel.core.RelationType<?>> rParams)
Overridden to mark structure changes for legacy process interactions.
|
void |
addSubFragment(org.obrel.core.RelationType<java.util.List<org.obrel.core.RelationType<?>>> rFragmentParam,
InteractionFragment rSubFragment)
Overridden to mark structure changes for legacy process interactions.
|
protected void |
cancel()
This method is similar to the
rollback() method, but it is
invoked if the enclosing interactive process is canceled completely. |
protected boolean |
canRollback()
This method must be overridden by subclasses that support a rollback of
their processing.
|
protected boolean |
checkStopProcessExecution()
check whether the execution of this process should be stopped.
|
protected void |
cleanup()
This method will always be invoked at the end of a process (whether
successful or not) for all executed steps.
|
protected abstract void |
execute()
Executes the process step.
|
java.lang.String |
getName()
Returns the step's name.
|
protected java.lang.String |
getNextStep()
Returns the name of the next process step that shall be executed after
this one.
|
Process |
getProcess()
Returns the process that this fragment is associated with.
|
ProcessStep |
getProcessStep()
Implemented to return this instance.
|
protected void |
internalExecute()
Internal method to invoke the
execute() method. |
boolean |
isParameterModified(org.obrel.core.RelationType<?> rParam)
Checks whether a parameter has been modified by the process during the
last interaction cycle.
|
protected boolean |
needsInteraction()
Checks whether this step must be interrupted to perform an interaction to
query additional data.
|
protected void |
prepareContinuation()
This method can be overridden by (interactive) subclasses if an
interaction continuation occurs.
|
protected void |
prepareExecution()
Prepares the execution of this step in succession of the previous step by
invoking
prepareParameters() and prepareValues() . |
protected void |
prepareInteraction()
Prepares a re-execution of this step during an interaction by invoking
the method
prepareValues() and resets the interaction parameter. |
protected void |
prepareNewInteractionParameters(java.util.Collection<? extends org.obrel.core.RelationType<?>> rParams)
Prepares new interaction parameters for rendering.
|
protected void |
prepareParameters()
This method can be overridden to prepare this step's parameters for
execution.
|
protected void |
prepareValues()
This method can be overridden to prepare a step's parameter values after
their initialization in the method
prepareParameters() or to
update the values after an interaction occurred. |
void |
removeParameterModification(ParameterBase<?,?> rParam)
Removes the modification markers for a certain process parameter.
|
void |
removeParameterModification(org.obrel.core.RelationType<?> rParamType)
Removes the modification markers for a certain parameter relation type.
|
void |
resetParameterModifications()
Resets all parameter modification markers for this step.
|
protected void |
resetParameters()
Will be invoked by a process on a rollback to reset parameter
initializations performed by interactive steps.
|
protected boolean |
resume()
This method can be overridden to resume this step after the process had
been suspended.
|
protected void |
rollback()
Must be implemented by a subclass if it can perform a rollback of a
previous execution.
|
protected void |
setNextStep(java.lang.String sNextStepName)
Sets the name of the next process step that shall be executed after this
one.
|
protected void |
setup()
This method must be overridden by subclasses that require initialization.
|
protected <T> void |
throwMissingParameterException(org.obrel.core.RelationType<T> rParamType)
Throws a runtime exception that signals a missing process parameter.
|
java.lang.String |
toString() |
protected void |
validate()
Will be invoked to validate the step's parameters after an interaction
has occurred.
|
protected java.util.Map<org.obrel.core.RelationType<?>,java.lang.String> |
validateParameters(boolean bOnInteraction)
Invokes the validation functions that are stored in the process step
relations
ProcessRelationTypes.INTERACTION_PARAM_VALIDATIONS and
ProcessRelationTypes.PARAM_VALIDATIONS . |
addCleanupAction, addLayoutFiller, addPanel, addPanel, addPanelParameters, addProcessStepMessage, addSelectionDependency, addSelectionDependency, addStackPanel, addTabPanel, annotateForEntityQuery, annotateForEntityQuery, annotateParameter, applyDerivedParameter, applyDerivedParameters, applyExtraAttribute, changeDate, checkParameter, clearUIFlag, clearUIFlag, collectDerivedParameter, collectDerivedParameters, deleteParameters, disableElements, disableElements, disableElements, disableMultiSelectionElements, displayHistoryValue, enableAllElements, executeCleanupActions, getAbsoluteFilePath, getAllowedElements, getAllowedValues, getCurrentQuery, getDerivedParameterValue, getFragmentId, getInputMode, getInteractiveInputParameter, getNamedTmpListType, getNamedTmpParameterType, getParameter, getParameterAnnotation, getParameterRelation, getProcessUser, getSelectionIndex, getSubFragment, getSubFragments, getTemporaryListType, getTemporaryListType, getTemporaryParameterId, getTemporaryParameterName, getTemporaryParameterPackage, getTemporaryParameterType, getTemporaryParameterType, getTemporaryParameterType, getTemporarySetType, getUIProperties, getUIProperties, getUIProperty, getUserSetting, getUserSettings, hasFlagParameter, hasParameter, hasUIFlag, hasUserSetting, initChartParameter, initCountChartParameter, initProgressParameter, isInteractiveInput, isPanelParameter, lockEntity, markParameterAsModified, performParameterValidations, prepareDateInput, prepareDownload, prepareDownload, removeAllSubFragments, removeAllUIProperties, removeAllUIProperties, removeCleanupAction, removePanel, removeParameterAnnotation, removeSubFragment, removeSubFragment, removeTemporaryParameterType, removeUIProperties, setAllowedElements, setAllowedValues, setAllowedValues, setDatePeriod, setEnabled, setEnabled, setHtmlSize, setImmediateAction, setImmediateAction, setImmediateAction, setInteractive, setInteractive, setInteractive, setInteractive, setInteractive, setLayout, setParameter, setParameter, setParameterBounds, setProcessStepInfo, setProcessStepMessage, setProgressIndicator, setSelectionDependency, setSelectionDependency, setUIFlag, setUIFlag, setUIProperty, setUIProperty, setUIProperty, setUIProperty, setVisible, setVisible, spawnProcess, storeEntity, unlockEntity
addDisplayParameters, addInputParameters, addInputParameters, clearInteractionParameters, continueOnInteraction, getParameterValidations, hasInteractionParameter, markInputParams, markInputParams, params, removeAllParameterValidations, removeInteractionParameters, removeInteractionParameters, removeParameterValidations, removeParameterValidations, setContinueOnInteraction, setMandatory, setParameterNotEmptyValidations, setParameterNotEmptyValidations, setParameterNotNullValidations, setParameterNotNullValidations, setParameterValidation, setParameterValidation, staticParams
deleteRelation, get, getRelation, getRelations, notifyRelationListeners, readRelations, relationsEqual, relationsHashCode, relationsString, set, set, transform, writeRelations
public static final org.obrel.core.RelationType<java.lang.String> NEXT_STEP
public ProcessStep()
public void addDisplayParameters(java.util.Collection<? extends org.obrel.core.RelationType<?>> rParams)
addDisplayParameters
in class ProcessElement
rParams
- The parameter types to be displayedProcessElement.addDisplayParameters(Collection)
public void addSubFragment(org.obrel.core.RelationType<java.util.List<org.obrel.core.RelationType<?>>> rFragmentParam, InteractionFragment rSubFragment)
addSubFragment
in class ProcessFragment
rFragmentParam
- The interactive process parameter in which the
fragment will be displayedrSubFragment
- The fragment to addProcessFragment.addSubFragment(RelationType, InteractionFragment)
public final java.lang.String getName()
public final Process getProcess()
ProcessFragment
getProcess
in class ProcessFragment
ProcessFragment.getProcess()
public ProcessStep getProcessStep()
getProcessStep
in class ProcessFragment
ProcessFragment.getProcessStep()
public boolean isParameterModified(org.obrel.core.RelationType<?> rParam)
rParam
- The parameter to checkpublic void removeParameterModification(ParameterBase<?,?> rParam)
rParam
- The process parameterpublic void removeParameterModification(org.obrel.core.RelationType<?> rParamType)
rParamType
- The parameter relation typepublic void resetParameterModifications()
public java.lang.String toString()
toString
in class org.obrel.core.RelatedObject
Object.toString()
protected abstract void execute() throws java.lang.Exception
java.lang.Exception
- Any kind of exception may be thrown if executing the
step failsprotected void abort() throws java.lang.Exception
java.lang.Exception
- Any kind of exception can be thrownprotected void cancel() throws java.lang.Exception
rollback()
method, but it is
invoked if the enclosing interactive process is canceled completely.
Therefore it is not necessary to restore the process parameters in this
method. It only needs to be implemented if the process step needs to undo
a modification that has been performed on execution and which must not be
persistent if the process is canceled. This is an infrequent case because
in most cases this will be implemented differently, e.g. by making
persistent changes in the final, non-interactive steps of the process.
The default implementation does nothing.
java.lang.Exception
- Any kind of exception may be thrown if canceling failsprotected boolean canRollback()
rollback()
with the rollback functionality.
This default implementation always returns FALSE.
protected boolean checkStopProcessExecution()
protected void cleanup()
protected java.lang.String getNextStep()
protected void internalExecute() throws java.lang.Exception
execute()
method. Should only be
invoked by framework classes.java.lang.Exception
- Any exception may be thrown by subclassesprotected boolean needsInteraction() throws java.lang.Exception
MetaTypes.INTERACTIVE
is set to TRUE and at least one
interaction parameter is present.java.lang.Exception
- Any exception may be thrown by subclassesprotected void prepareContinuation() throws java.lang.Exception
ProcessRelationTypes.CONTINUATION_PARAMS
. The
framework stores the corresponding parameter into ProcessRelationTypes.CONTINUATION_PARAM
before this method will be
invoked.
The default implementation does nothing.
java.lang.Exception
- Any exception may be thrownprotected void prepareExecution() throws java.lang.Exception
prepareParameters()
and prepareValues()
. This
method should only be overridden by framework classes.java.lang.Exception
- Any exception may be thrownprotected void prepareInteraction() throws java.lang.Exception
prepareValues()
and resets the interaction parameter.
This method should only be overridden by framework classes.java.lang.Exception
- Any exception may be thrownprotected void prepareNewInteractionParameters(java.util.Collection<? extends org.obrel.core.RelationType<?>> rParams)
rParams
- protected void prepareParameters() throws java.lang.Exception
prepareValues()
will be
invoked.java.lang.Exception
- Any exception may be thrown if the preparation failsprotected void prepareValues() throws java.lang.Exception
prepareParameters()
or to
update the values after an interaction occurred.java.lang.Exception
- Any exception may be thrown if the preparation failsprotected void resetParameters() throws java.lang.Exception
rollback()
method is invoked.java.lang.Exception
- Any exception may be thrown if the reset failsprotected boolean resume() throws java.lang.Exception
execute()
method
is called when the process had been suspended by this step after a
previous call to the prepareParameters()
method. A possible
application would be to collect the user input from the parameters for an
interactive step.
If the method is invoked after an interactive input occurred the interaction parameter will still be set. It will be reset automatically before the process continues the execution.
java.lang.Exception
- Any exception may be thrown if resuming the step failsprotected void rollback() throws java.lang.Exception
canRollback()
method.
A successful rollback must leave this step in a state that allows it
and the following steps in the enclosing process to be executed again. On
re-execution, the method prepareParameters()
will be invoked
again too before execution. Basically, after a rollback the parameters of
the enclosing process should be in the same state as they had been before
the execution of this step.
This default implementation always throws a ProcessException
stating that a rollback is not supported.
java.lang.Exception
- Any exception may be thrown if the rollback failsprotected void setNextStep(java.lang.String sNextStepName)
sNextStepName
- The name of the next process stepprotected void setup() throws ProcessException
ProcessException
- Can be thrown by subclasses if the
initialization failsprotected <T> void throwMissingParameterException(org.obrel.core.RelationType<T> rParamType)
throwMissingParameterException
in class ProcessFragment
rParamType
- The relation type of the missing parameterprotected void validate() throws java.lang.Exception
ProcessRelationTypes.PARAM_VALIDATIONS
and throws an
InvalidParametersException
if at least one validation fails.
Subclasses can override this method to implement their own validations
but should in most cases also invoke the superclass method.
The validation will not occur if an interactive input parameter exists
and the method ProcessElement.continueOnInteraction(RelationType...)
returns
FALSE because then this step will be prepared and executed again to
continue with the current interaction. Validation only occurs on the
transition to the next step.
InvalidParametersException
- If a preset parameter validation failsjava.lang.Exception
- Any exception may be thrown if the
validation failsprotected java.util.Map<org.obrel.core.RelationType<?>,java.lang.String> validateParameters(boolean bOnInteraction)
ProcessRelationTypes.INTERACTION_PARAM_VALIDATIONS
and
ProcessRelationTypes.PARAM_VALIDATIONS
. It can be overridden by
subclasses to perform more complex parameter validations that cannot be
described by a single validation function. It returns a mapping from
invalid parameters to the corresponding error messages if at least one
parameter validation fails. If no error occurs the returned map will be
empty.
Subclasses should normally invoke the superclass method and add their own error message to the returned map if necessary. That allows the user interface of interactive steps to display all failures at once.
bOnInteraction
- TRUE if the validation occurs during an
interaction and FALSE if it occurs when the
process progresses to the next step