Class BulkUpdate

java.lang.Object
com.broadleafcommerce.bulk.domain.BulkUpdate
All Implemented Interfaces:
Serializable

public class BulkUpdate extends Object implements Serializable
An entity that holds the basic information required to track the status of a bulk update operation.
Author:
Samarth Dhruva (samarthd)
See Also:
  • Constructor Details

    • BulkUpdate

      public BulkUpdate(String id, String name)
      Convenience Constructor to set id and name
      Parameters:
      id -
      name -
    • BulkUpdate

      public BulkUpdate(String name)
      Convenience Constructor to set name
      Parameters:
      name -
    • BulkUpdate

      public BulkUpdate()
  • Method Details

    • getId

      public String getId()
      The unique identifier of the bulk update operation.
      Returns:
      the unique identifier of the bulk update operation
    • getName

      public String getName()
      The name of the bulk update operation.
      Returns:
      the name of the bulk update operation
    • getStatus

      public BulkUpdateStatus getStatus()
      The overall status of the bulk update. This value should be updated as progress is made.
      Returns:
      the overall status of the bulk update
      See Also:
    • getErrors

      public List<BulkUpdateError> getErrors()
      When the status is determined to be BulkUpdateStatus.ERROR, this field should be set to contain the reasoning for the failure.
      Returns:
      the errors that were encountered when processing the operation (if any)
      See Also:
      • status
    • getTotalRecordsToProcess

      public long getTotalRecordsToProcess()
      The total number of records that should be processed. This can be used in conjunction with numberOfRecordsProcessed to determine progress. This value should be determined before a request is made (ideally by running a count query that determines how many records will be targeted by the update).
      Returns:
      the total number of records that should be processed
    • getNumberOfRecordsProcessed

      public long getNumberOfRecordsProcessed()
      The number of records that have been successfully processed thus far. This value should be updated as progress is made.
      Returns:
      the number of records that have been successfully processed thus far
    • getFilterString

      public String getFilterString()
      The (by default, RSQL) filter string that should be used to find the records to update.

      Note: how to interpret filterString, inclusions, and exclusions is entirely left to BulkUpdateProcessor implementations.

      Returns:
      the filter string that should be used to find the records to update
      See Also:
    • getInclusions

      public List<String> getInclusions()
      A list of (additional) context IDs of specific entities which should receive updates.

      Note: how to interpret filterString, inclusions, and exclusions is entirely left to BulkUpdateProcessor implementations.

      Returns:
      a list of context IDs of specific entities which should receive updates
      See Also:
    • getExclusions

      public List<String> getExclusions()
      A list of context IDs of the entities which should not receive updates. This would be a filter to exclude any entities that are targeted for updating by filterString/inclusions.

      Note: how to interpret filterString, inclusions, and exclusions is entirely left to BulkUpdateProcessor implementations.

      Returns:
      a list of context IDs of the entities which should not receive updates
      See Also:
    • getCreated

      public Instant getCreated()
      The timestamp at which this operation was first created.
      Returns:
      the timestamp at which this operation was first created
    • getLastUpdated

      public Instant getLastUpdated()
      The timestamp at which this operation last experienced a change. This is very important, and should be constantly updated by the logic responsible for performing the actual entity updates. The value of this field will be compared against a timeout for operations that are marked as BulkUpdateStatus.REQUESTED or BulkUpdateStatus.PROCESSING in order to determine whether an operation is hanging or failed.
      Returns:
      the timestamp at which this operation last experienced a change
    • getType

      public String getType()
      The type of change that this update will be performing. This will be used by the logic that applies the updates to determine what needs to be done with serializedPayload.
      Returns:
      the type of change that this update will be performing
    • getSerializedPayload

      public String getSerializedPayload()
      The serialized representation of the requested changes to be made. This can vary greatly in structure - based on the value of type, the proper understanding and application of these changes is left to the logic that will actually apply the updates.
      Returns:
      the serialized representation of the requested changes to be made
    • getTarget

      public String getTarget()
      The target of the bulk update. This is some value that can be mapped to a particular domain by the logic performing an update, rather than requiring explicit persistence of the fully qualified classname. An example of a value would be "PRODUCT" or "CATEGORY"
      Returns:
      the target of the bulk update
      See Also:
    • getApplicationId

      public String getApplicationId()
      The context ID of the application that this bulk update operation was initiated from.
      Returns:
      the context ID of the application that this bulk update operation was initiated from
    • getTenantId

      public String getTenantId()
      The context ID of the tenant that this bulk update operation was initiated from.
      Returns:
      the context ID of the tenant that this bulk update operation was initiated from
    • getAuthor

      public String getAuthor()
      The email address of the author that initiated this bulk update operation. Derived from the current security principal when receiving a BulkUpdateRequest.
      Returns:
      the email address of the author that initiated this bulk update operation
    • getUpdatingApplicationId

      public String getUpdatingApplicationId()
      The ID of the application in which the update will be applied.
      Returns:
      the ID of the application in which the update will be applied
    • getUpdatingCustomerContextId

      public String getUpdatingCustomerContextId()
      The ID of the customer context in which the update will be applied.
      Returns:
      the ID of the customer context in which the update will be applied
    • getUpdatingCatalogId

      public String getUpdatingCatalogId()
      The ID of the catalog in which the update will be applied.
      Returns:
      the ID of the catalog in which the update will be applied
    • isProductionBulkUpdate

      public boolean isProductionBulkUpdate()
      Set to true if the bulk update changes should go directly to production. This is primarily intended for non-sandboxable entities.
      Returns:
      Whether the bulk update changes should go directly to production.
    • getUpdatingSandboxName

      public String getUpdatingSandboxName()
      The name of the new sandbox to create in which the update will be applied. Ignored if productionBulkUpdate is true.
      Returns:
      the name of the new sandbox to create and apply the update in
      See Also:
      • updatingSandboxId
    • getUpdatingSandboxId

      public String getUpdatingSandboxId()
      The ID of the sandbox in which the update will be applied.
      Returns:
      the ID of the sandbox in which the update will be applied
      See Also:
      • updatingSandboxName
    • setId

      public void setId(String id)
      The unique identifier of the bulk update operation.
      Parameters:
      id - the unique identifier of the bulk update operation
    • setName

      public void setName(String name)
      The name of the bulk update operation.
      Parameters:
      name - the name of the bulk update operation
    • setStatus

      public void setStatus(BulkUpdateStatus status)
      The overall status of the bulk update. This value should be updated as progress is made.
      Parameters:
      status - the overall status of the bulk update
      See Also:
    • setErrors

      public void setErrors(List<BulkUpdateError> errors)
      When the status is determined to be BulkUpdateStatus.ERROR, this field should be set to contain the reasoning for the failure.
      Parameters:
      errors - the errors that were encountered when processing the operation (if any)
      See Also:
      • status
    • setTotalRecordsToProcess

      public void setTotalRecordsToProcess(long totalRecordsToProcess)
      The total number of records that should be processed. This can be used in conjunction with numberOfRecordsProcessed to determine progress. This value should be determined before a request is made (ideally by running a count query that determines how many records will be targeted by the update).
      Parameters:
      totalRecordsToProcess - the total number of records that should be processed
    • setNumberOfRecordsProcessed

      public void setNumberOfRecordsProcessed(long numberOfRecordsProcessed)
      The number of records that have been successfully processed thus far. This value should be updated as progress is made.
      Parameters:
      numberOfRecordsProcessed - the number of records that have been successfully processed thus far
    • setFilterString

      public void setFilterString(String filterString)
      The (by default, RSQL) filter string that should be used to find the records to update.

      Note: how to interpret filterString, inclusions, and exclusions is entirely left to BulkUpdateProcessor implementations.

      Parameters:
      filterString - the filter string that should be used to find the records to update
      See Also:
    • setInclusions

      public void setInclusions(List<String> inclusions)
      A list of (additional) context IDs of specific entities which should receive updates.

      Note: how to interpret filterString, inclusions, and exclusions is entirely left to BulkUpdateProcessor implementations.

      Parameters:
      inclusions - a list of context IDs of specific entities which should receive updates
      See Also:
    • setExclusions

      public void setExclusions(List<String> exclusions)
      A list of context IDs of the entities which should not receive updates. This would be a filter to exclude any entities that are targeted for updating by filterString/inclusions.

      Note: how to interpret filterString, inclusions, and exclusions is entirely left to BulkUpdateProcessor implementations.

      Parameters:
      exclusions - a list of context IDs of the entities which should not receive updates
      See Also:
    • setCreated

      public void setCreated(Instant created)
      The timestamp at which this operation was first created.
      Parameters:
      created - the timestamp at which this operation was first created
    • setLastUpdated

      public void setLastUpdated(Instant lastUpdated)
      The timestamp at which this operation last experienced a change. This is very important, and should be constantly updated by the logic responsible for performing the actual entity updates. The value of this field will be compared against a timeout for operations that are marked as BulkUpdateStatus.REQUESTED or BulkUpdateStatus.PROCESSING in order to determine whether an operation is hanging or failed.
      Parameters:
      lastUpdated - the timestamp at which this operation last experienced a change
    • setType

      public void setType(String type)
      The type of change that this update will be performing. This will be used by the logic that applies the updates to determine what needs to be done with serializedPayload.
      Parameters:
      type - the type of change that this update will be performing
    • setSerializedPayload

      public void setSerializedPayload(String serializedPayload)
      The serialized representation of the requested changes to be made. This can vary greatly in structure - based on the value of type, the proper understanding and application of these changes is left to the logic that will actually apply the updates.
      Parameters:
      serializedPayload - the serialized representation of the requested changes to be made
    • setTarget

      public void setTarget(String target)
      The target of the bulk update. This is some value that can be mapped to a particular domain by the logic performing an update, rather than requiring explicit persistence of the fully qualified classname. An example of a value would be "PRODUCT" or "CATEGORY"
      Parameters:
      target - the target of the bulk update
      See Also:
    • setApplicationId

      public void setApplicationId(String applicationId)
      The context ID of the application that this bulk update operation was initiated from.
      Parameters:
      applicationId - the context ID of the application that this bulk update operation was initiated from
    • setTenantId

      public void setTenantId(String tenantId)
      The context ID of the tenant that this bulk update operation was initiated from.
      Parameters:
      tenantId - the context ID of the tenant that this bulk update operation was initiated from
    • setAuthor

      public void setAuthor(String author)
      The email address of the author that initiated this bulk update operation. Derived from the current security principal when receiving a BulkUpdateRequest.
      Parameters:
      author - the email address of the author that initiated this bulk update operation
    • setUpdatingApplicationId

      public void setUpdatingApplicationId(String updatingApplicationId)
      The ID of the application in which the update will be applied.
      Parameters:
      updatingApplicationId - the ID of the application in which the update will be applied
    • setUpdatingCustomerContextId

      public void setUpdatingCustomerContextId(String updatingCustomerContextId)
      The ID of the customer context in which the update will be applied.
      Parameters:
      customerContextId - the ID of the customer context in which the update will be applied
    • setUpdatingCatalogId

      public void setUpdatingCatalogId(String updatingCatalogId)
      The ID of the catalog in which the update will be applied.
      Parameters:
      updatingCatalogId - the ID of the catalog in which the update will be applied
    • setProductionBulkUpdate

      public void setProductionBulkUpdate(boolean productionBulkUpdate)
      Set to true if the bulk update changes should go directly to production. This is primarily intended for non-sandboxable entities.
      Parameters:
      productionBulkUpdate - Whether the bulk update changes should go directly to production.
    • setUpdatingSandboxName

      public void setUpdatingSandboxName(String updatingSandboxName)
      The name of the new sandbox to create in which the update will be applied. Ignored if productionBulkUpdate is true.
      Parameters:
      updatingSandboxName - the name of the new sandbox to create and apply the update in
      See Also:
      • updatingSandboxId
    • setUpdatingSandboxId

      public void setUpdatingSandboxId(String updatingSandboxId)
      The ID of the sandbox in which the update will be applied.
      Parameters:
      updatingSandboxId - the ID of the sandbox in which the update will be applied
      See Also:
      • updatingSandboxName
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object