Interface QuoteHelper

All Superinterfaces:
LineItemHelper, Reviewable
All Known Subinterfaces:
QuotePersistedHelper

public interface QuoteHelper extends LineItemHelper, Reviewable
A helper interface that assists in manipulating the quote object. An instance can be obtained via call quoteProcessor.getHelper() from a quote header logic.

Example:

  def isOpportunity = quoteProcessor.getHelper().getRoot().getInputByName("IsOpportunity")?.value
 
See Also:
  • Method Details

    • findAllWithSKU

      List<LineItemHelper.LineItem> findAllWithSKU(String sku)
      Retrieves a list of all line items that are for a particular sku.
      Parameters:
      sku - The sku to search for
      Returns:
      The list of line items
    • getItemsForReviewIterator

      LineItemIterator getItemsForReviewIterator()
      Streaming variant of Reviewable.getItemsForReview(), preferred for quotes with many line items.

      When the persisted quote calculation processor is enabled on the QuoteType, the items are fetched from the database one at a time instead of all being held in memory; otherwise the in-memory items are simply wrapped. Either way the iterator must be closed after use.

      Example:

      
       def helper = quoteProcessor.getHelper()
       if (helper.isInReview()) {
           helper.getItemsForReviewIterator().withCloseable { items ->
               items.each { item -> api.logInfo("Reviewing item", item.lineId) }
           }
       }
       
      Returns:
      an iterator over the line items assigned to the current user for review, empty if not in review; must be closed after use (try-with-resources or withCloseable)
    • getLineItemsIterator

      LineItemIterator getLineItemsIterator()
      Streaming iterator over all line items of this quote, preferred over walking quoteProcessor.getQuoteView() for quotes with many line items.

      When the persisted quote calculation processor is enabled on the QuoteType, the items are fetched from the database one at a time instead of all being held in memory; otherwise the in-memory items are simply wrapped. Either way the iterator must be closed after use.

      Example:

      
       quoteProcessor.getHelper().getLineItemsIterator().withCloseable { items ->
           items.each { item -> api.logInfo("Item", item.getSKU()) }
       }
       
      Returns:
      an iterator over all line items of the quote; must be closed after use (try-with-resources or withCloseable)