Klasse StepListProcessDefinition

java.lang.Object
org.obrel.core.RelatedObject
org.obrel.core.SerializableRelatedObject
de.esoco.process.ProcessDefinition
de.esoco.process.StepListProcessDefinition
Alle implementierten Schnittstellen:
de.esoco.lib.manage.ElementDefinition<Process>, Serializable, org.obrel.core.Relatable
Bekannte direkte Unterklassen:
ActionHandlingProcessDefinition, EntityProcessDefinition, XMLProcessDefinition

public class StepListProcessDefinition extends ProcessDefinition
Defines a process from a sequential list of process steps. The order in the list will be considered as the general order in which the process steps will be performed as long as no other order is defined in the step instances.

Some of the methods that add process steps (e.g. branchTo()) will enumerate the step name if it occurs multiple times to prevent name clashes. If a process definition needs to refer to such a step's name (e.g. to add a branch to it) it must query the name of the returned step list entry.

Siehe auch:
  • Felddetails

    • DEFAULT_GOTO_PREFIX

      public static final String DEFAULT_GOTO_PREFIX
      The prefix for the automatic generation of goto step names
      Siehe auch:
    • DEFAULT_BRANCH_PREFIX

      public static final String DEFAULT_BRANCH_PREFIX
      The prefix for the automatic generation of branch step names
      Siehe auch:
  • Konstruktordetails

    • StepListProcessDefinition

      public StepListProcessDefinition(String processName, StepListProcessDefinition.StepListEntry... stepList)
      Convenience constructor with a variable argument list.
      Siehe auch:
    • StepListProcessDefinition

      public StepListProcessDefinition(String processName, List<StepListProcessDefinition.StepListEntry> stepList)
      Creates a new process definition for a specific process name and a list of process steps. The sequential order of the steps in the list will be used as the order in which the steps will be performed, unless a step already contains a different next step reference. Especially the first and the last steps in the list will be used as the starting and ending steps of the process, respectively.
      Parameter:
      processName - The name of the process described by this definition
      stepList - The sequential list of process steps
      Löst aus:
      IllegalArgumentException - If the process step list is empty
    • StepListProcessDefinition

      protected StepListProcessDefinition()
      A subclass constructor that creates a process definition that has the same name as the subclass.
    • StepListProcessDefinition

      protected StepListProcessDefinition(String processName)
      A subclass constructor that creates a new process definition with a certain name. The process steps must be added later through the method invoke(String, Class).
      Parameter:
      processName - The name of the process created by this definition or NULL for the class name
  • Methodendetails

    • throwProcessException

      public static <I, O> de.esoco.lib.expression.BinaryFunction<I,String,O> throwProcessException(String message)
      A factory method for a function that throws a ProcessException.
      Siehe auch:
      • Functions.error(String, Class)
    • toString

      public String toString()
      Returns the process name.
      Setzt außer Kraft:
      toString in Klasse org.obrel.core.RelatedObject
      Gibt zurück:
      The process
    • addInteraction

      protected StepListProcessDefinition.StepListEntry addInteraction(String name)
      Adds a step for an interactive process step that is based on the step class Interaction.
      Parameter:
      name - The name of the interactive step
      Gibt zurück:
      The new step list entry
    • addInteraction

      protected StepListProcessDefinition.StepListEntry addInteraction(String name, List<org.obrel.core.RelationType<?>> displayParams, List<org.obrel.core.RelationType<?>> inputParams)
      Adds a step for an interactive process step that is based on the step class Interaction and that has display parameters as well as input parameters.
      Parameter:
      name - The name of the interactive step
      displayParams - The list of display parameter types
      inputParams - The list of input parameter types
      Gibt zurück:
      The new step list entry
    • branchTo

      protected <T> StepListProcessDefinition.StepListEntry branchTo(Class<? extends ProcessFragment> targetStepClass, org.obrel.core.RelationType<T> branchParam, de.esoco.lib.expression.Predicate<? super T> branchCondition)
      Convenience method to add a branch to a certain process step that is identified by it's class.
      Siehe auch:
    • branchTo

      protected <T> StepListProcessDefinition.StepListEntry branchTo(String targetStep, org.obrel.core.RelationType<T> branchParam, de.esoco.lib.expression.Predicate<? super T> branchCondition)
      Adds a branch step with a name that is derived from the target step name.
      Siehe auch:
    • branchTo

      protected <T> StepListProcessDefinition.StepListEntry branchTo(Class<? extends ProcessFragment> targetStepClass, org.obrel.core.RelationType<T> branchParam, de.esoco.lib.expression.Predicate<? super T> branchCondition, String name)
      Convenience method to add a named branch to a certain process step that is identified by it's class.
      Siehe auch:
    • branchTo

      protected <T> StepListProcessDefinition.StepListEntry branchTo(String targetStep, org.obrel.core.RelationType<T> branchParam, de.esoco.lib.expression.Predicate<? super T> branchCondition, String name)
      Adds a step that branches the process flow. If a process contains multiple branches to the same target step the names of the branch steps will be enumerated to ensure uniqueness. If a process definition needs to refer to a branch step's name (e.g. for another branch to the step itself) it should query the name of the returned step list entry.
      Parameter:
      targetStep - The name of the target step to be executed if the branch condition is TRUE; to end the process it must be Process.PROCESS_END
      branchParam - The parameter to be evaluated for the branch
      branchCondition - The predicate to evaluate the branch parameter with
      name - The name of the step
      Gibt zurück:
      The new step list entry
    • copyParam

      protected <T> StepListProcessDefinition.StepListEntry copyParam(org.obrel.core.RelationType<T> sourceParam, org.obrel.core.RelationType<? super T> targetParam)
      Adds a step to that copies a process parameter to another parameter. A unique step name will be generated automatically. If an application needs to refer to this step by it's name it must query the name of the returned step list entry.
      Parameter:
      sourceParam - The source parameter to copy
      targetParam - The target parameter
      Gibt zurück:
      The new step list entry
    • createProcess

      protected Process createProcess()
      Creates a new process instance that contains the process steps defined in the process step list of this process definition.
      Angegeben von:
      createProcess in Klasse ProcessDefinition
      Gibt zurück:
      The new process instance
      Löst aus:
      ProcessException - If creating the process fails
    • display

      protected StepListProcessDefinition.StepListEntry display(String name, org.obrel.core.RelationType<?>... displayParams)
      Adds a step for an interactive process step that is based on the step class Interaction and which has several display parameters.
      Parameter:
      name - The name of the interactive step
      displayParams - The display parameter types
      Gibt zurück:
      The new step list entry
    • displayMessage

      protected StepListProcessDefinition.StepListEntry displayMessage(String message, String info, boolean autoContinue)
      Adds a process step of type DisplayMessage that displays a message and an option information string. If the boolean parameter is true the step will automatically continue to the next step. This can be used to display a wait message for subsequent steps that take long time. The message will then be displayed until the next interaction occurs in the process.
      Parameter:
      message - The message to display
      info - The information string or NULL for none
      autoContinue - TRUE to automatically continue to the next step
      Gibt zurück:
      The new step list entry
    • endProcessIf

      protected <T> StepListProcessDefinition.StepListEntry endProcessIf(org.obrel.core.RelationType<T> param, de.esoco.lib.expression.Predicate<? super T> condition)
      A variant of branchTo(String, RelationType, Predicate, String) that jumps to the end of the contract if the given condition is true for the argument parameter.
      Parameter:
      param - The parameter to be evaluated for the branch
      condition - The predicate to evaluate the branch parameter with
      Gibt zurück:
      The new step list entry
    • goTo

      protected StepListProcessDefinition.StepListEntry goTo(Class<? extends ProcessFragment> targetStepClass)
      Convenience method to add a goto to a certain process step that is identified by it's class.
      Siehe auch:
    • goTo

      protected StepListProcessDefinition.StepListEntry goTo(String targetStep)
      Adds a step that jumps directly to an arbitrary other process step in the same process.
      Parameter:
      targetStep - The target step to branch to
      Gibt zurück:
      The new step list entry
    • handleFragmentContinuation

      @SafeVarargs protected final StepListProcessDefinition.StepListEntry handleFragmentContinuation(Class<? extends ProcessFragment> afterHandlingStep, Class<? extends ProcessFragment> noHandlingStep, Class<? extends ProcessDefinition>... fragmentHandlingProcesses)
      Inserts the steps that are needed to handle the continuation parameters of interaction fragments. If a continuation occurred and it can be associated with an interaction fragment the corresponding handling processes will be invoked. Afterwards the process will jump to the given after-handling process step. If no continuation fragment can be found the process will jump to the given no-handling step or, if that is NULL, to the process end.

      To determine the fragment classes that must be checked against the current continuation fragment class (which is stored in the parameter ProcessRelationTypes.CONTINUATION_FRAGMENT_CLASS) the enclosing classes of the fragment handling processes will be used. That means that fragment handling processes must always be defined as a direct inner class of the fragment they define the continuation handling of.

      Parameter:
      afterHandlingStep - The process step to be invoked after a fragment handling process
      noHandlingStep - The process step to be invoked if no fragment handling has occurred
      fragmentHandlingProcesses - The list of fragment continuation handling processes
      Gibt zurück:
      The StepListProcessDefinition.StepListEntry of the first continuation handling step
    • initParam

      protected <S, D> void initParam(org.obrel.core.RelationType<S> sourceParam, org.obrel.core.RelationType<D> destinationParam, de.esoco.lib.expression.Function<? super S,D> init)
      Adds a conditional parameter initialization function that produces the value of a certain parameter from the process. The function will only be evaluated if the given source parameter is not NULL. Therefore the argument function doesn't need to check the parameter existence by itself.
      Parameter:
      sourceParam - The process parameter to evaluate with the initialization function
      destinationParam - The process parameter to store the function result in
      init - A function that produces the parameter value from the process
    • input

      protected StepListProcessDefinition.StepListEntry input(String name, org.obrel.core.RelationType<?>... inputParams)
      Adds an interactive process step that will query the value of certain parameters with a particular input policy.
      Parameter:
      name - The name of the interactive step
      inputParams - The input parameter types
      Gibt zurück:
      The new step list entry
    • invoke

      protected StepListProcessDefinition.StepListEntry invoke(Class<? extends ProcessFragment> fragmentType)
      Adds a step to this process definition that has the same name as the simple name of the step class.
      Siehe auch:
    • invoke

      protected StepListProcessDefinition.StepListEntry invoke(String name, Class<? extends ProcessFragment> fragmentType)
      Adds a process step with a specific name to this definition.
      Parameter:
      name - The name of the step
      fragmentType - The class to create the step from
      Gibt zurück:
      The new step list entry
      Löst aus:
      IllegalArgumentException - If the given name has already been used
    • invokeBinaryFunction

      protected <L, R, O> StepListProcessDefinition.StepListEntry invokeBinaryFunction(String name, org.obrel.core.RelationType<L> leftParam, org.obrel.core.RelationType<R> rightParam, org.obrel.core.RelationType<O> outputParam, de.esoco.lib.expression.BinaryFunction<? super L,? super R,? extends O> function)
      Adds an instance of FunctionStep for a step that evaluates a binary function on certain parameters. If multiple steps with the same name are added the names of the additional steps will be enumerated to ensure uniqueness.
      Parameter:
      name - The name of the interactive step
      leftParam - The type of the parameter that contains the main (left-side) input value for the function evaluation
      rightParam - The type of the parameter that contains the secondary (right-side) input value for the evaluation of the binary function
      outputParam - The type of the parameter to store the output value of the function evaluation in or NULL to ignore the function output
      function - The binary function that the step shall evaluate
      Gibt zurück:
      The new step list entry
    • invokeFunction

      protected <I, O> StepListProcessDefinition.StepListEntry invokeFunction(String name, org.obrel.core.RelationType<I> inputParam, org.obrel.core.RelationType<O> outputParam, de.esoco.lib.expression.Function<? super I,? extends O> function)
      Adds an instance of FunctionStep for a step that evaluates a function on a certain parameter. If multiple steps with the same name are added the names of the additional steps will be enumerated to ensure uniqueness.
      Parameter:
      name - The name of the interactive step
      inputParam - The type of the parameter that contains the input value for the function evaluation or NULL for no input value (for functions that ignore their input)
      outputParam - The type of the parameter to store the output value of the function evaluation in or NULL to ignore the function output
      function - The function that the step shall evaluate
      Gibt zurück:
      The new step list entry
    • invokeSubProcess

      protected StepListProcessDefinition.StepListEntry invokeSubProcess(Class<? extends ProcessDefinition> subProcessClass)
      Adds a step for a sub-process invocation. The name of the step will be the same as that of the the sub-process.
      Parameter:
      subProcessClass - The class of the sub-process definition
      Gibt zurück:
      The new step list entry
    • invokeSubProcess

      protected StepListProcessDefinition.StepListEntry invokeSubProcess(String name, ProcessDefinition subProcessDefinition)
      Adds a step for a sub-process invocation which is based on the class SubProcessStep.
      Parameter:
      name - The step name or NULL to use the name of the sub-process
      subProcessDefinition - The definition of the sub-process
      Gibt zurück:
      The new step list entry
    • invokeSubProcess

      protected StepListProcessDefinition.StepListEntry invokeSubProcess(String name, Class<? extends ProcessDefinition> subProcessClass)
      Adds a step for a sub-process invocation with a specific name. This method should only be used for sub-process that need a different name than their definition (e.g. for multiple invocations from the same parent process). If this is not the case the invokeSubProcess(Class) method should be used instead.
      Parameter:
      name - The step name or NULL to use the name of the sub-process
      subProcessClass - The class of the sub-process definition
      Gibt zurück:
      The new step list entry
    • moveParam

      protected <T> StepListProcessDefinition.StepListEntry moveParam(org.obrel.core.RelationType<T> sourceParam, org.obrel.core.RelationType<? super T> targetParam)
      Adds a step to that moves a process parameter to another parameter. A unique step name will be generated automatically. If an application needs to refer to this step by it's name it must query the name of the returned step list entry.
      Parameter:
      sourceParam - The source parameter to move
      targetParam - The target parameter
      Gibt zurück:
      The new step list entry
    • setParameter

      protected <T> StepListProcessDefinition.StepListEntry setParameter(org.obrel.core.RelationType<T> param, T value)
      Adds a function step that sets a parameter to a certain value.
      Parameter:
      param - The parameter to set
      value - The value of the parameter
      Gibt zurück:
      The new step list entry
    • setParameter

      protected <T> StepListProcessDefinition.StepListEntry setParameter(org.obrel.core.RelationType<List<T>> param, T... values)
      Adds a function step that sets a list parameter to certain values.
      Parameter:
      param - The list parameter to set
      values - The values of the parameter
      Gibt zurück:
      The new step list entry
    • switchOnParam

      protected <T> StepListProcessDefinition.StepListEntry switchOnParam(org.obrel.core.RelationType<T> switchParam, Map<T,Object> switchMap)
      Convenience method for a switch that queries the switch targets from a map based on a key stored in a parameter.
      Siehe auch:
    • switchOnParam

      protected <T> StepListProcessDefinition.StepListEntry switchOnParam(org.obrel.core.RelationType<T> switchParam, de.esoco.lib.expression.Function<? super T,Object> targetSelector)
      Adds a step that switches between different process flows according to the state of a certain process parameter. See SwitchStep for details.
      Parameter:
      switchParam - The parameter to be evaluated for the switch
      targetSelector - A function that evaluates the value of the switch parameter and returns the name corresponding target step
      Gibt zurück:
      The new step list entry