Interface ProductIndex

All Superinterfaces:
Configurable
All Known Implementing Classes:
ExtentIndex, JDBCProductIndex

public interface ProductIndex extends Configurable
An index of products. The Indexer uses a ProductIndex to store received Products, and associate them together into Events. The transaction methods are used when one product results in several changes to the database. For instance, add a ProductSummary then add an association to an event.
  • Method Details

    • beginTransaction

      void beginTransaction() throws Exception
      If the index supports transactions, begin a transaction.
      Throws:
      Exception - if error occurs
    • commitTransaction

      void commitTransaction() throws Exception
      If the index supports transactions, and beginTransaction was previously called, commit the pending transaction.
      Throws:
      Exception - if error occurs
    • rollbackTransaction

      void rollbackTransaction() throws Exception
      If the index supports transactions, and beginTransaction was previously called, rollback the pending transaction.
      Throws:
      Exception - if error occurs
    • getEvents

      List<Event> getEvents(ProductIndexQuery query) throws Exception
      Get events in this index.
      Parameters:
      query - a description of which events to retrieve.
      Returns:
      a list of matching events.
      Throws:
      Exception - if error occurs
    • getProducts

      List<ProductSummary> getProducts(ProductIndexQuery query) throws Exception
      Get products in this index.
      Parameters:
      query - a description of which products to retrieve.
      Returns:
      a list of matching products.
      Throws:
      Exception - if error occurs
    • hasProduct

      boolean hasProduct(ProductId id) throws Exception
      Check whether index has product. May be more efficient than getProducts(ProductIndexQuery).
      Parameters:
      id - a ProductId
      Returns:
      boolean if index has product
      Throws:
      Exception - if error occurs
    • getUnassociatedProducts

      List<ProductSummary> getUnassociatedProducts(ProductIndexQuery query) throws Exception
      Get products in this index that aren't associated to any event.
      Parameters:
      query - a description of which products to retrieve.
      Returns:
      a list of unassociated products
      Throws:
      Exception - if error occurs
    • addEvent

      Event addEvent(Event event) throws Exception
      Add an event to the index.
      Parameters:
      event - the event to add.
      Returns:
      Copy of event with the eventId attribute set to the id in the database
      Throws:
      Exception - if error occurs
    • removeEvent

      List<ProductId> removeEvent(Event event) throws Exception
      Remove an event from the index.
      Parameters:
      event - the event to remove.
      Returns:
      Copy of the event removed
      Throws:
      Exception - if the event is associated to products.
    • addProductSummary

      ProductSummary addProductSummary(ProductSummary summary) throws Exception
      Add a product summary to the index.
      Parameters:
      summary - the summary to add.
      Returns:
      Copy of the product summary object with the indexId set to the newly inserted id.
      Throws:
      Exception - if error occurs
    • removeProductSummary

      ProductId removeProductSummary(ProductSummary summary) throws Exception
      Remove a product summary from the index.
      Parameters:
      summary - the summary to remove.
      Returns:
      id of removed summary.
      Throws:
      Exception - if error occurs
    • addAssociation

      Event addAssociation(Event event, ProductSummary summary) throws Exception
      Associate an Event and ProductSummary that are already in the index.
      Parameters:
      event - the event.
      summary - the summary.
      Returns:
      Copy of event with summary added to the products list
      Throws:
      Exception - if error occurs
    • removeAssociation

      Event removeAssociation(Event event, ProductSummary summary) throws Exception
      Remove an association between and Event and ProductSummary.
      Parameters:
      event - the event.
      summary - the summary.
      Returns:
      Copy of event with summary removed from the products list
      Throws:
      Exception - if error occurs
    • eventsUpdated

      void eventsUpdated(List<Event> events) throws Exception
      An opportunity for the ProductIndex to update summary information it may or may not store for efficient event searches. This method is called by the indexer after it has finished updating events during onProduct.
      Parameters:
      events - events that may have new preferred attributes.
      Throws:
      Exception - if error occurs