Interface ChangeDeployService<P extends ChangeDeploy>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
All Known Implementing Classes:
DefaultChangeDeployService

public interface ChangeDeployService<P extends ChangeDeploy> extends com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
Service for working with instances. Primarily involves CRUD operations going through ChangeDeployRepository.
Author:
Nathan Moore (nathandmoore)
  • Method Details

    • readByIdAndNotArchived

      P readByIdAndNotArchived(@NonNull String id)
      Takes ChangeDeploy.getArchived() into account when retrieving a deployment with the given ID.
      Parameters:
      id - ID of the deployment to retrieve
      Returns:
      A ChangeDeploy matching the given ID and not archived
    • readByIdAndNotArchived

      P readByIdAndNotArchived(@NonNull String id, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Takes ChangeDeploy.getArchived() into account when retrieving a deployment with the given ID.
      Parameters:
      id - ID of the deployment to retrieve
      vendorNarrowing - whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
      contextInfo - context information about sandboxing and multitenant state
      Returns:
      A ChangeDeploy matching the given ID and not archived
    • updateVals

      boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String notificationStateName, @NonNull Map<String,Object> vals)
      Update the fields for a record matching the id.
      Parameters:
      changeDeployId - the ID of the deployment which should be updated
      whereStates - the ChangeState values which ChangeDeploy.getState() should match one or more of to qualify for this update
      whereStatus - the list of ChangeStatusType values which ChangeDeploy.getStatus() should match one or more of to qualify for this update. Can be empty.
      notificationStateName - (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified in updateVals
      vals - Map of field to value changes to make to the ChangeDeploy instance
      Returns:
      Whether or not an update was performed. If no record found matching the id and state, will return false.
    • updateVals

      boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String notificationStateName, @NonNull Map<String,Object> vals, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)

      Update the fields for a record matching the id.

      Calling this method is the same as calling updateVals(String, List, List, String, Map, boolean, boolean, ContextInfo), but with the insertNotificationStateIfMissing parameter set to false.

      Parameters:
      changeDeployId - the ID of the deployment which should be updated
      whereStates - the ChangeState values which ChangeDeploy.getState() should match one or more of to qualify for this update
      whereStatus - the list of ChangeStatusType values which ChangeDeploy.getStatus() should match one or more of to qualify for this update. Can be empty.
      notificationStateName - (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified in updateVals
      vals - Map of field to value changes to make to the ChangeDeploy instance
      vendorNarrowing - whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
      contextInfo - context information about sandboxing and multitenant state
      Returns:
      Whether or not an update was performed. If no record found matching the id and state, will return false.
    • updateVals

      boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String notificationStateName, @NonNull Map<String,Object> vals, boolean vendorNarrowing, boolean insertNotificationStateIfMissing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Update the fields for a record matching the id.
      Parameters:
      changeDeployId - the ID of the deployment which should be updated
      whereStates - the ChangeState values which ChangeDeploy.getState() should match one or more of to qualify for this update
      whereStatus - the list of ChangeStatusType values which ChangeDeploy.getStatus() should match one or more of to qualify for this update. Can be empty.
      notificationStateName - (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified in updateVals
      vals - Map of field to value changes to make to the ChangeDeploy instance
      vendorNarrowing - whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
      insertNotificationStateIfMissing - if vals target a notification state and notificationStateName is provided, this flag determines whether the flow will newly insert the notification state if it does not already exist in the datastore. In other words, when this flag is false, the flow will only try to update an existing notification state with the provided details in vals. When this flag is true, if the update attempt is unsuccessful because the notification state is missing, the flow will attempt to newly insert that state into the datastore.
      contextInfo - context information about sandboxing and multitenant state
      Returns:
      Whether or not an update was performed. If no record found matching the id and state, will return false.
      Since:
      Sandbox Service 2.0.6, Sandbox Service 2.1.3, Release Train 2.1.4, Release Train 2.2.0
      See Also:
    • updateValsAndReturn

      Optional<P> updateValsAndReturn(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String notificationStateName, @NonNull Map<String,Object> vals)
      Update the fields for a record matching the id, and return an Optional containing the value if it was successfully updated, Optional.empty() otherwise.
      Parameters:
      changeDeployId - the ID of the deployment which should be updated
      whereStates - the ChangeState values which ChangeDeploy.getState() should match one or more of to qualify for this update
      whereStatus - the list of ChangeStatusType values which ChangeDeploy.getStatus() should match one or more of to qualify for this update. Can be empty.
      notificationStateName - (optional) the name of the notification state that should be used to filter in the notification states array. This is relevant for update operations that want to modify a specific notification state with update values specified in updateVals
      vals - Map of field to value changes to make to the ChangeDeploy instance
      Returns:
      Optional.empty() if no record found matching the id and state, or if found and updated, an Optional containing the updated deployment
    • readChangeDeploys

      @Deprecated @NonNull org.springframework.data.domain.Page<P> readChangeDeploys(@Nullable String applicationId, @NonNull String state, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable pageable)
      Find a page of ChangeDeploy records based on the application and state. This drives visibility of state related to ChangeState.SCHEDULED and ChangeState.DEPLOYED.
      Parameters:
      applicationId - The application to filter deploys
      state - ChangeDeploy.getState()
      filters - the RSQL Node used to restrict result
      pageable - Page setup information
      Returns:
      page of matching records
    • readChangeDeploys

      @NonNull org.springframework.data.domain.Page<P> readChangeDeploys(@NonNull String sandbox, @NonNull String state, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable pageable, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find a page of ChangeDeploy records based on the sandbox and state. This drives visibility of state related to ChangeState.SCHEDULED and ChangeState.DEPLOYED.
      Parameters:
      sandbox - ChangeDeploy.getSandbox()
      state - ChangeDeploy.getState()
      filters - the RSQL Node used to restrict result
      pageable - Page setup information
      vendorNarrowing - whether or not to filter results based on the current authentication's vendor restrictions if vendor processing is enabled
      contextInfo - context information about sandboxing and multitenant state
      Returns:
      page of matching records
    • setAffectedVendors

      @Nullable P setAffectedVendors(String deployId, boolean affectsNonVendorData, Set<String> affectedVendorRefs)
      Atomically finds the ChangeDeploy with the given deployId and sets its ChangeDeploy.isAffectsNonVendorData() and ChangeDeploy.getAffectedVendorRefs() to the provided values.

      Internally, this method should rely on data-store locking mechanisms to protect against concurrent mutations.

      Parameters:
      deployId - the ID of the deploy to update
      affectsNonVendorData - the new value to set for ChangeDeploy.isAffectsNonVendorData()
      affectedVendorRefs - the new value to set for ChangeDeploy.getAffectedVendorRefs(). Cannot be null, but can be empty.
      Returns:
      the updated deployment if the update was successful, null otherwise
    • removeFromAffectedVendors

      boolean removeFromAffectedVendors(String deployId, String vendorRef)
      Atomically removes the given vendorRef from ChangeDeploy.getAffectedVendorRefs() of the given deployId if present.
      Parameters:
      deployId - the ID of the deploy to update
      vendorRef - the vendor ref to remove from ChangeDeploy.getAffectedVendorRefs()
      Returns:
      true if the removal was successful, false otherwise