Class MultiInstanceStrategy

java.lang.Object
org.camunda.community.bpmndt.strategy.DefaultStrategy
org.camunda.community.bpmndt.strategy.MultiInstanceStrategy
All Implemented Interfaces:
GeneratorStrategy

public class MultiInstanceStrategy extends DefaultStrategy
Special strategy for activities that are enclosed by the multi instance scope.
  • Constructor Details

  • Method Details

    • addHandlerField

      public void addHandlerField(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Description copied from interface: GeneratorStrategy
      Adds a handler field to the class, if the activity is handled by a handler - e.g.:
       private UserTaskHandler approveUserTask;
       

      Otherwise, no field is added.

      Specified by:
      addHandlerField in interface GeneratorStrategy
      Overrides:
      addHandlerField in class DefaultStrategy
      Parameters:
      classBuilder - The class builder to use.
    • addHandlerMethod

      public void addHandlerMethod(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Description copied from interface: GeneratorStrategy
      Adds a "handle" method to the class, if the activity is handled by a handler - e.g.:
       public UserTaskHandler handleApproveUserTask() {
         return approveUserTask;
       }
       

      Otherwise, no field is added.

      Specified by:
      addHandlerMethod in interface GeneratorStrategy
      Overrides:
      addHandlerMethod in class DefaultStrategy
      Parameters:
      classBuilder - The class builder to use.
    • applyHandler

      public void applyHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code to the execute/apply method, if the activity is handled by a handler and a wait state - e.g.:
       assertThat(pi).isWaitingAt("placeOrderExternalTask");
       instance.apply(placeOrderExternalTask)
       

      or the previous activity is an event based gateway.

      Specified by:
      applyHandler in interface GeneratorStrategy
      Overrides:
      applyHandler in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.
    • applyHandlerAfter

      public void applyHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code to the execute/apply method, if an asynchronous continuation is configured after the activity - e.g.:
       assertThat(pi).isWaitingAt("sendMailServiceTask");
       instance.apply(sendMailServiceTaskAfter)
       
      Specified by:
      applyHandlerAfter in interface GeneratorStrategy
      Overrides:
      applyHandlerAfter in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.
    • applyHandlerBefore

      public void applyHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code to the execute/apply method, if an asynchronous continuation is configured before the activity - e.g.:
       assertThat(pi).isWaitingAt("sendMailServiceTask");
       instance.apply(sendMailServiceTaskBefore)
       
      Specified by:
      applyHandlerBefore in interface GeneratorStrategy
      Overrides:
      applyHandlerBefore in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.
    • buildHandlerMethodJavadoc

      protected com.squareup.javapoet.CodeBlock buildHandlerMethodJavadoc()
    • getEnclosedStrategy

      public GeneratorStrategy getEnclosedStrategy()
      Gets the strategy of the activity that is enclosed by the multi instance scope.
      Returns:
      The enclosed (original) strategy.
    • getHandlerType

      public com.squareup.javapoet.TypeName getHandlerType()
      Description copied from interface: GeneratorStrategy
      Returns the type name of the related handler or Void, if the activity is not handled by a specific handler.
      Specified by:
      getHandlerType in interface GeneratorStrategy
      Overrides:
      getHandlerType in class DefaultStrategy
      Returns:
      The handler type name e.g. TypeName.get(UserTaskHandler.class).
    • hasPassed

      public void hasPassed(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code, which asserts that the process instance has passed an activity.
      Specified by:
      hasPassed in interface GeneratorStrategy
      Overrides:
      hasPassed in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.
    • initHandler

      public void initHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code, which initializes a handler field.
       approveUserTask = new UserTaskHandler(getProcessEngine(), "approveUserTask");
       
      Specified by:
      initHandler in interface GeneratorStrategy
      Overrides:
      initHandler in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.
      See Also:
    • initHandlerAfter

      public void initHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code, which initializes an after handler field.
       approveUserTaskAfter = new JobHandler(getProcessEngine(), "approveUserTask");
       
      Specified by:
      initHandlerAfter in interface GeneratorStrategy
      Overrides:
      initHandlerAfter in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.
      See Also:
    • initHandlerBefore

      public void initHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code, which initializes a before handler field.
       approveUserTaskBefore = new JobHandler(getProcessEngine(), "approveUserTask");
       
      Specified by:
      initHandlerBefore in interface GeneratorStrategy
      Overrides:
      initHandlerBefore in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.
      See Also:
    • initHandlerStatement

      public com.squareup.javapoet.CodeBlock initHandlerStatement()
      Description copied from interface: GeneratorStrategy
      Returns the statement that initializes the handler.
       new UserTaskHandler(getProcessEngine(), "approveUserTask");
       
      Specified by:
      initHandlerStatement in interface GeneratorStrategy
      Overrides:
      initHandlerStatement in class DefaultStrategy
      Returns:
      The code.
    • isWaitingAt

      public void isWaitingAt(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Description copied from interface: GeneratorStrategy
      Adds code, which asserts that the process instance is waiting at an activity.
      Specified by:
      isWaitingAt in interface GeneratorStrategy
      Overrides:
      isWaitingAt in class DefaultStrategy
      Parameters:
      methodBuilder - The method builder to use.