Class LineItemHelper
Object
LineItemHelper
- Direct Known Subclasses:
CompensationHelper,ContractHelper,QuoteHelper,RebateAgreementHelper
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a line item, a folder, or the document root of a CLIC document (a Quote, Contract, Rebate Agreement, Sales Compensation, or Custom Form), obtained fromgetRoot(),findByLineId(String),findAllWithLabel(String), orLineItemHelper.LineItem.getChildren()/LineItemHelper.LineItem.getParent()/LineItemHelper.LineItem.getSiblings()/LineItemHelper.LineItem.getSubLineItems()rather than instantiated directly.static final recordContext information for review workflow.static final recordReview sub-step information. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LineItemHelper.ReviewContextprotected final LineItemHelper.LineItem -
Constructor Summary
ConstructorsConstructorDescriptionLineItemHelper(Map<String, Object> calculableLineItemCollection, LineItemHelper.ReviewContext reviewContext) Creates a helper wrapping the given CLIC document map and review context. -
Method Summary
Modifier and TypeMethodDescriptionfindAllWithLabel(String label) Finds all line items, folders, and the root whose label matches the given label.findByLineId(String lineItemId) Finds the line item or folder with the given line ID.getFlattedInputs(List<Map<String, Object>> inputs) Flattens a list of input maps, including nested inputs, into a single flat list.protected List<LineItemHelper.LineItem> This method returns line items that have an active review assignment for the current user's groupgetRoot()Returns the document's root, a syntheticLineItemHelper.LineItemrepresenting the document itself rather than any actual line item.protected booleanisInReviewForUserGroup(Map<String, Object> lineItemMap, String userGroupName) Checks if a line item is in review for the specified user group.lineItemFromMap(Map<String, Object> lineItemMap) Creates the LineItem object from the given map.
-
Field Details
-
calculableLineItemCollection
-
reviewContext
-
parentIdToLineItems
-
idToLineItem
-
root
-
-
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 owngetHelper()method, not meant to be called directly.- Parameters:
calculableLineItemCollection- the CLIC document's raw map representation, for example fromquoteProcessor.getQuoteView()reviewContext- the current user's review context, ornullif not in a review workflow
-
-
Method Details
-
getFlattedInputs
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, ornull- Returns:
- the flattened list of inputs, including all nested inputs. Never
null; empty ifinputsisnull
-
lineItemFromMap
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.LineItemwrapping the given map. Nevernull.
-
findByLineId
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, ornulliflineItemIdisnullor matches no line item
-
getRoot
Returns the document's root, a syntheticLineItemHelper.LineItemrepresenting the document itself rather than any actual line item.- Returns:
- the root
LineItemHelper.LineItem. Nevernull.
-
findAllWithLabel
Finds all line items, folders, and the root whose label matches the given label.- Parameters:
label- the label to match; must not benull- Returns:
- the matching
LineItemHelper.LineItems. Nevernull; empty if none match.
-
getItemsForReview
This method returns line items that have an active review assignment for the current user's groupThis 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
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 checkuserGroupName- The user group name- Returns:
- true if the line item is in review for the user group, false otherwise
-