Class BTBatch<I,O,E extends SimpleBusinessEvent<I,O>,B extends BatchEvent<I,O>>

Type Parameters:
I - the type of input items to be processed
O - the type of output items produced by processing
E - the type of business event used to process each input item
B - the type of batch event containing the collection of input items
All Implemented Interfaces:
Serializable, Tool, ValidExecution
Direct Known Subclasses:
BTAccountInsertBatch, BTAddressGeocodingSaveBatch, BTAddressInsertBatch, BTAddressUpdateBatch, BTAssetCharacteristicValueInsertBatch, BTAssetCharacteristicValueUpdateBatch, BTAssetChildInsertBatch, BTAssetInsertBatch, BTAssetTypeTemplateCharacteristicInsertBatch, BTAssetTypeTemplateCharacteristicUpdateBatch, BTAssetUpdateBatch, BTLinearAssetLocationUpdateBatch, BTMeasureInsertBatch, BTMeasureRejectBatch, BTMeasureUpdateBatch, BTMeasureValidateBatch, BTMeterInsertBatch, BTMeterUpdateBatch, BTMobileErrorLogInsertBatch, BTWorkOrderOperationInsertBatch, BTWorkOrderOperationUpdateBatch, BTWorkShiftExceptionDeleteBatch, BTWorkShiftExceptionInsertBatch, BTWorkShiftExceptionUpdateBatch

public abstract class BTBatch<I,O,E extends SimpleBusinessEvent<I,O>,B extends BatchEvent<I,O>> extends ValidPermissionBusinessTask<B>
Abstract base class for batch processing tasks that execute multiple business events.
This class provides a framework for processing a collection of input items through individual business events and collecting their results. It handles the creation and execution of business events for each input item in the batch.
Since:
1.0
See Also:
GCApi:
task
  • Field Details

  • Constructor Details

    • BTBatch

      public BTBatch()
  • Method Details

    • execute

      protected void execute(B event, PoolKit poolKit) throws DAException, DAValidateException
      Executes the batch processing by iterating through all input items in the batch event. For each input item, this method creates and executes a business event of type E, collects the results, and adds them to the batch output. The final collection of results is written to the event journal.
      Specified by:
      execute in class ValidExecutionBusinessTask<B extends BatchEvent<I,O>>
      Parameters:
      event - the batch event containing the collection of input items to process
      poolKit - the database connection pool kit
      Throws:
      DAException - if a data access error occurs during processing
      DAValidateException - if a validation error occurs during processing
    • getBusinessEventClass

      public abstract Class<E> getBusinessEventClass()
      Returns the class of the business event to be used for processing each input item. This method must be implemented by subclasses to specify which business event class should be instantiated for each input item in the batch.
      Returns:
      the class object representing the business event type
    • executeEvent

      protected O executeEvent(Class<E> eventClass, I eventInput, PoolKit poolKit) throws DAException, DAValidateException
      Executes a single business event for an individual input item. This method creates a new instance of the specified business event class using reflection, initializes it with the provided input, and launches the event to process the input and produce a result.
      Parameters:
      eventClass - the class of the business event to instantiate
      eventInput - the input item to process
      poolKit - the database connection pool kit
      Returns:
      the result of processing the input item
      Throws:
      DAException - if a data access error occurs during processing
      DAValidateException - if a validation error occurs during processing
    • getEventConstructor

      protected Constructor<E> getEventConstructor(Class<E> eventClass, Class<?> inputClass)
    • isValidExecution

      public boolean isValidExecution()
      Determines whether the batch task is valid for execution. This implementation always returns true, indicating that batch tasks are always valid for execution. Subclasses can override this method to implement specific validation logic if needed.
      Returns:
      true, indicating that the batch task is valid for execution