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 ofTransitionHandlerthat 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 alsoAutowiredto enable standard bean injection.booleanisRequestedEntityWhitelistedForTransition(TransitionRequest request)Examines whether the providedTransitionRequest.getEntity()is whitelisted for transition operations by this handler.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.voidsetInstantiableEntitiesWhitelist(Set<String> instantiableEntitiesWhitelist)voidsetMappingContext(org.springframework.data.mapping.context.MappingContext<?,?> mappingContext)Normally,setMappingContext(MappingContext)is called directly byTransitionHandlerFactory, but this method is alsoAutowiredto enable standard bean injection.StringtoString()DefaultTransitionHandlerwithEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)DefaultTransitionHandlerwithPropagationManager(PropagationManager propagationManager)DefaultTransitionHandlerwithTypeFactory(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:TransitionHandlerThe entity domain to use if the inheriting class's generic P is the interfaceContextStateAware.- Specified by:
getEntityDomainin 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:TransitionHandlerHandle 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:
processPromotionRequestin interfaceTransitionHandler- Parameters:
request- The request for aTrackableentity promotion
-
processDeploymentRequest
public void processDeploymentRequest(WorkflowDeployRequest request)
Description copied from interface:TransitionHandlerHandle 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:
processDeploymentRequestin interfaceTransitionHandler- Parameters:
request- The request for aTrackableentity deployment
-
processRejectionRequest
public void processRejectionRequest(WorkflowRejectRequest request)
Description copied from interface:TransitionHandlerHandle 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:
processRejectionRequestin interfaceTransitionHandler- Parameters:
request- The request for aTrackableentity rejection
-
processReversionRequest
public void processReversionRequest(WorkflowRevertRequest request)
Description copied from interface:TransitionHandlerHandle 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:
processReversionRequestin interfaceTransitionHandler- Parameters:
request- The request for aTrackableentity reversion
-
processRebasingRequest
public void processRebasingRequest(WorkflowRebaseRequest request)
Description copied from interface:TransitionHandlerHandle 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:
processRebasingRequestin interfaceTransitionHandler- Parameters:
request- The request for aTrackableentity rebase
-
isRequestedEntityWhitelistedForTransition
public boolean isRequestedEntityWhitelistedForTransition(TransitionRequest request)
Description copied from interface:TransitionHandlerExamines 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:
isRequestedEntityWhitelistedForTransitionin interfaceTransitionHandler- Parameters:
request- theTransitionRequestwhoseTransitionRequest.getEntity()should be checked- Returns:
trueif the entity is whitelisted,falseotherwise
-
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 alsoAutowiredto 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 alsoAutowiredto enable standard bean injection.
-
-