public interface TransitionHandler
PromotionConsumer
) associated with a specific business domain type. Generally, a
WorkflowTransitionHelper
is employed by concrete implementations to engage the promotion
in response to the event consumption here.
Generally, concrete implementations take a form similar to this.
@EnableBinding(PromotionConsumer.class)
public class TestTransitionHandler implements TransitionHandler<BusinessItem>
{ private final WorkflowTransitionHelper helper; public TestTransitionHandler(TestRepository repository, TrackingBusinessDomainMapper mapper, CommonCatalogService catalogService) { helper = new WorkflowTransitionHelper(repository, mapper, catalogService); }@Override
public void processPromotionRequest(PromotionRequest request)
{ helper.promote(request); } }
DefaultTransitionHandler
should be used as a base starting point if no custom
requirements are needed.
@EnableBinding
is a meta annotation containing @Configuration
. The implementation
may be component scanned or imported by other configurations.Modifier and Type | Method and Description |
---|---|
default boolean |
canHandle(TransitionRequest request) |
default boolean |
canHandleDynamically(Class<?> entityType,
Class<?> requestType)
If the inheriting class's generic P is
ContextStateAware , then check can handle
against a dynamically defined getEntityDomain() . |
default Optional<Class<?>> |
getEntityDomain()
The entity domain to use if the inheriting class's generic P is the interface
ContextStateAware . |
default Class<?> |
getNarrowedEntity() |
default boolean |
handle(WorkflowDeployRequest request) |
default boolean |
handle(WorkflowPromoteRequest request) |
default boolean |
handle(WorkflowRebaseRequest request) |
default boolean |
handle(WorkflowRejectRequest request) |
default boolean |
handle(WorkflowRevertRequest request) |
default boolean |
isRequestedEntityWhitelistedForTransition(TransitionRequest request)
Examines whether the provided
TransitionRequest.getEntity() is whitelisted for
transition operations by this handler. |
default org.apache.commons.logging.Log |
logger() |
void |
processDeploymentRequest(WorkflowDeployRequest request)
Handle the WorkflowDeployRequest that has been deemed appropriate for this handler based on
comparing the
WorkflowTransitionRequest.getEntity() against the generic type of the
handler implementation. |
void |
processPromotionRequest(WorkflowPromoteRequest request)
Handle the WorkflowPromoteRequest that has been deemed appropriate for this handler based on
comparing the
WorkflowTransitionRequest.getEntity() against the generic type of the
handler implementation. |
void |
processRebasingRequest(WorkflowRebaseRequest request)
Handle the WorkflowRebaseRequest that has been deemed appropriate for this handler based on
comparing the
WorkflowTransitionRequest.getEntity() against the generic type of the
handler implementation. |
void |
processRejectionRequest(WorkflowRejectRequest request)
Handle the WorkflowRejectRequest that has been deemed appropriate for this handler based on
comparing the
WorkflowTransitionRequest.getEntity() against the generic type of the
handler implementation. |
void |
processReversionRequest(WorkflowRevertRequest request)
Handle the WorkflowRevertRequest that has been deemed appropriate for this handler based on
comparing the
WorkflowTransitionRequest.getEntity() against the generic type of the
handler implementation. |
default void |
validate(com.broadleafcommerce.common.messaging.Securable request)
Verify the signed JWT token and validate the user claims (especially authorities) against the
consumption functionality.
|
default org.apache.commons.logging.Log logger()
default boolean handle(WorkflowPromoteRequest request)
default boolean handle(WorkflowDeployRequest request)
default boolean handle(WorkflowRejectRequest request)
default boolean handle(WorkflowRevertRequest request)
default boolean handle(WorkflowRebaseRequest request)
default Class<?> getNarrowedEntity()
default Optional<Class<?>> getEntityDomain()
ContextStateAware
.ContextStateAware
.default boolean canHandle(TransitionRequest request)
default boolean isRequestedEntityWhitelistedForTransition(TransitionRequest request)
TransitionRequest.getEntity()
is whitelisted for
transition operations by this handler.
This is most important for security purposes since the entity class will be dynamically loaded. Only allowing instantiation of whitelisted types protects against injection of malicious code.
request
- the TransitionRequest
whose TransitionRequest.getEntity()
should be checkedtrue
if the entity is whitelisted, false
otherwisedefault boolean canHandleDynamically(Class<?> entityType, Class<?> requestType)
ContextStateAware
, then check can handle
against a dynamically defined getEntityDomain()
.entityType
- The entity type of the incoming TransitionRequest
requestType
- The type of the incoming TransitionRequest
TransitionRequest
can be handled dynamicallyvoid processPromotionRequest(WorkflowPromoteRequest request)
WorkflowTransitionRequest.getEntity()
against the generic type of the
handler implementation.request
- The request for a Trackable
entity promotionvoid processDeploymentRequest(WorkflowDeployRequest request)
WorkflowTransitionRequest.getEntity()
against the generic type of the
handler implementation.request
- The request for a Trackable
entity deploymentvoid processRejectionRequest(WorkflowRejectRequest request)
WorkflowTransitionRequest.getEntity()
against the generic type of the
handler implementation.request
- The request for a Trackable
entity rejectionvoid processReversionRequest(WorkflowRevertRequest request)
WorkflowTransitionRequest.getEntity()
against the generic type of the
handler implementation.request
- The request for a Trackable
entity reversionvoid processRebasingRequest(WorkflowRebaseRequest request)
WorkflowTransitionRequest.getEntity()
against the generic type of the
handler implementation.request
- The request for a Trackable
entity rebasedefault void validate(com.broadleafcommerce.common.messaging.Securable request)
IllegalArgumentException
if the claims
made in the JWT are deemed incorrect or inappropriate for the desired task.request
- Message instance capable of supplying a signed JWT tokenCopyright © 2021. All rights reserved.