Class ContractHelper
Object
LineItemHelper
ContractHelper
- All Implemented Interfaces:
Reviewable
A helper class that assists in manipulating the contract object.
An instance of this class can be obtained via call
cProcessor.getHelper() from contract header logic.
Recommended Reading:
To understand how calculation logics in contracts work please read the article Contract Calculation Logic Details.Example:
def isHighPriority = cProcessor.getHelper().getRoot().getInputByName("IsHighPriority")?.value
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class LineItemHelper
LineItemHelper.LineItem, LineItemHelper.ReviewContext, LineItemHelper.ReviewSubStep -
Field Summary
Fields inherited from class LineItemHelper
calculableLineItemCollection, idToLineItem, parentIdToLineItems, reviewContext, root -
Constructor Summary
ConstructorsConstructorDescriptionContractHelper(Map<String, Object> calculableLineItemCollection, LineItemHelper.ReviewContext reviewContext) -
Method Summary
Modifier and TypeMethodDescriptionfindAllWithContractTermTypeUN(String contractTermTypeUN) Finds all contract line items with the specified contract term type.Gets a list of line items that are assigned to the current user for review.Gets the current review sub-step information.booleanChecks if the user who triggered the calculation can do the review of the line items.Methods inherited from class LineItemHelper
findAllWithLabel, findByLineId, getFlattedInputs, getRoot, lineItemFromMap
-
Constructor Details
-
ContractHelper
public ContractHelper(Map<String, Object> calculableLineItemCollection, LineItemHelper.ReviewContext reviewContext)
-
-
Method Details
-
findAllWithContractTermTypeUN
Finds all contract line items with the specified contract term type.- Parameters:
contractTermTypeUN- unique name of contract term type- Returns:
- list of line items
LineItemHelper.LineItemExample:
def lineItems = cProcessor.getHelper().findAllWithContractTermTypeUN("BundleUp") lineItems.each { api.logInfo("line item label", it.label )} // Bundle Up
-
isInReview
public boolean isInReview()Checks if the user who triggered the calculation can do the review of the line items.Example:
if (cProcessor.getHelper().isInReview()) { // Execute review-specific validation or calculations }- Specified by:
isInReviewin interfaceReviewable- Returns:
trueif the contract is in a review workflow step and there is active review sub step for the current user,falseotherwise
-
getReviewSubStep
Gets the current review sub-step information.Example:
def helper = cProcessor.getHelper() if (helper.isInReview()) { def label = helper.getReviewSubStep().label def userGroupName = helper.getReviewSubStep().userGroupName }- Specified by:
getReviewSubStepin interfaceReviewable- Returns:
- The review sub-step or null if the user is not in review
-
getItemsForReview
Gets a list of line items that are assigned to the current user for review.This method returns the line items that are part of the current user's review scope. Only line items that have an active review assignment for the current user's review user group are included.
Example:
def helper = cProcessor.getHelper() if (helper.isInReview()) { def itemsForReview = helper.getItemsForReview() for (item in itemsForReview) { // Process each line item assigned for review api.logInfo("Reviewing item", item.lineId) } }- Specified by:
getItemsForReviewin interfaceReviewable- Overrides:
getItemsForReviewin classLineItemHelper- Returns:
- A list of
LineItemHelper.LineItemobjects for the current user's review, or an empty list if not in review or no items are assigned
-