Class DefaultHandlerStrategy
java.lang.Object
org.camunda.community.bpmndt.strategy.DefaultStrategy
org.camunda.community.bpmndt.strategy.DefaultHandlerStrategy
- All Implemented Interfaces:
GeneratorStrategy
- Direct Known Subclasses:
CallActivityStrategy,CustomMultiInstanceStrategy,JobStrategy,MessageEventStrategy,OutboundConnectorStrategy,ReceiveTaskStrategy,SignalEventStrategy,TimerEventStrategy,UserTaskStrategy
Default strategy for all handled BPMN element, that provide a fluent handler API.
-
Field Summary
Fields inherited from class org.camunda.community.bpmndt.strategy.DefaultStrategy
CALL_ACTIVITY, CUSTOM_MULTI_INSTANCE, element, JOB, literal, MESSAGE_EVENT, OTHER, OUTBOUND_CONNECTOR, RECEIVE_TASK, SIGNAL_EVENT, TIMER_EVENT, 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 element is handled by a handler - e.g.:voidaddHandlerMethod(com.squareup.javapoet.TypeSpec.Builder classBuilder) Adds a "handle" method to the class, if the element is handled by a handler - e.g.:voidapplyHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code to the execute/apply method, if the element is handled by a handler - e.g.:com.squareup.javapoet.CodeBlockReturns code for getting a handler field reference.voidhasPassed(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which asserts that the process instance has passed a BPMN element.voidinitHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which initializes a handler field.com.squareup.javapoet.CodeBlockReturns the statement that initializes the handler.Methods inherited from class org.camunda.community.bpmndt.strategy.DefaultStrategy
getElement, getHandlerType, getLiteral, initHandlerElement, isWaitingAt
-
Constructor Details
-
DefaultHandlerStrategy
-
-
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 element 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 element 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 element is handled by a handler - e.g.:instance.isWaitingAt(processInstanceEvent, "placeOrderExternalTask"); instance.apply(processInstanceEvent, placeOrderExternalTask)
or the previous element is an event based gateway.
- Specified by:
applyHandlerin interfaceGeneratorStrategy- Overrides:
applyHandlerin classDefaultStrategy- Parameters:
methodBuilder- The method builder to use.
-
getHandler
public com.squareup.javapoet.CodeBlock getHandler()Description copied from interface:GeneratorStrategyReturns code for getting a handler field reference. Normally a handler field is references usingGeneratorStrategy.getLiteral(), but in case of a multi instance scope a specificgetHandlermethod must be called.
Normally:
approveUserTask
Multi instance scope:
getApproveUserTaskHandler(loopIndex)
- Specified by:
getHandlerin interfaceGeneratorStrategy- Overrides:
getHandlerin classDefaultStrategy- Returns:
- The handler reference code.
-
hasPassed
public void hasPassed(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds code, which asserts that the process instance has passed a BPMN element.- 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(approveUserTaskElement);
- Specified by:
initHandlerin interfaceGeneratorStrategy- Overrides:
initHandlerin 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(approveUserTaskElement)
- Specified by:
initHandlerStatementin interfaceGeneratorStrategy- Overrides:
initHandlerStatementin classDefaultStrategy- Returns:
- The code.
-