Class DefaultTransitionHandler
java.lang.Object
com.broadleafcommerce.data.tracking.core.transition.DefaultTransitionHandler
- All Implemented Interfaces:
TransitionHandler
Base implementation of
TransitionHandler
that takes in a business domain. Used to a
create a sandbox change listener for a Sandboxable entity.- Author:
- Chad Harchar (charchar)
-
Constructor Summary
ConstructorDescriptionDefaultTransitionHandler
(TrackableRepository<Trackable> repository, WorkflowMapper mapper, CommonCatalogService<Catalog> commonCatalogService, com.broadleafcommerce.common.messaging.repository.ResourceLockRepository<?, ?> resourceLockRepository, Class<?> entityDomain, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, WorkflowRequestCompletionNotifier completionNotifier, com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService, com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper serializationHelper, com.broadleafcommerce.common.extension.data.DataRouteReference routeReference, SingleIndexRequestMessageFactory factory) DefaultTransitionHandler
(WorkflowTransitionHelper helper, Class<?> businessDomain, Class<?> entityDomain) -
Method Summary
Modifier and TypeMethodDescriptionThe entity domain to use if the inheriting class's generic P is the interfaceContextStateAware
.IfsetInstantiableEntitiesWhitelist(Set)
was called with a non-null argument, the field will be non-null and will be returned as-is.protected org.springframework.data.mapping.context.MappingContext<?,
?> Normally,setMappingContext(MappingContext)
is called directly byTransitionHandlerFactory
, but this method is alsoAutowired
to enable standard bean injection.boolean
Examines whether the providedTransitionRequest.getEntity()
is whitelisted for transition operations by this handler.void
Handle the WorkflowDeployRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.void
Handle the WorkflowPromoteRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.void
Handle the WorkflowRebaseRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.void
Handle the WorkflowRejectRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.void
Handle the WorkflowRevertRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.void
setInstantiableEntitiesWhitelist
(Set<String> instantiableEntitiesWhitelist) void
setMappingContext
(org.springframework.data.mapping.context.MappingContext<?, ?> mappingContext) Normally,setMappingContext(MappingContext)
is called directly byTransitionHandlerFactory
, but this method is alsoAutowired
to enable standard bean injection.toString()
withEventPublisher
(org.springframework.context.ApplicationEventPublisher publisher) withPropagationManager
(PropagationManager propagationManager) withTypeFactory
(com.broadleafcommerce.common.extension.TypeFactory typeFactory) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.transition.TransitionHandler
canHandle, canHandleDynamically, getNarrowedEntity, handle, handle, handle, handle, handle, logger, validate
-
Constructor Details
-
DefaultTransitionHandler
public DefaultTransitionHandler(TrackableRepository<Trackable> repository, WorkflowMapper mapper, CommonCatalogService<Catalog> commonCatalogService, com.broadleafcommerce.common.messaging.repository.ResourceLockRepository<?, ?> resourceLockRepository, Class<?> entityDomain, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, WorkflowRequestCompletionNotifier completionNotifier, com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService, com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper serializationHelper, @Nullable com.broadleafcommerce.common.extension.data.DataRouteReference routeReference, SingleIndexRequestMessageFactory factory) -
DefaultTransitionHandler
public DefaultTransitionHandler(WorkflowTransitionHelper helper, Class<?> businessDomain, Class<?> entityDomain)
-
-
Method Details
-
withPropagationManager
-
withTypeFactory
public DefaultTransitionHandler withTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
withEventPublisher
public DefaultTransitionHandler withEventPublisher(org.springframework.context.ApplicationEventPublisher publisher) -
getEntityDomain
Description copied from interface:TransitionHandler
The entity domain to use if the inheriting class's generic P is the interfaceContextStateAware
.- Specified by:
getEntityDomain
in interfaceTransitionHandler
- Returns:
- The business domain to use if the inheriting class's generic P is the interface
ContextStateAware
.
-
processPromotionRequest
Description copied from interface:TransitionHandler
Handle the WorkflowPromoteRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.- Specified by:
processPromotionRequest
in interfaceTransitionHandler
- Parameters:
request
- The request for aTrackable
entity promotion
-
processDeploymentRequest
Description copied from interface:TransitionHandler
Handle the WorkflowDeployRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.- Specified by:
processDeploymentRequest
in interfaceTransitionHandler
- Parameters:
request
- The request for aTrackable
entity deployment
-
processRejectionRequest
Description copied from interface:TransitionHandler
Handle the WorkflowRejectRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.- Specified by:
processRejectionRequest
in interfaceTransitionHandler
- Parameters:
request
- The request for aTrackable
entity rejection
-
processReversionRequest
Description copied from interface:TransitionHandler
Handle the WorkflowRevertRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.- Specified by:
processReversionRequest
in interfaceTransitionHandler
- Parameters:
request
- The request for aTrackable
entity reversion
-
processRebasingRequest
Description copied from interface:TransitionHandler
Handle the WorkflowRebaseRequest that has been deemed appropriate for this handler based on comparing theWorkflowTransitionRequest.getEntity()
against the generic type of the handler implementation.- Specified by:
processRebasingRequest
in interfaceTransitionHandler
- Parameters:
request
- The request for aTrackable
entity rebase
-
isRequestedEntityWhitelistedForTransition
Description copied from interface:TransitionHandler
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.
- Specified by:
isRequestedEntityWhitelistedForTransition
in interfaceTransitionHandler
- Parameters:
request
- theTransitionRequest
whoseTransitionRequest.getEntity()
should be checked- Returns:
true
if the entity is whitelisted,false
otherwise
-
setInstantiableEntitiesWhitelist
-
getInstantiableEntitiesWhitelist
IfsetInstantiableEntitiesWhitelist(Set)
was called with a non-null argument, the field will be non-null and will be returned as-is.If
setInstantiableEntitiesWhitelist(Set)
was not called andgetMappingContext()
is available, it will be used to compute a new value based on the available persistent entities.- Returns:
- the existing or newly-computed value of
instantiableEntitiesWhitelist
-
toString
-
setMappingContext
@Autowired public void setMappingContext(@Nullable org.springframework.data.mapping.context.MappingContext<?, ?> mappingContext) Normally,setMappingContext(MappingContext)
is called directly byTransitionHandlerFactory
, but this method is alsoAutowired
to enable standard bean injection. -
getMappingContext
@Nullable protected org.springframework.data.mapping.context.MappingContext<?,?> getMappingContext()Normally,setMappingContext(MappingContext)
is called directly byTransitionHandlerFactory
, but this method is alsoAutowired
to enable standard bean injection.
-