Interface ChangeSummaryService<P extends ChangeSummary>

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

public interface ChangeSummaryService<P extends ChangeSummary> extends com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
Service for working with instances. Primarily involves CRUD operations going through ChangeSummaryRepository.
Author:
Chad Harchar (charchar)
  • Method Details

    • readByIdAndNotArchived

      P readByIdAndNotArchived(@NonNull String id)
      Takes ChangeSummary.getArchived() into account when retrieving a summary with the given ID.
      Parameters:
      id - ID of the summary to retrieve
      Returns:
      A ChangeSummary 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 ChangeSummary.getArchived() into account when retrieving a summary with the given ID.
      Parameters:
      id - ID of the summary 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 ChangeSummary matching the given ID and not archived
    • readByIdAndNotArchivedWithDivergenceDetection

      @Deprecated P readByIdAndNotArchivedWithDivergenceDetection(@NonNull String id)
      Takes ChangeSummary.getArchived() into account when retrieving a summary with the given ID. Also will populate the ChangeSummary.getDivergentStatus() field.
      Parameters:
      id - ID of the summary to retrieve
      Returns:
      A ChangeSummary matching the given ID and not archived
    • readByIdAndNotArchivedWithDivergenceDetection

      P readByIdAndNotArchivedWithDivergenceDetection(@NonNull String id, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Takes ChangeSummary.getArchived() into account when retrieving a summary with the given ID. Also will populate the ChangeSummary.getDivergentStatus() field.
      Parameters:
      id - ID of the summary 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 ChangeSummary matching the given ID and not archived
    • readChangeSummary

      @NonNull Optional<P> readChangeSummary(@NonNull ChangeSummaryRequest changeSummaryRequest)
      Find an existing record with the corresponding matching values that determine uniqueness.
      Parameters:
      changeSummaryRequest - Request DTO to find a matching change summary
      Returns:
      an optional matching record
    • readMatchingChangeSummary

      @NonNull Optional<P> readMatchingChangeSummary(@NonNull P changeSummary)
      Find a matching change summary using the provided instance. Default implementation will check against the five fields that determine uniqueness for a change summary.
      Parameters:
      changeSummary - The change summary to use when looking for an existing match
      Returns:
      The existing matching change summary to the one provided
    • readChangeSummariesByAuthor

      @Deprecated @NonNull Stream<P> readChangeSummariesByAuthor(@NonNull String author, @NonNull String sandbox, @NonNull String state, @Nullable List<String> status)
      Find all records belonging to the current author, sandbox and ChangeState
      Parameters:
      author - ChangeSummary.getAuthor()
      sandbox - ChangeSummary.getSandbox()
      state - ChangeSummary.getState()
      status - Optional ChangeSummary.getStatus()
      Returns:
      A Stream that can be iterated, possibly containing a large number or records
    • readChangeSummariesByAuthor

      @NonNull Stream<P> readChangeSummariesByAuthor(@NonNull String author, @NonNull String sandbox, @NonNull String state, @Nullable List<String> status, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all records belonging to the current author, sandbox and ChangeState
      Parameters:
      author - ChangeSummary.getAuthor()
      sandbox - ChangeSummary.getSandbox()
      state - ChangeSummary.getState()
      status - Optional ChangeSummary.getStatus()
      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 Stream that can be iterated, possibly containing a large number or records
    • readChangeSummariesByAuthor

      @Deprecated @NonNull Stream<P> readChangeSummariesByAuthor(@NonNull String author, @NonNull String sandbox, @NonNull String state, @Nullable List<String> status, @NonNull List<String> ids)
      Find all records belonging to the current author, sandbox and ChangeState
      Parameters:
      author - ChangeSummary.getAuthor()
      sandbox - ChangeSummary.getSandbox()
      state - ChangeSummary.getState()
      status - Optional ChangeSummary.getStatus()
      ids - The list of ids to which the fetch should be limited
      Returns:
      A Stream that can be iterated, possibly containing a large number or records
    • readChangeSummariesByAuthor

      @NonNull Stream<P> readChangeSummariesByAuthor(@NonNull String author, @NonNull String sandbox, @NonNull String state, @Nullable List<String> status, @NonNull List<String> ids, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all records belonging to the current author, sandbox and ChangeState
      Parameters:
      author - ChangeSummary.getAuthor()
      sandbox - ChangeSummary.getSandbox()
      state - ChangeSummary.getState()
      status - Optional ChangeSummary.getStatus()
      ids - The list of ids to which the fetch should be limited
      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 Stream that can be iterated, possibly containing a large number or records
    • readChangeSummaryIdsByAuthor

      @NonNull List<String> readChangeSummaryIdsByAuthor(@NonNull String author, @NonNull String sandbox, @NonNull String state, List<String> status)
      Find all record ids belonging to the current author, sandbox and ChangeState
      Parameters:
      author - ChangeSummary.getAuthor()
      sandbox - ChangeSummary.getSandbox()
      state - ChangeSummary.getState()
      status - Optional ChangeSummary.getStatus()
      Returns:
      A Stream that can be iterated, possibly containing a large number or records
    • readDeployFailedChangeSummaries

      @NonNull Stream<P> readDeployFailedChangeSummaries(@NonNull String deployId, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all records marked with status ERROR_DEPLOY for the requested deployId.
      Parameters:
      deployId - The deployment to which the records are associated
      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
      Returns:
      All records marked with status ERROR_DEPLOY for the requested deployId as a stream
    • readChangeSummariesByIds

      @NonNull Stream<P> readChangeSummariesByIds(List<String> changeSummaryIds, List<String> states, List<String> statuses, @NonNull String sandbox)
      Find all records in the list of ids that also have the requested state.
      Parameters:
      changeSummaryIds - The requested list of ChangeSummary.getId()
      states - The required matching state ChangeSummary.getState(), cannot be empty
      statuses - Optional ChangeSummary.getStatus()
      sandbox - The sandbox to filter records by
      Returns:
      A Stream that can be iterated, possibly containing a large number or records
      Throws:
      IllegalArgumentException - if no states to filter by
    • readChangeSummariesByIds

      @NonNull Stream<P> readChangeSummariesByIds(List<String> changeSummaryIds, List<String> states, List<String> statuses, @NonNull String sandbox, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all records in the list of ids that also have the requested state.
      Parameters:
      changeSummaryIds - The requested list of ChangeSummary.getId()
      states - The required matching state ChangeSummary.getState(), cannot be empty
      statuses - Optional ChangeSummary.getStatus()
      sandbox - The sandbox to filter records by
      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 Stream that can be iterated, possibly containing a large number or records
      Throws:
      IllegalArgumentException - if no states to filter by
    • readChangeSummariesByIdsCount

      @NonNull Long readChangeSummariesByIdsCount(@NonNull List<String> changeSummaryIds, List<String> states, List<String> statuses, @NonNull String sandbox)
      Find the count of all records in the list of ids that also have the requested state.
      Parameters:
      changeSummaryIds - The requested list of ChangeSummary.getId()
      states - The required matching state ChangeSummary.getState(), cannot be empty
      statuses - Optional ChangeSummary.getStatus()
      sandbox - The sandbox to filter records by
      Returns:
      A Stream that can be iterated, possibly containing a large number or records
      Throws:
      IllegalArgumentException - if no states to filter by
    • readChangeSummariesByIds

      @Deprecated @NonNull Stream<P> readChangeSummariesByIds(@NonNull List<String> changeSummaryIds)
      Deprecated.
      Find all records for the provided list of ids.
      Parameters:
      changeSummaryIds - the ids to find Change Summaries against
      Returns:
      all matching Change Summaries for the provided ids
    • readChangeSummariesByIds

      @NonNull Stream<P> readChangeSummariesByIds(@NonNull List<String> changeSummaryIds, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all records for the provided list of ids.
      Parameters:
      changeSummaryIds - the ids to find Change Summaries against
      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:
      all matching Change Summaries for the provided ids
    • batchTransition

      void batchTransition(SummaryBasedFlushContext flushContext)
      Given a PromoteBatchFlushContext containing ChangeSummary transition information, update the state of all change summaries in a batch transaction. This includes updating notification states for durable messaging.
      Parameters:
      flushContext - Context object containing all change summary transition to batch commit
    • batchTransition

      void batchTransition(StateChangeOnlyBatchFlushContext flushContext)
      Update ChangeSummary instances in bulk (identified by SummaryBasedFlushContext.getSummaryUpdates()) in order to mutate state (such as ChangeSummary.getState()).
      Parameters:
      flushContext - Context object containing the change summary transition information to commit
    • updateVals

      boolean updateVals(@NonNull String changeSummaryId, List<String> whereStates, List<String> whereStatuses, @Nullable String messageType, Map<String,Object> vals)

      Update the fields for a record matching the id

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

      Parameters:
      changeSummaryId - The id requested to mutate
      whereStates - The current state of the ChangeSummary to match. Optional.
      whereStatuses - list of status values that a ChangeSummary should match one or more of. Optional.
      messageType - if some of the vals target a notification state of a certain message type, this value should be supplied to filter to that state. Optional.
      vals - Map of field to value changes to make to the ChangeSummary instance
      Returns:
      Whether or not an update was performed. If no record found matching the id and state, will return false.
      Throws:
      IllegalArgumentException - if there were no vals to update
    • updateVals

      boolean updateVals(@NonNull String changeSummaryId, List<String> whereStates, List<String> whereStatuses, @Nullable String messageType, Map<String,Object> vals, boolean insertNotificationStateIfMissing)
      Update the fields for a record matching the id
      Parameters:
      changeSummaryId - The id requested to mutate
      whereStates - The current state of the ChangeSummary to match. Optional.
      whereStatuses - list of status values that a ChangeSummary should match one or more of. Optional.
      messageType - if some of the vals target a notification state of a certain message type, this value should be supplied to filter to that state. Optional.
      vals - Map of field to value changes to make to the ChangeSummary instance
      insertNotificationStateIfMissing - if vals target a notification state and messageType 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.
      Returns:
      Whether or not an update was performed. If no record found matching the id and state, will return false.
      Throws:
      IllegalArgumentException - if there were no vals to update
      Since:
      Sandbox Service 2.0.6, Sandbox Service 2.1.3, Release Train 2.1.4, Release Train 2.2.0
      See Also:
    • updateVals

      void updateVals(@NonNull List<String> changeSummaryIds, @Nullable String whereState, @Nullable List<String> whereStatus, @NonNull Map<String,Object> vals)
      Update the fields for all non-archived records matching the ids
      Parameters:
      changeSummaryIds - The ids requested to mutate
      whereState - The current state of the ChangeSummary to match. Optional.
      whereStatus - list of status values that a ChangeSummary should match one or more of. Optional.
      vals - Map of field to value changes to make to the ChangeSummary instance
    • changesOwnedByAuthor

      boolean changesOwnedByAuthor(@NonNull String author, @NonNull List<String> changeSummaryIds)
      Whether or not all the ChangeSummary instances identified by the changeSummaryIds are owned by the requesting author.
      Parameters:
      author - The author making the request. ContextInfo.getAuthor()
      changeSummaryIds - The ids requested to mutate
      Returns:
      Whether or not all the requested ids belong to ChangeSummary instances owned by the author
    • readDivergedChangeSummariesByAuthor

      @NonNull List<String> readDivergedChangeSummariesByAuthor(@NonNull String author, @NonNull String sandbox)
      Find all records belonging to the current author and sandbox containing one or more ChangeDetail values which has become diverged due to another change already promoted by another user.
      Parameters:
      author - ChangeSummary.getAuthor()
      sandbox - ChangeSummary.getSandbox()
      Returns:
      The list of diverged ChangeSummary.getId() values
    • readDivergedChangeSummariesByIds

      @NonNull List<String> readDivergedChangeSummariesByIds(@NonNull List<String> changeSummaryIds, @NonNull String sandbox)
      Find all identified records belonging to the current sandbox containing one or more ChangeDetail values which has become diverged due to another change already promoted by another user.
      Parameters:
      changeSummaryIds - The requested list of ChangeSummary.getId()
      sandbox - The sandbox for which change summaries should be filtered
      Returns:
      The list of diverged ChangeSummary.getId() values
    • readAllByAuthorAndSandbox

      @Deprecated @NonNull org.springframework.data.domain.Page<P> readAllByAuthorAndSandbox(@NonNull String author, @NonNull String sandbox, @Nullable String[] statuses, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page)
      Find all ChangeSummaries for the provided author and sandbox.
      Parameters:
      author - the author of the change summaries to return
      sandbox - the sandbox associated to the change summaries to return
      statuses - the list of ChangeStatusType values for which a ChangeSummary.getStatus() should match one of. Optional.
      filters - the RSQL Node used to restrict result
      page - pagination information
      Returns:
      all Change Summaries for the author and sandbox provided
    • readAllByAuthorAndSandbox

      @NonNull org.springframework.data.domain.Page<P> readAllByAuthorAndSandbox(@NonNull String author, @NonNull String sandbox, @Nullable String[] statuses, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all ChangeSummaries for the provided author and sandbox.
      Parameters:
      author - the author of the change summaries to return
      sandbox - the sandbox associated to the change summaries to return
      statuses - the list of ChangeStatusType values for which a ChangeSummary.getStatus() should match one of. Optional.
      filters - the RSQL Node used to restrict result
      page - pagination 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:
      all Change Summaries for the author and sandbox provided
    • readAllByAuthorAndSandboxWithDivergenceDetection

      @Deprecated @NonNull org.springframework.data.domain.Page<P> readAllByAuthorAndSandboxWithDivergenceDetection(@NonNull String author, @NonNull String sandbox, @Nullable String[] statuses, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page)
      Find all ChangeSummaries for the provided author and sandbox. Also will populate the ChangeSummary.getDivergentStatus() field.
      Parameters:
      author - the author of the change summaries to return
      sandbox - the sandbox associated to the change summaries to return
      statuses - the list of ChangeStatusType values for which a ChangeSummary.getStatus() should match one of. Optional.
      filters - the RSQL Node used to restrict result
      page - pagination information
      Returns:
      all Change Summaries for the author and sandbox provided
    • readAllByAuthorAndSandboxWithDivergenceDetection

      @NonNull org.springframework.data.domain.Page<P> readAllByAuthorAndSandboxWithDivergenceDetection(@NonNull String author, @NonNull String sandbox, @Nullable String[] statuses, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all ChangeSummaries for the provided author and sandbox. Also will populate the ChangeSummary.getDivergentStatus() field.
      Parameters:
      author - the author of the change summaries to return
      sandbox - the sandbox associated to the change summaries to return
      statuses - the list of ChangeStatusType values for which a ChangeSummary.getStatus() should match one of. Optional.
      filters - the RSQL Node used to restrict result
      page - pagination 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:
      all Change Summaries for the author and sandbox provided
    • readSandboxChangeSummaries

      @Deprecated @NonNull List<P> readSandboxChangeSummaries(@NonNull ChangeInfoRequest changeInfoRequest)
      Find all ChangeSummaries with corresponding matching values to the provided ChangeInfoRequest that are in the ChangeState.PROMOTED, ChangeState.APPROVED, or ChangeState.SCHEDULED state.
      Parameters:
      changeInfoRequest - the request data for retrieving ChangeSummaries
      Returns:
      all records with the corresponding matching values in the ChangeState.PROMOTED, ChangeState.APPROVED, or ChangeState.SCHEDULED state
    • readSandboxChangeSummaries

      @NonNull List<P> readSandboxChangeSummaries(@NonNull ChangeInfoRequest changeInfoRequest, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all ChangeSummaries with corresponding matching values to the provided ChangeInfoRequest that are in the ChangeState.PROMOTED, ChangeState.APPROVED, or ChangeState.SCHEDULED state.
      Parameters:
      changeInfoRequest - the request data for retrieving ChangeSummaries
      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:
      all records with the corresponding matching values in the ChangeState.PROMOTED, ChangeState.APPROVED, or ChangeState.SCHEDULED state
    • readUserChangeSummaries

      @Deprecated @NonNull List<P> readUserChangeSummaries(@NonNull ChangeInfoRequest changeInfoRequest, boolean scheduled)
      Find the ChangeState.USER ChangeSummaries that match the provided values in ChangeInfoRequest.
      Parameters:
      changeInfoRequest - the request data for retrieving ChangeSummaries
      scheduled - Applies to a user change summary that is in a scheduled for deploy state ChangeState.SCHEDULED. This state can occur during a TransitionRequestManager#promoteDeploy(PromoteSummaries, ContextInfo, String, boolean) flow (espcially when there was an error during the deployment).
      Returns:
      the ChangeState.USER ChangeSummaries that match the provided criteria
    • readUserChangeSummaries

      @NonNull List<P> readUserChangeSummaries(@NonNull ChangeInfoRequest changeInfoRequest, boolean scheduled, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find the ChangeState.USER ChangeSummaries that match the provided values in ChangeInfoRequest.
      Parameters:
      changeInfoRequest - the request data for retrieving ChangeSummaries
      scheduled - Applies to a user change summary that is in a scheduled for deploy state ChangeState.SCHEDULED. This state can occur during a TransitionRequestManager#promoteDeploy(PromoteSummaries, ContextInfo, String, boolean) flow (espcially when there was an error during the deployment).
      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:
      the ChangeState.USER ChangeSummaries that match the provided criteria
    • readAllByChangeInfoRequest

      @Deprecated @NonNull List<P> readAllByChangeInfoRequest(@NonNull ChangeInfoRequest changeInfoRequest)
      Retrieves ChangeSummaries for both ChangeState.USER and ChangeState.PROMOTED states against the provided ChangeInfoRequest.
      Parameters:
      changeInfoRequest - the request data for retrieving ChangeSummaries
      Returns:
      ChangeSummaries retrieved from the provided ChangeInfoRequest
    • readAllByChangeInfoRequest

      @NonNull List<P> readAllByChangeInfoRequest(@NonNull ChangeInfoRequest changeInfoRequest, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves ChangeSummaries for both ChangeState.USER and ChangeState.PROMOTED states against the provided ChangeInfoRequest.
      Parameters:
      changeInfoRequest - the request data for retrieving ChangeSummaries
      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:
      ChangeSummaries retrieved from the provided ChangeInfoRequest
    • findCompletedTempSandboxByExample

      @Nullable String findCompletedTempSandboxByExample(String changeSummaryId)
      Based on the example change summary id, check if the change summary refers to a temporary sandbox. Return null if not. If so, find the count of remaining active ChangeSummary instances that also refer to that sandbox. A returned sandbox id indicates all ChangeSummary instances have completed their lifecycle and the sandbox can be archived. If there are still active ChangeSummary instances for the sandbox, null is returned. See ChangeSummary#isTemporarySandbox().
      Parameters:
      changeSummaryId - The id of the ChangeSummary to check for temporary sandbox status.
      Returns:
      null if not associated with a temporary sandbox, or some ChangeSummaries are still active against the sandbox. Otherwise, the sandbox id of the Sandbox that can be archived.
    • archiveNotActiveChangeSummariesForSandbox

      @Transactional("sandboxTransactionManager") void archiveNotActiveChangeSummariesForSandbox(String sandboxId)
      Archives the ChangeSummary for the specified sandbox id.
      Parameters:
      sandboxId - the sandbox id associated to the change summaries
      Throws:
      ArchiveChangeSummaryException - if there are ChangeSummary in active state.
      See Also:
    • findArchivedBySandbox

      List<P> findArchivedBySandbox(String sandboxId)
      Find all archived ChangeSummary for the provided sandbox id.
      Parameters:
      sandboxId - he sandbox id associated to the change summaries
      Returns:
      the list of archived ChangeSummary