Class MultiInstanceStrategy
java.lang.Object
org.camunda.community.bpmndt.strategy.DefaultStrategy
org.camunda.community.bpmndt.strategy.MultiInstanceStrategy
- All Implemented Interfaces:
GeneratorStrategy
Special strategy for activities that are enclosed by the multi instance scope.
-
Field Summary
Fields inherited from class org.camunda.community.bpmndt.strategy.DefaultStrategy
activity, CALL_ACTIVITY, EVENT, EXTERNAL_TASK, JOB, literal, multiInstanceParent, OTHER, RECEIVE_TASK, USER_TASK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHandlerField(com.squareup.javapoet.TypeSpec.Builder classBuilder) Adds a handler field to the class, if the activity is handled by a handler - e.g.:voidaddHandlerMethod(com.squareup.javapoet.TypeSpec.Builder classBuilder) Adds a "handle" method to the class, if the activity is handled by a handler - e.g.:voidapplyHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code to the execute/apply method, if the activity is handled by a handler and a wait state - e.g.:voidapplyHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code to the execute/apply method, if an asynchronous continuation is configured after the activity - e.g.:voidapplyHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code to the execute/apply method, if an asynchronous continuation is configured before the activity - e.g.:protected com.squareup.javapoet.CodeBlockGets the strategy of the activity that is enclosed by the multi instance scope.com.squareup.javapoet.TypeNameReturns the type name of the related handler orVoid, if the activity is not handled by a specific handler.voidhasPassed(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which asserts that the process instance has passed an activity.voidinitHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which initializes a handler field.voidinitHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which initializes an after handler field.voidinitHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which initializes a before handler field.com.squareup.javapoet.CodeBlockReturns the statement that initializes the handler.voidisWaitingAt(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which asserts that the process instance is waiting at an activity.Methods inherited from class org.camunda.community.bpmndt.strategy.DefaultStrategy
addHandlerFieldAfter, addHandlerFieldBefore, addHandlerMethodAfter, addHandlerMethodBefore, buildHandlerMethodName, equals, getActivity, getHandler, getHandlerAfter, getHandlerBefore, getLiteral, getLiteralAfter, getLiteralBefore, hashCode, initHandlerAfterStatement, initHandlerBeforeStatement, setMultiInstanceParent, shouldHandleAfter, shouldHandleBefore
-
Constructor Details
-
MultiInstanceStrategy
-
-
Method Details
-
addHandlerField
public void addHandlerField(com.squareup.javapoet.TypeSpec.Builder classBuilder) Description copied from interface:GeneratorStrategyAdds 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:
addHandlerFieldin interfaceGeneratorStrategy- Overrides:
addHandlerFieldin classDefaultStrategy- Parameters:
classBuilder- The class builder to use.
-
addHandlerMethod
public void addHandlerMethod(com.squareup.javapoet.TypeSpec.Builder classBuilder) Description copied from interface:GeneratorStrategyAdds 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:
addHandlerMethodin interfaceGeneratorStrategy- Overrides:
addHandlerMethodin classDefaultStrategy- Parameters:
classBuilder- The class builder to use.
-
applyHandler
public void applyHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds 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:
applyHandlerin interfaceGeneratorStrategy- Overrides:
applyHandlerin classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.
-
applyHandlerAfter
public void applyHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds 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:
applyHandlerAfterin interfaceGeneratorStrategy- Overrides:
applyHandlerAfterin classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.
-
applyHandlerBefore
public void applyHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds 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:
applyHandlerBeforein interfaceGeneratorStrategy- Overrides:
applyHandlerBeforein classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.
-
buildHandlerMethodJavadoc
protected com.squareup.javapoet.CodeBlock buildHandlerMethodJavadoc() -
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:GeneratorStrategyReturns the type name of the related handler orVoid, if the activity is not handled by a specific handler.- Specified by:
getHandlerTypein interfaceGeneratorStrategy- Overrides:
getHandlerTypein classDefaultStrategy- 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:GeneratorStrategyAdds code, which asserts that the process instance has passed an activity.- Specified by:
hasPassedin interfaceGeneratorStrategy- Overrides:
hasPassedin classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.
-
initHandler
public void initHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds code, which initializes a handler field.approveUserTask = new UserTaskHandler(getProcessEngine(), "approveUserTask");
- Specified by:
initHandlerin interfaceGeneratorStrategy- Overrides:
initHandlerin classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.- See Also:
-
initHandlerAfter
public void initHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds code, which initializes an after handler field.approveUserTaskAfter = new JobHandler(getProcessEngine(), "approveUserTask");
- Specified by:
initHandlerAfterin interfaceGeneratorStrategy- Overrides:
initHandlerAfterin classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.- See Also:
-
initHandlerBefore
public void initHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds code, which initializes a before handler field.approveUserTaskBefore = new JobHandler(getProcessEngine(), "approveUserTask");
- Specified by:
initHandlerBeforein interfaceGeneratorStrategy- Overrides:
initHandlerBeforein classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.- See Also:
-
initHandlerStatement
public com.squareup.javapoet.CodeBlock initHandlerStatement()Description copied from interface:GeneratorStrategyReturns the statement that initializes the handler.new UserTaskHandler(getProcessEngine(), "approveUserTask");
- Specified by:
initHandlerStatementin interfaceGeneratorStrategy- Overrides:
initHandlerStatementin classDefaultStrategy- Returns:
- The code.
-
isWaitingAt
public void isWaitingAt(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds code, which asserts that the process instance is waiting at an activity.- Specified by:
isWaitingAtin interfaceGeneratorStrategy- Overrides:
isWaitingAtin classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.
-