Klasse Interaction

java.lang.Object
org.obrel.core.RelatedObject
Alle implementierten Schnittstellen:
Serializable, org.obrel.core.Relatable
Bekannte direkte Unterklassen:
AddHistoryNote, DisplayMessage, DisplayProgress, FragmentInteraction

public class Interaction extends RollbackStep
A generic process step for interactions in a process. The interaction is achieved by setting the flag relation MetaTypes.INTERACTIVE in the setup() method. Please see the documentation of Process for general information about interactive processes.

This class can either be used to subclass it and implement functionality in the execute() method that will be invoked after the interaction has been completed. Or it can be used directly to create process steps that are only intended to collect informations into process parameters and to leave their processing to further process steps.

Although it is possible to implement interactive process steps that are derived from other step classes it is recommended to derive interactive steps from this class because it handles several typical interaction cases like automatic interaction loops (see ProcessStep.getNextStep().

Siehe auch:
  • Konstruktordetails

    • Interaction

      public Interaction()
  • Methodendetails

    • getParameterInteractionHandler

      public Interaction.InteractionHandler getParameterInteractionHandler(org.obrel.core.RelationType<?> param)
      Returns the currently registered interaction handler for a certain parameter.
      Parameter:
      param - The parameter to return the interaction handler for
      Gibt zurück:
      The registered interaction handler or NULL for none
    • insertDisplayParameter

      public void insertDisplayParameter(org.obrel.core.RelationType<?> param, org.obrel.core.RelationType<?> beforeParam)
      Inserts a display parameter before another parameter in the list of this step's interaction parameters. If the parameter to insert before doesn't exist the new parameter will be added to the end of the list.
      Parameter:
      param - The parameter type to insert
      beforeParam - The parameter type to insert the new type before
    • insertInputParameter

      public void insertInputParameter(org.obrel.core.RelationType<?> param, org.obrel.core.RelationType<?> beforeParam)
      Inserts an input parameter before another parameter in the list of this step's interaction and input parameters. If the parameter to insert before doesn't exist the new parameter will be added to the end of the list.
      Parameter:
      param - The parameter type to insert
      beforeParam - The parameter type to insert the new type before
    • setParameterInteractionHandler

      public void setParameterInteractionHandler(org.obrel.core.RelationType<?> param, Interaction.InteractionHandler interactionHandler)
      Sets the interaction handler for a certain parameter. This will replace any previous interaction handler for this parameter.
      Parameter:
      param - The parameter to add the handler for
      interactionHandler - The interaction handler or NULL to remove the current handler
    • abort

      protected void abort() throws Exception
      Cancels the current execution of all registered fragments.
      Setzt außer Kraft:
      abort in Klasse ProcessStep
      Löst aus:
      Exception - Any kind of exception can be thrown
      Siehe auch:
    • canRollback

      protected boolean canRollback()
      Returns TRUE if all registered fragments support a rollback.
      Setzt außer Kraft:
      canRollback in Klasse RollbackStep
      Gibt zurück:
      TRUE if the step implementation support a rollback
      Siehe auch:
    • cleanup

      protected void cleanup()
      Beschreibung aus Klasse kopiert: ProcessStep
      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.
      Setzt außer Kraft:
      cleanup in Klasse ProcessStep
      Siehe auch:
    • execute

      protected void execute() throws Exception
      Empty implementation to make this class non-abstract so that it can be used for simple data-collecting interactions. Subclasses may implement this method.
      Angegeben von:
      execute in Klasse ProcessStep
      Löst aus:
      Exception - Any kind of exception may be thrown if executing the step fails
      Siehe auch:
    • executeCleanupActions

      protected void executeCleanupActions()
      Executes all actions that have previously been registered through the method ProcessFragment.addCleanupAction(String, Consumer).
      Setzt außer Kraft:
      executeCleanupActions in Klasse ProcessFragment
    • getFragments

      protected Collection<InteractionFragment> getFragments()
      Returns the fragments of this interaction. The returned collection should not be modified by the invoking code.
      Gibt zurück:
      The collection of fragments
    • handleFragmentInteractions

      protected void handleFragmentInteractions(org.obrel.core.RelationType<?> interactionParam) throws Exception
      Handles any interactions that may occur in a sub-fragment. This method should be invoked from the execute() method of a subclass.
      Parameter:
      interactionParam - The interaction parameter
      Löst aus:
      Exception - If an error occurs
    • initFragments

      protected void initFragments() throws Exception
      Initializes all sub-fragments.
      Löst aus:
      Exception - If an error occurs
    • internalExecute

      protected void internalExecute() throws Exception
      Setzt außer Kraft:
      internalExecute in Klasse ProcessStep
      Löst aus:
      Exception - Any exception may be thrown by subclasses
      Siehe auch:
    • prepareContinuation

      protected void prepareContinuation() throws Exception
      Checks which fragment of this instance has caused a continuation.
      Setzt außer Kraft:
      prepareContinuation in Klasse ProcessStep
      Löst aus:
      Exception - Any exception may be thrown
      Siehe auch:
    • prepareExecution

      protected void prepareExecution() throws Exception
      Overridden to invoke initFragments() after super.
      Setzt außer Kraft:
      prepareExecution in Klasse ProcessStep
      Löst aus:
      Exception - Any exception may be thrown
      Siehe auch:
    • prepareFragmentInteractions

      protected void prepareFragmentInteractions() throws Exception
      Prepares the interactions of all sub-fragments.
      Löst aus:
      Exception - If an error occurs
    • prepareInteraction

      protected void prepareInteraction() throws Exception
      Overridden to invoke prepareFragmentInteractions() after super.
      Setzt außer Kraft:
      prepareInteraction in Klasse ProcessStep
      Löst aus:
      Exception - Any exception may be thrown
      Siehe auch:
    • removeAllFragments

      protected void removeAllFragments()
      Removes all sub-fragments.
    • removeFragment

      protected void removeFragment(InteractionFragment fragment)
      Removes a certain sub-fragment.
      Parameter:
      fragment - The fragment to remove
    • rollback

      protected void rollback() throws Exception
      Beschreibung aus Klasse kopiert: RollbackStep
      Implemented to do nothing. Subclasses that perform parameter modifications must override this method to revert such changes.
      Setzt außer Kraft:
      rollback in Klasse RollbackStep
      Löst aus:
      Exception - Any exception may be thrown if the rollback fails
      Siehe auch:
    • setup

      protected void setup() throws ProcessException
      Initializes this step to be interactive by setting a flag relation of the type MetaTypes.INTERACTIVE.
      Setzt außer Kraft:
      setup in Klasse ProcessStep
      Löst aus:
      ProcessException - Can be thrown by subclasses if the initialization fails
      Siehe auch:
    • validateParameters

      protected Map<org.obrel.core.RelationType<?>,String> validateParameters(boolean onInteraction)
      Overridden to also validate the parameters of sub-fragments.
      Setzt außer Kraft:
      validateParameters in Klasse ProcessStep
      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
      Siehe auch: