Class TransitionHandlerFactory

  • All Implemented Interfaces:
    TransitionHandlerCustomizer

    public class TransitionHandlerFactory
    extends Object
    implements TransitionHandlerCustomizer
    Used to create TransitionHandlers for sandboxable entities and delegate to them when a sandbox message is received. Sandboxable entities are marked with @TrackableExtension(TrackableBehavior.SANDBOX). Transition handlers are created in the following way:
    • Retrieve all entities
    • Filter out any non-sandboxable entities
    • For each entity, get the business domain name. For example, `JpaProduct.java` has the method `getBusinessDomainType()` which points to `Product.class`
    • Using the entity persisted-domain name, construct a name by lowercasing the first letter and appending `TransitionHandler`. To follow the previous example, it would be `jpaProductTransitionHandler`
    • Check if there is already a bean with that name created and use that. This allows overriding these Transition Handlers with custom behavior.
    • If there is no bean created, construct a new Transition Handler using DefaultTransitionHandler for this entity.
    • Add the transition handler to the list of handlers.
    Author:
    Chad Harchar (charchar)
    • Constructor Detail

      • TransitionHandlerFactory

        public TransitionHandlerFactory​(com.broadleafcommerce.common.extension.data.DataRouteReference routeReference,
                                        org.springframework.data.mapping.context.MappingContext<?,​?> mappingContext,
                                        TrackableBehaviorUtil behaviorUtil,
                                        WorkflowMapper workflowMapper,
                                        org.springframework.context.ApplicationContext applicationContext,
                                        DomainMapperManager domainMapper,
                                        com.broadleafcommerce.common.messaging.repository.ResourceLockRepository<?,​?> resourceLockRepository,
                                        com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager,
                                        WorkflowRequestCompletionNotifier completionNotifier,
                                        com.broadleafcommerce.common.extension.TypeFactory factory,
                                        com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService,
                                        com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper helper,
                                        RepositoryUtility repositories,
                                        CommonCatalogService<Catalog> commonCatalogService,
                                        SingleIndexRequestMessageFactory singleIndexRequestMessageFactory,
                                        PropagationManager propagationManager,
                                        com.broadleafcommerce.common.extension.TypeFactory typeFactory)
      • TransitionHandlerFactory

        public TransitionHandlerFactory​(com.broadleafcommerce.common.extension.data.DataRouteReference routeReference,
                                        org.springframework.data.mapping.context.MappingContext<?,​?> mappingContext,
                                        TrackableBehaviorUtil behaviorUtil,
                                        WorkflowMapper workflowMapper,
                                        org.springframework.context.ApplicationContext applicationContext,
                                        DomainMapperManager domainMapper,
                                        com.broadleafcommerce.common.messaging.repository.ResourceLockRepository<?,​?> resourceLockRepository,
                                        com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager,
                                        WorkflowRequestCompletionNotifier completionNotifier,
                                        com.broadleafcommerce.common.extension.TypeFactory factory,
                                        com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService,
                                        com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper helper,
                                        RepositoryUtility repositories,
                                        SingleIndexRequestMessageFactory singleIndexRequestMessageFactory)
    • Method Detail

      • getEligiblePersistentEntities

        protected List<org.springframework.data.mapping.PersistentEntity<?,​?>> getEligiblePersistentEntities()
        We only want to have TransitionHandler instances for most-derived persisted domain types. If an entity is extended, we want to create a handler for the extended domain, not the base class.

        By default, this method will obtain all persistent entities from the MappingContext and subsequently filter to only the most-derived types. For example, if the base type JpaSomething has an extension JpaExtendedSomething, only JpaExtendedSomething will have a handler created.

        Returns:
        a filtered list of the most-derived persisted entity types
      • getTransitionHandler

        protected Optional<TransitionHandler> getTransitionHandler​(org.springframework.data.mapping.PersistentEntity<?,​?> entity)
      • getBusinessDomain

        protected Optional<Class<?>> getBusinessDomain​(org.springframework.data.mapping.PersistentEntity<?,​?> entity,
                                                       Class<?> type)
      • getRouteReference

        protected com.broadleafcommerce.common.extension.data.DataRouteReference getRouteReference()
      • getMappingContext

        protected org.springframework.data.mapping.context.MappingContext<?,​?> getMappingContext()
      • getApplicationContext

        protected org.springframework.context.ApplicationContext getApplicationContext()
      • getResourceLockRepository

        protected com.broadleafcommerce.common.messaging.repository.ResourceLockRepository<?,​?> getResourceLockRepository()
      • getNotificationManager

        protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()
      • getFactory

        protected com.broadleafcommerce.common.extension.TypeFactory getFactory()
      • getHelper

        protected com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper getHelper()
      • setPropagationManager

        @Autowired
        public void setPropagationManager​(@Nullable
                                          PropagationManager propagationManager)
      • getTypeFactory

        protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
      • setTypeFactory

        @Autowired
        public void setTypeFactory​(@Nullable
                                   com.broadleafcommerce.common.extension.TypeFactory typeFactory)