Interface TransitionHandler
-
- All Known Implementing Classes:
DefaultTransitionHandler
public interface TransitionHandlerTransitionHandlers are responsible for listening for TransitionConsumers channel events (such asPromotionConsumer) associated with a specific business domain type. Generally, aWorkflowTransitionHelperis 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); } }DefaultTransitionHandlershould be used as a base starting point if no custom requirements are needed.@EnableBindingis a meta annotation containing@Configuration. The implementation may be component scanned or imported by other configurations.- Author:
- Jeff Fischer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default 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().default Optional<Class<?>>getEntityDomain()The entity domain to use if the inheriting class's generic P is the interfaceContextStateAware.default Class<?>getNarrowedEntity()default booleanhandle(WorkflowDeployRequest request)default booleanhandle(WorkflowPromoteRequest request)default booleanhandle(WorkflowRebaseRequest request)default booleanhandle(WorkflowRejectRequest request)default booleanhandle(WorkflowRevertRequest request)default booleanisRequestedEntityWhitelistedForTransition(TransitionRequest request)Examines whether the providedTransitionRequest.getEntity()is whitelisted for transition operations by this handler.default org.apache.commons.logging.Loglogger()voidprocessDeploymentRequest(WorkflowDeployRequest request)Handle the WorkflowDeployRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidprocessPromotionRequest(WorkflowPromoteRequest request)Handle the WorkflowPromoteRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidprocessRebasingRequest(WorkflowRebaseRequest request)Handle the WorkflowRebaseRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidprocessRejectionRequest(WorkflowRejectRequest request)Handle the WorkflowRejectRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()against the generic type of the handler implementation.voidprocessReversionRequest(WorkflowRevertRequest request)Handle 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 Detail
-
logger
default org.apache.commons.logging.Log logger()
-
handle
default boolean handle(WorkflowPromoteRequest request)
-
handle
default boolean handle(WorkflowDeployRequest request)
-
handle
default boolean handle(WorkflowRejectRequest request)
-
handle
default boolean handle(WorkflowRevertRequest request)
-
handle
default boolean handle(WorkflowRebaseRequest request)
-
getNarrowedEntity
default Class<?> getNarrowedEntity()
-
getEntityDomain
default Optional<Class<?>> 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
default boolean canHandle(TransitionRequest request)
-
isRequestedEntityWhitelistedForTransition
default boolean isRequestedEntityWhitelistedForTransition(TransitionRequest request)
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
default boolean canHandleDynamically(Class<?> entityType, Class<?> requestType)
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
void processPromotionRequest(WorkflowPromoteRequest request)
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
void processDeploymentRequest(WorkflowDeployRequest request)
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
void processRejectionRequest(WorkflowRejectRequest request)
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
void processReversionRequest(WorkflowRevertRequest request)
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
void processRebasingRequest(WorkflowRebaseRequest request)
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
-
-