Interface TransitionHandler
- All Known Implementing Classes:
DefaultTransitionHandler
public interface TransitionHandler
TransitionHandlers are responsible for listening for TransitionConsumers channel events (such as
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); }@Overridepublic 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.- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanHandle(TransitionRequest request) default booleancanHandleDynamically(Class<?> entityType, Class<?> requestType) If the inheriting class's generic P isContextStateAware, then check can handle against a dynamically definedgetEntityDomain().The entity domain to use if the inheriting class's generic P is the interfaceContextStateAware.default Class<?>default booleanhandle(WorkflowDeployRequest request) default booleanhandle(WorkflowPromoteRequest request) default booleanhandle(WorkflowRebaseRequest request) default booleanhandle(WorkflowRejectRequest request) default booleanhandle(WorkflowRevertRequest request) default booleanExamines whether the providedTransitionRequest.getEntity()is whitelisted for transition operations by this handler.default org.apache.commons.logging.Loglogger()voidHandle the WorkflowDeployRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidHandle the WorkflowPromoteRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidHandle the WorkflowRebaseRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidHandle the WorkflowRejectRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidHandle the WorkflowRevertRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.default voidvalidate(com.broadleafcommerce.common.messaging.Securable request) Verify the signed JWT token and validate the user claims (especially authorities) against the consumption functionality.
-
Method Details
-
logger
default org.apache.commons.logging.Log logger() -
handle
-
handle
-
handle
-
handle
-
handle
-
getNarrowedEntity
-
getEntityDomain
The entity domain to use if the inheriting class's generic P is the interfaceContextStateAware.- Returns:
- The business domain to use if the inheriting class's generic P is the interface
ContextStateAware.
-
canHandle
-
isRequestedEntityWhitelistedForTransition
Examines whether the providedTransitionRequest.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.
- Parameters:
request- theTransitionRequestwhoseTransitionRequest.getEntity()should be checked- Returns:
trueif the entity is whitelisted,falseotherwise
-
canHandleDynamically
If the inheriting class's generic P isContextStateAware, then check can handle against a dynamically definedgetEntityDomain().- Parameters:
entityType- The entity type of the incomingTransitionRequestrequestType- The type of the incomingTransitionRequest- Returns:
- Whether the incoming
TransitionRequestcan be handled dynamically
-
processPromotionRequest
Handle the WorkflowPromoteRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.- Parameters:
request- The request for aTrackableentity promotion
-
processDeploymentRequest
Handle the WorkflowDeployRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.- Parameters:
request- The request for aTrackableentity deployment
-
processRejectionRequest
Handle the WorkflowRejectRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.- Parameters:
request- The request for aTrackableentity rejection
-
processReversionRequest
Handle the WorkflowRevertRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.- Parameters:
request- The request for aTrackableentity reversion
-
processRebasingRequest
Handle the WorkflowRebaseRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.- Parameters:
request- The request for aTrackableentity rebase
-
validate
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. Generally, throw anIllegalArgumentExceptionif the claims made in the JWT are deemed incorrect or inappropriate for the desired task.- Parameters:
request- Message instance capable of supplying a signed JWT token
-