Class DefaultStrategy
java.lang.Object
org.camunda.community.bpmndt.strategy.DefaultStrategy
- All Implemented Interfaces:
GeneratorStrategy
- Direct Known Subclasses:
DefaultHandlerStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.squareup.javapoet.TypeNamestatic final com.squareup.javapoet.TypeNameprotected final BpmnElementstatic final com.squareup.javapoet.TypeNameprotected final Stringstatic final com.squareup.javapoet.TypeNamestatic final com.squareup.javapoet.TypeNamestatic final com.squareup.javapoet.TypeNamestatic final com.squareup.javapoet.TypeNamestatic final com.squareup.javapoet.TypeNamestatic final com.squareup.javapoet.TypeNamestatic final com.squareup.javapoet.TypeName -
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.:Returns the underlying BPMN element.com.squareup.javapoet.CodeBlockReturns code for getting a handler field reference.com.squareup.javapoet.TypeNameReturns the type name of the related handler orVoid, if the activity is not handled by a specific handler.Gets the ID of the underlying BPMN element as a literal.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.voidinitHandlerElement(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Adds code, which initializes the handler's element - e.g.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 a BPMN element.
-
Field Details
-
CALL_ACTIVITY
public static final com.squareup.javapoet.TypeName CALL_ACTIVITY -
CUSTOM_MULTI_INSTANCE
public static final com.squareup.javapoet.TypeName CUSTOM_MULTI_INSTANCE -
JOB
public static final com.squareup.javapoet.TypeName JOB -
MESSAGE_EVENT
public static final com.squareup.javapoet.TypeName MESSAGE_EVENT -
OUTBOUND_CONNECTOR
public static final com.squareup.javapoet.TypeName OUTBOUND_CONNECTOR -
OTHER
public static final com.squareup.javapoet.TypeName OTHER -
RECEIVE_TASK
public static final com.squareup.javapoet.TypeName RECEIVE_TASK -
SIGNAL_EVENT
public static final com.squareup.javapoet.TypeName SIGNAL_EVENT -
TIMER_EVENT
public static final com.squareup.javapoet.TypeName TIMER_EVENT -
USER_TASK
public static final com.squareup.javapoet.TypeName USER_TASK -
element
-
literal
-
-
Constructor Details
-
DefaultStrategy
-
-
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- 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- 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- Parameters:
methodBuilder- The method builder to use.
-
getElement
Description copied from interface:GeneratorStrategyReturns the underlying BPMN element.- Specified by:
getElementin interfaceGeneratorStrategy- Returns:
- The test case element.
-
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- Returns:
- The handler reference code.
-
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- Returns:
- The handler type name e.g.
TypeName.get(UserTaskHandler.class).
-
getLiteral
Description copied from interface:GeneratorStrategyGets the ID of the underlying BPMN element as a literal.- Specified by:
getLiteralin interfaceGeneratorStrategy- Returns:
- The element ID literal.
-
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- 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- Parameters:
methodBuilder- The method builder to use.- See Also:
-
initHandlerElement
public void initHandlerElement(com.squareup.javapoet.MethodSpec.Builder methodBuilder) Description copied from interface:GeneratorStrategyAdds code, which initializes the handler's element - e.g.TestCaseInstanceElement.UserTaskElement- Specified by:
initHandlerElementin interfaceGeneratorStrategy- Parameters:
methodBuilder- The method builder to use.
-
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- 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 a BPMN element.- Specified by:
isWaitingAtin interfaceGeneratorStrategy- Parameters:
methodBuilder- The method builder to use.
-