Klasse ProcessStep

java.lang.Object
org.obrel.core.RelatedObject
org.obrel.core.SerializableRelatedObject
Alle implementierten Schnittstellen:
Serializable, org.obrel.core.Relatable
Bekannte direkte Unterklassen:
BranchStep, DisposeResource, EntityStep, FunctionStep, PerformStorageQuery, RollbackStep, SubProcessStep, SwitchStep, TransferParam

public abstract class ProcessStep extends ProcessFragment
Base class for all kinds of process steps. This class is serializable and uses the default serialized form. Subclasses must declare a serialVersionUID field and implement correct serialization of any fields that they define. In general it is recommended that subclasses don't define fields but use relations instead. The types of all relations that shall not be serialized must have the flag 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.

Siehe auch:
  • Felddetails

    • NEXT_STEP

      public static final org.obrel.core.RelationType<String> NEXT_STEP
      The next step's name
  • Konstruktordetails

    • ProcessStep

      public ProcessStep()
      Default constructor, which must be provided by any subclass.
  • Methodendetails

    • addDisplayParameters

      public void addDisplayParameters(Collection<? extends org.obrel.core.RelationType<?>> params)
      Overridden to mark structure changes for legacy process interactions.
      Setzt außer Kraft:
      addDisplayParameters in Klasse ProcessElement
      Parameter:
      params - The parameter types to be displayed
      Siehe auch:
    • addSubFragment

      public void addSubFragment(org.obrel.core.RelationType<List<org.obrel.core.RelationType<?>>> fragmentParam, InteractionFragment subFragment)
      Overridden to mark structure changes for legacy process interactions.
      Setzt außer Kraft:
      addSubFragment in Klasse ProcessFragment
      Parameter:
      fragmentParam - The interactive process parameter in which the fragment will be displayed
      subFragment - The fragment to add
      Siehe auch:
    • getName

      public final String getName()
      Returns the step's name.
      Gibt zurück:
      The step's name
    • getProcess

      public final Process getProcess()
      Beschreibung aus Klasse kopiert: ProcessFragment
      Returns the process that this fragment is associated with.
      Angegeben von:
      getProcess in Klasse ProcessFragment
      Gibt zurück:
      The process of this fragment
      Siehe auch:
    • getProcessStep

      public ProcessStep getProcessStep()
      Implemented to return this instance.
      Angegeben von:
      getProcessStep in Klasse ProcessFragment
      Gibt zurück:
      The process step of this fragment
      Siehe auch:
    • isParameterModified

      public boolean isParameterModified(org.obrel.core.RelationType<?> param)
      Checks whether a parameter has been modified by the process during the last interaction cycle.
      Parameter:
      param - The parameter to check
      Gibt zurück:
      TRUE if the parameter has been modified
    • removeParameterModification

      public void removeParameterModification(ParameterBase<?,?> param)
      Removes the modification markers for a certain process parameter.
      Parameter:
      param - The process parameter
    • removeParameterModification

      public void removeParameterModification(org.obrel.core.RelationType<?> paramType)
      Removes the modification markers for a certain parameter relation type.
      Parameter:
      paramType - The parameter relation type
    • resetParameterModifications

      public void resetParameterModifications()
      Resets all parameter modification markers for this step.
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse org.obrel.core.RelatedObject
      Siehe auch:
    • abort

      protected void abort() throws Exception
      This method will be invoked on the currently suspended step if the parent process is rolled back. Most step implementations won't need to override this method. It is intended only for special steps that perform complex tasks like the execution of sub-processes. The default implementation does nothing.
      Löst aus:
      Exception - Any kind of exception can be thrown
    • canRollback

      protected boolean canRollback()
      This method must be overridden by subclasses that support a rollback of their processing. If it returns TRUE the step must also implement the method rollback() with the rollback functionality.

      This default implementation always returns FALSE.

      Gibt zurück:
      TRUE if the step implementation support a rollback
    • cancel

      protected void cancel() throws Exception
      This method is similar to the 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.

      Löst aus:
      Exception - Any kind of exception may be thrown if canceling fails
    • checkStopProcessExecution

      protected boolean checkStopProcessExecution()
      check whether the execution of this process should be stopped.
      Gibt zurück:
      TRUE if the process should be stopped, FALSE otherwise.
    • cleanup

      protected void cleanup()
      This method will always be invoked at the end of a process (whether successful or not) for all executed steps. Process steps that allocate resources should override this method to free such resources if that hasn't already be done in a regular way. Multiple invocations of this method can occur and should be handled correctly by implementations. The default implementation does nothing.
    • execute

      protected abstract void execute() throws Exception
      Executes the process step. This method must be implemented by subclasses to provide the functionality of the process step. in case of errors The implementation may throw any kind of exception. The Process class will catch any Throwable that is thrown from this method.
      Löst aus:
      Exception - Any kind of exception may be thrown if executing the step fails
    • getNextStep

      protected String getNextStep()
      Returns the name of the next process step that shall be executed after this one.
      Gibt zurück:
      The name of the next process step
    • internalExecute

      protected void internalExecute() throws Exception
      Internal method to invoke the execute() method. Should only be invoked by framework classes.
      Löst aus:
      Exception - Any exception may be thrown by subclasses
    • needsInteraction

      protected boolean needsInteraction() throws Exception
      Checks whether this step must be interrupted to perform an interaction to query additional data. The default implementation returns TRUE if the flag MetaTypes.INTERACTIVE is set to TRUE and at least one interaction parameter is present.
      Gibt zurück:
      TRUE if an interaction is needed
      Löst aus:
      Exception - Any exception may be thrown by subclasses
    • prepareContinuation

      protected void prepareContinuation() throws Exception
      This method can be overridden by (interactive) subclasses if an interaction continuation occurs. That is the case if the parameter that caused the interaction is an element of the continuation parameter list that is stored in ProcessRelationTypes.CONTINUATION_PARAMS. The framework stores the corresponding parameter into ProcessRelationTypes.CONTINUATION_PARAM before this method will be invoked.

      The default implementation does nothing.

      Löst aus:
      Exception - Any exception may be thrown
    • prepareExecution

      protected void prepareExecution() throws Exception
      Prepares the execution of this step in succession of the previous step by invoking prepareParameters() and prepareValues(). This method should only be overridden by framework classes.
      Löst aus:
      Exception - Any exception may be thrown
    • prepareInteraction

      protected void prepareInteraction() throws Exception
      Prepares a re-execution of this step during an interaction by invoking the method prepareValues() and resets the interaction parameter. This method should only be overridden by framework classes.
      Löst aus:
      Exception - Any exception may be thrown
    • prepareNewInteractionParameters

      protected void prepareNewInteractionParameters(Collection<? extends org.obrel.core.RelationType<?>> params)
      Prepares new interaction parameters for rendering.
    • prepareParameters

      protected void prepareParameters() throws Exception
      This method can be overridden to prepare this step's parameters for execution. The main use of this method is for steps that are interactive to prepare the interaction parameters. This method will not be invoked if this step is re-executed because of the modification of an interactive input parameter. In that case only prepareValues() will be invoked.
      Löst aus:
      Exception - Any exception may be thrown if the preparation fails
    • prepareValues

      protected void prepareValues() throws Exception
      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.
      Löst aus:
      Exception - Any exception may be thrown if the preparation fails
    • resetParameters

      protected void resetParameters() throws Exception
      Will be invoked by a process on a rollback to reset parameter initializations performed by interactive steps. This method will be invoked on the currently suspended step as well as on any step on which the rollback() method is invoked.
      Löst aus:
      Exception - Any exception may be thrown if the reset fails
    • resume

      protected boolean resume() throws Exception
      This method can be overridden to resume this step after the process had been suspended. It will be invoked before the 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.

      Gibt zurück:
      TRUE if the process can continue with the execution of this step, FALSE if this step requires another interaction first
      Löst aus:
      Exception - Any exception may be thrown if resuming the step fails
    • rollback

      protected void rollback() throws Exception
      Must be implemented by a subclass if it can perform a rollback of a previous execution. It is guaranteed by the framework that this method will only be invoked after the step has been executed already. It is intended mainly for interactive processes that stop execution at certain (interactive) steps and can be rolled back to previous such steps. A step implementation that supports rollback must return TRUE from it's overridden 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.

      Löst aus:
      Exception - Any exception may be thrown if the rollback fails
    • setNextStep

      protected void setNextStep(String nextStepName)
      Sets the name of the next process step that shall be executed after this one.
      Parameter:
      nextStepName - The name of the next process step
    • setup

      protected void setup() throws ProcessException
      This method must be overridden by subclasses that require initialization. It will be invoked automatically after a step instance has been created and added to it's process. Overriding classes should invoke the super method.
      Löst aus:
      ProcessException - Can be thrown by subclasses if the initialization fails
    • throwMissingParameterException

      protected <T> void throwMissingParameterException(org.obrel.core.RelationType<T> paramType)
      Throws a runtime exception that signals a missing process parameter.
      Setzt außer Kraft:
      throwMissingParameterException in Klasse ProcessFragment
      Parameter:
      paramType - The relation type of the missing parameter
    • validate

      protected void validate() throws Exception
      Will be invoked to validate the step's parameters after an interaction has occurred. This method processes all validation functions that are stored in 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.

      Löst aus:
      InvalidParametersException - If a preset parameter validation fails
      Exception - Any exception may be thrown if the validation fails
    • validateParameters

      protected Map<org.obrel.core.RelationType<?>,String> validateParameters(boolean onInteraction)
      Invokes the validation functions that are stored in the process step relations 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.

      Parameter:
      onInteraction - TRUE if the validation occurs during an interaction and FALSE if it occurs when the process progresses to the next step
      Gibt zurück:
      The mapping from invalid parameters to the corresponding error messages