Class DefaultTransitionHandler
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.transition.DefaultTransitionHandler
-
- All Implemented Interfaces:
TransitionHandler
public class DefaultTransitionHandler extends Object implements TransitionHandler
Base implementation ofTransitionHandler
that takes in a business domain. Used to a create a sandbox change listener for a Sandboxable entity.- Author:
- Chad Harchar (charchar)
-
-
Constructor Summary
Constructors Constructor Description 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, com.broadleafcommerce.common.extension.data.DataRouteReference routeReference, SingleIndexRequestMessageFactory factory)
DefaultTransitionHandler(WorkflowTransitionHelper helper, Class<?> businessDomain, Class<?> entityDomain)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Class<?>>
getEntityDomain()
The entity domain to use if the inheriting class's generic P is the interfaceContextStateAware
.protected Set<String>
getInstantiableEntitiesWhitelist()
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<?,?>
getMappingContext()
Normally,setMappingContext(MappingContext)
is called directly byTransitionHandlerFactory
, but this method is alsoAutowired
to enable standard bean injection.boolean
isRequestedEntityWhitelistedForTransition(TransitionRequest request)
Examines whether the providedTransitionRequest.getEntity()
is whitelisted for transition operations by this handler.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.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.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.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.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.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.String
toString()
DefaultTransitionHandler
withEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
DefaultTransitionHandler
withPropagationManager(PropagationManager propagationManager)
DefaultTransitionHandler
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 Detail
-
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 Detail
-
withPropagationManager
public DefaultTransitionHandler withPropagationManager(PropagationManager propagationManager)
-
withTypeFactory
public DefaultTransitionHandler withTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
withEventPublisher
public DefaultTransitionHandler withEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
-
getEntityDomain
public Optional<Class<?>> 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
public void processPromotionRequest(WorkflowPromoteRequest request)
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
public void processDeploymentRequest(WorkflowDeployRequest request)
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
public void processRejectionRequest(WorkflowRejectRequest request)
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
public void processReversionRequest(WorkflowRevertRequest request)
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
public void processRebasingRequest(WorkflowRebaseRequest request)
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
public boolean isRequestedEntityWhitelistedForTransition(TransitionRequest request)
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
public void setInstantiableEntitiesWhitelist(Set<String> instantiableEntitiesWhitelist)
-
getInstantiableEntitiesWhitelist
protected Set<String> 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
-
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.
-
-