Class DefaultChangeDeployService<P extends ChangeDeploy>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P>
com.broadleafcommerce.sandbox.service.DefaultChangeDeployService<P>
Type Parameters:
P - The type of the business instance
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>, ChangeDeployService<P>

public class DefaultChangeDeployService<P extends ChangeDeploy> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService<P> implements ChangeDeployService<P>
Author:
Nathan Moore (nathandmoore)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultChangeDeployService(ChangeDeployRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Takes ChangeDeploy.getArchived() into account when retrieving a deployment with the given ID.
    readByIdAndNotArchived(String id, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Takes ChangeDeploy.getArchived() into account when retrieving a deployment with the given ID.
    org.springframework.data.domain.Page<P>
    readChangeDeploys(String applicationId, String state, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
    Deprecated.
    org.springframework.data.domain.Page<P>
    readChangeDeploys(String sandbox, String state, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find a page of ChangeDeploy records based on the sandbox and state.
    boolean
    removeFromAffectedVendors(@NonNull String deployId, @NonNull String vendorRef)
    Atomically removes the given vendorRef from ChangeDeploy.getAffectedVendorRefs() of the given deployId if present.
    setAffectedVendors(@NonNull String deployId, boolean affectsNonVendorData, @NonNull Set<String> affectedVendorRefs)
    Atomically finds the ChangeDeploy with the given deployId and sets its ChangeDeploy.isAffectsNonVendorData() and ChangeDeploy.getAffectedVendorRefs() to the provided values.
    boolean
    updateVals(String changeDeployId, List<String> whereStates, List<String> whereStatus, String noticationStateName, Map<String,Object> vals)
    Update the fields for a record matching the id.
    boolean
    updateVals(String changeDeployId, List<String> whereStates, List<String> whereStatus, String noticationStateName, Map<String,Object> vals, boolean vendorNarrowing, boolean insertNotificationStateIfMissing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update the fields for a record matching the id.
    boolean
    updateVals(String changeDeployId, List<String> whereStates, List<String> whereStatus, String noticationStateName, Map<String,Object> vals, boolean vendorNarrowing, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update the fields for a record matching the id.
    updateValsAndReturn(String changeDeployId, List<String> whereStates, List<String> whereStatus, String notificationStateName, 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.

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlMappableCrudEntityService

    getRsqlHelper, readAll, readAll, readAll, readAll

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService

    convertFromPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService

    readAll, readAll, readAll, readAll
  • Constructor Details

    • DefaultChangeDeployService

      public DefaultChangeDeployService(ChangeDeployRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityHelper helper)
  • Method Details

    • readByIdAndNotArchived

      public P readByIdAndNotArchived(@NonNull String id)
      Description copied from interface: ChangeDeployService
      Takes ChangeDeploy.getArchived() into account when retrieving a deployment with the given ID.
      Specified by:
      readByIdAndNotArchived in interface ChangeDeployService<P extends ChangeDeploy>
      Parameters:
      id - ID of the deployment to retrieve
      Returns:
      A ChangeDeploy matching the given ID and not archived
    • readByIdAndNotArchived

      public P readByIdAndNotArchived(@NonNull String id, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ChangeDeployService
      Takes ChangeDeploy.getArchived() into account when retrieving a deployment with the given ID.
      Specified by:
      readByIdAndNotArchived in interface ChangeDeployService<P extends ChangeDeploy>
      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

      public boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String noticationStateName, @NonNull Map<String,Object> vals)
      Description copied from interface: ChangeDeployService
      Update the fields for a record matching the id.
      Specified by:
      updateVals in interface ChangeDeployService<P extends ChangeDeploy>
      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.
      noticationStateName - (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

      public boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String noticationStateName, @NonNull Map<String,Object> vals, boolean vendorNarrowing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ChangeDeployService

      Update the fields for a record matching the id.

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

      Specified by:
      updateVals in interface ChangeDeployService<P extends ChangeDeploy>
      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.
      noticationStateName - (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

      public boolean updateVals(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String noticationStateName, @NonNull Map<String,Object> vals, boolean vendorNarrowing, boolean insertNotificationStateIfMissing, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ChangeDeployService
      Update the fields for a record matching the id.
      Specified by:
      updateVals in interface ChangeDeployService<P extends ChangeDeploy>
      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.
      noticationStateName - (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.
      See Also:
    • updateValsAndReturn

      public Optional<P> updateValsAndReturn(@NonNull String changeDeployId, List<String> whereStates, List<String> whereStatus, @Nullable String notificationStateName, @NonNull Map<String,Object> vals)
      Description copied from interface: ChangeDeployService
      Update the fields for a record matching the id, and return an Optional containing the value if it was successfully updated, Optional.empty() otherwise.
      Specified by:
      updateValsAndReturn in interface ChangeDeployService<P extends ChangeDeploy>
      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

      @NonNull @Deprecated public 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)
      Deprecated.
      Description copied from interface: ChangeDeployService
      Find a page of ChangeDeploy records based on the application and state. This drives visibility of state related to ChangeState.SCHEDULED and ChangeState.DEPLOYED.
      Specified by:
      readChangeDeploys in interface ChangeDeployService<P extends ChangeDeploy>
      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 public 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)
      Description copied from interface: ChangeDeployService
      Find a page of ChangeDeploy records based on the sandbox and state. This drives visibility of state related to ChangeState.SCHEDULED and ChangeState.DEPLOYED.
      Specified by:
      readChangeDeploys in interface ChangeDeployService<P extends ChangeDeploy>
      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 public P setAffectedVendors(@NonNull @NonNull String deployId, boolean affectsNonVendorData, @NonNull @NonNull Set<String> affectedVendorRefs)
      Description copied from interface: ChangeDeployService
      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.

      Specified by:
      setAffectedVendors in interface ChangeDeployService<P extends ChangeDeploy>
      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

      public boolean removeFromAffectedVendors(@NonNull @NonNull String deployId, @NonNull @NonNull String vendorRef)
      Description copied from interface: ChangeDeployService
      Atomically removes the given vendorRef from ChangeDeploy.getAffectedVendorRefs() of the given deployId if present.
      Specified by:
      removeFromAffectedVendors in interface ChangeDeployService<P extends ChangeDeploy>
      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
    • getRepository

      @NonNull protected ChangeDeployRepository<?> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends ChangeDeploy>