Class LineItemHelper

Object
LineItemHelper
Direct Known Subclasses:
CompensationHelper, ContractHelper, QuoteHelper, RebateAgreementHelper

public class LineItemHelper extends Object
A helper class that assists in navigating and reading a Calculable Line Item Collection (CLIC) document's line items: a Quote, Contract, Rebate Agreement, Sales Compensation, or Custom Form. Obtained from the document's builder via getHelper() in header or line logic, for example quoteProcessor.getHelper(), rather than instantiated directly.
See Also:
  • Field Details

  • Constructor Details

    • LineItemHelper

      public LineItemHelper(Map<String,Object> calculableLineItemCollection, LineItemHelper.ReviewContext reviewContext)
      Creates a helper wrapping the given CLIC document map and review context. Declared for use by a document builder's own getHelper() method, not meant to be called directly.
      Parameters:
      calculableLineItemCollection - the CLIC document's raw map representation, for example from quoteProcessor.getQuoteView()
      reviewContext - the current user's review context, or null if not in a review workflow
  • Method Details

    • getFlattedInputs

      public static List<Map<String,Object>> getFlattedInputs(List<Map<String,Object>> inputs)
      Flattens a list of input maps, including nested inputs, into a single flat list. Each input's own nested inputs (under its "inputs" key) are recursively included, depth-first, alongside the input itself.
      Parameters:
      inputs - the top-level inputs to flatten, or null
      Returns:
      the flattened list of inputs, including all nested inputs. Never null; empty if inputs is null
    • lineItemFromMap

      public LineItemHelper.LineItem lineItemFromMap(Map<String,Object> lineItemMap)
      Creates the LineItem object from the given map. The structure of the map can be found, for example, when reviewing the result of quoteProcessor.getQuoteView()
      Parameters:
      lineItemMap - the raw map representation of a single line item
      Returns:
      a LineItemHelper.LineItem wrapping the given map. Never null.
    • findByLineId

      public LineItemHelper.LineItem findByLineId(String lineItemId)
      Finds the line item or folder with the given line ID.
      Parameters:
      lineItemId - the line ID to look up, or "ROOT" for the document's root
      Returns:
      the matching LineItemHelper.LineItem, or null if lineItemId is null or matches no line item
    • getRoot

      public LineItemHelper.LineItem getRoot()
      Returns the document's root, a synthetic LineItemHelper.LineItem representing the document itself rather than any actual line item.
      Returns:
      the root LineItemHelper.LineItem. Never null.
    • findAllWithLabel

      public List<LineItemHelper.LineItem> findAllWithLabel(String label)
      Finds all line items, folders, and the root whose label matches the given label.
      Parameters:
      label - the label to match; must not be null
      Returns:
      the matching LineItemHelper.LineItems. Never null; empty if none match.
    • getItemsForReview

      protected List<LineItemHelper.LineItem> getItemsForReview()
      This method returns line items that have an active review assignment for the current user's group

      This method filters all line items to find those that have an active review assignment for the current user group. A line item is considered "for review" when it has a review entry with matching userGroupName and isInReview=true.

      Returns:
      List of LineItem objects for items in the current user's review scope, or empty list if not in review or no items are assigned
    • isInReviewForUserGroup

      protected boolean isInReviewForUserGroup(Map<String,Object> lineItemMap, String userGroupName)
      Checks if a line item is in review for the specified user group.

      A line item is considered in review when it has a review entry in its "reviews" list where the userGroupName matches and isInReview is true.

      Parameters:
      lineItemMap - The line item map to check
      userGroupName - The user group name
      Returns:
      true if the line item is in review for the user group, false otherwise