Class DefaultDeploymentRequestHandler

java.lang.Object
com.broadleafcommerce.sandbox.service.DefaultDeploymentRequestHandler
All Implemented Interfaces:
DeploymentRequestHandler

public class DefaultDeploymentRequestHandler extends Object implements DeploymentRequestHandler
Assists in handling the logic for scheduling deployment requests.
Author:
Nathan Moore (nathandmoore), Samarth Dhruva (samarthd)
  • Constructor Details

  • Method Details

    • deploy

      public void deploy(@NonNull ChangeSummaryGroups scheduleGroups, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull String sandbox, int level)
      Description copied from interface: DeploymentRequestHandler
      Creates a new ChangeDeploy for the given ChangeSummaryGroups and executes immediate deployment. A WorkflowDeployRequest is emitted per change summary via the relevant Spring Cloud channel, and the given ChangeSummaryGroups and their ChangeSummaries are marked with status ChangeStatusType.DEPLOYING.
      Specified by:
      deploy in interface DeploymentRequestHandler
      Parameters:
      scheduleGroups - Construct that identifies one or more ChangeSummaryGroup instances to be scheduled for a future deployment.
      context - Information about the deploy request containing the ID of the request's author.
      sandbox - The sandbox ID upon which to filter searches on when retrieving the group instances and their summaries.
      level - The tracking level from which to perform the deployment (see TrackingLevel)
    • deploy

      public void deploy(@NonNull ChangeSummaryGroups scheduleGroups, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull String sandbox, int level, boolean vendorNarrowing)
      Description copied from interface: DeploymentRequestHandler
      Creates a new ChangeDeploy for the given ChangeSummaryGroups and executes immediate deployment. A WorkflowDeployRequest is emitted per change summary via the relevant Spring Cloud channel, and the given ChangeSummaryGroups and their ChangeSummaries are marked with status ChangeStatusType.DEPLOYING.
      Specified by:
      deploy in interface DeploymentRequestHandler
      Parameters:
      scheduleGroups - Construct that identifies one or more ChangeSummaryGroup instances to be scheduled for a future deployment.
      context - Information about the deploy request containing the ID of the request's author.
      sandbox - The sandbox ID upon which to filter searches on when retrieving the group instances and their summaries.
      level - The tracking level from which to perform the deployment (see TrackingLevel)
      vendorNarrowing - whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
    • deploy

      @Deprecated public void deploy(@NonNull ChangeSummaryGroups scheduleGroups, @NonNull Stream<ChangeSummary> summaries, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull String sandbox, int level)
      Deprecated.
      Description copied from interface: DeploymentRequestHandler
      Creates a new ChangeDeploy for the given ChangeSummaryGroups and executes immediate deployment. A WorkflowDeployRequest is emitted per change summary via the relevant Spring Cloud channel, and the given ChangeSummaryGroups and their ChangeSummaries are marked with status ChangeStatusType.DEPLOYING.
      Specified by:
      deploy in interface DeploymentRequestHandler
      Parameters:
      scheduleGroups - Construct that identifies one or more ChangeSummaryGroup instances to be scheduled for a future deployment.
      summaries - The stream of ChangeSummary instances to deploy. Usually supplied as part of a TransitionRequestManager#promoteDeploy(PromoteSummaries, ContextInfo, String, boolean) style operation where user level changes are passed directly to deployment.
      context - Information about the deploy request containing the ID of the request's author.
      sandbox - The sandbox ID upon which to filter searches on when retrieving the group instances and their summaries.
      level - The tracking level from which to perform the deployment (see TrackingLevel)
    • deploy

      public void deploy(@NonNull ChangeSummaryGroups scheduleGroups, @NonNull Stream<ChangeSummary> summaries, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull String sandbox, int level, boolean vendorNarrowing)
      Description copied from interface: DeploymentRequestHandler
      Creates a new ChangeDeploy for the given ChangeSummaryGroups and executes immediate deployment. A WorkflowDeployRequest is emitted per change summary via the relevant Spring Cloud channel, and the given ChangeSummaryGroups and their ChangeSummaries are marked with status ChangeStatusType.DEPLOYING.
      Specified by:
      deploy in interface DeploymentRequestHandler
      Parameters:
      scheduleGroups - Construct that identifies one or more ChangeSummaryGroup instances to be scheduled for a future deployment.
      summaries - The stream of ChangeSummary instances to deploy. Usually supplied as part of a TransitionRequestManager#promoteDeploy(PromoteSummaries, ContextInfo, String, boolean) style operation where user level changes are passed directly to deployment.
      context - Information about the deploy request containing the ID of the request's author.
      sandbox - The sandbox ID upon which to filter searches on when retrieving the group instances and their summaries.
      level - The tracking level from which to perform the deployment (see TrackingLevel)
      vendorNarrowing - whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
    • unschedule

      public void unschedule(@NonNull String changeDeployId)
      Description copied from interface: DeploymentRequestHandler
      Accepts an ID for a ChangeDeploy that was previously scheduled and starts the process of unscheduling the deployment. The deployment, its groups, and their associated summaries have their statuses updated to ChangeStatusType.UNSCHEDULING, and a WorkflowJobUnschedulingRequest is published to actually unschedule the job.
      Specified by:
      unschedule in interface DeploymentRequestHandler
      Parameters:
      changeDeployId - the ID of the previously scheduled ChangeDeploy which should be unscheduled
      See Also:
    • unschedule

      public void unschedule(@NonNull String changeDeployId, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: DeploymentRequestHandler
      Accepts an ID for a ChangeDeploy that was previously scheduled and starts the process of unscheduling the deployment. The deployment, its groups, and their associated summaries have their statuses updated to ChangeStatusType.UNSCHEDULING, and a WorkflowJobUnschedulingRequest is published to actually unschedule the job.
      Specified by:
      unschedule in interface DeploymentRequestHandler
      Parameters:
      changeDeployId - the ID of the previously scheduled ChangeDeploy which should be unscheduled
      vendorNarrowing - whether to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
      contextInfo - context information about sandboxing and multitenant state
      See Also:
    • clear

      public void clear(@NonNull String changeDeployId, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: DeploymentRequestHandler
      Accepts an ID for a ChangeDeploy that previously failed and starts the process of clearing the error state of the deployment. This includes notifying (via special deployment case) all resource tier services with impacted entities. The resource tier service is responsible for rectifying the ChangeDetail state to obsolete for deployment version matches in the tracking information for affected entities.
      Specified by:
      clear in interface DeploymentRequestHandler
      Parameters:
      changeDeployId - The ID of the previously failed deployment
      vendorNarrowing - whether to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
      contextInfo - context information about sandboxing and multitenant state
    • schedule

      public void schedule(@NonNull ChangeSummaryGroups scheduleGroups, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull String sandbox, @NonNull Instant deployTime, int level)
      Description copied from interface: DeploymentRequestHandler
      Creates a new ChangeDeploy for the given ChangeSummaryGroups and schedules it for the given deployTime. The given ChangeSummaryGroups and their ChangeSummaries are marked with status ChangeStatusType.SCHEDULING, and a WorkflowJobSchedulingRequest is published to actually schedule the job
      Specified by:
      schedule in interface DeploymentRequestHandler
      Parameters:
      scheduleGroups - Construct that identifies one or more ChangeSummaryGroup instances to be scheduled for a future deployment.
      context - Information about the deploy request containing the ID of the request's author.
      sandbox - The sandbox ID upon which to filter searches on when retrieving the group instances and their summaries.
      deployTime - Time at which to deploy the items identified by the scheduleGroups param
      See Also:
    • schedule

      public void schedule(@NonNull ChangeSummaryGroups scheduleGroups, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull String sandbox, @NonNull Instant deployTime, int level, boolean vendorNarrowing)
      Description copied from interface: DeploymentRequestHandler
      Creates a new ChangeDeploy for the given ChangeSummaryGroups and schedules it for the given deployTime. The given ChangeSummaryGroups and their ChangeSummaries are marked with status ChangeStatusType.SCHEDULING, and a WorkflowJobSchedulingRequest is published to actually schedule the job
      Specified by:
      schedule in interface DeploymentRequestHandler
      Parameters:
      scheduleGroups - Construct that identifies one or more ChangeSummaryGroup instances to be scheduled for a future deployment.
      context - Information about the deploy request containing the ID of the request's author.
      sandbox - The sandbox ID upon which to filter searches on when retrieving the group instances and their summaries.
      deployTime - Time at which to deploy the items identified by the scheduleGroups param
      vendorNarrowing - whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
      See Also:
    • executeDeployment

      public void executeDeployment(String deployId)
      Description copied from interface: DeploymentRequestHandler
      Finds an existing, previously scheduled ChangeDeploy and sends out a WorkflowDeployRequest per ChangeSummary in the deployment via the relevant Spring Cloud channel. It will also mark the deployment's ChangeSummaryGroups and ChangeSummaries with status ChangeStatusType.DEPLOYING.
      Specified by:
      executeDeployment in interface DeploymentRequestHandler
      Parameters:
      deployId - Id of an existing, scheduled ChangeDeploy.
    • removeTemporaryPlaceholderFromAffectedVendors

      protected void removeTemporaryPlaceholderFromAffectedVendors(String deployId)
      If vendorProcessingEnabled, then updates the datastore such that the temporary placeholder from initializeVendorFields(ChangeDeploy) is removed from the given deployId.
      Parameters:
      deployId - the ID of the deployment from which to remove the temporary placeholder from affected vendors
      See Also:
      • initializeVendorFields(ChangeDeploy)
    • isVendorProcessingEnabled

      protected boolean isVendorProcessingEnabled()
      Whether or not vendor processing is enabled. This will determine how certain vendor-related fields on domains are initialized.
    • setVendorProcessingEnabled

      @Autowired public void setVendorProcessingEnabled(@Value("${broadleaf.sandbox.propagation.enabled:false}") boolean vendorProcessingEnabled)
      Whether or not vendor processing is enabled. This will determine how certain vendor-related fields on domains are initialized.