Interface RATBuilder.RABuilder
- All Superinterfaces:
CalculableLineItemCollectionBuilder<RATBuilder.RABuilder>
- Enclosing interface:
RATBuilder
RATBuilder.fromExisting(String) or RATBuilder.fromParams(java.util.Map).
Besides the methods declared here, the builder supports updateField, addLineItem,
addOrUpdateInput and addOrUpdateOutput of CalculableLineItemCollectionBuilder. The key
of addLineItem is the Rebate Type unique name. Other CalculableLineItemCollectionBuilder methods
are ignored without an error. The contextParameter list of addLineItem(String, String, List) is
ignored. To set inputs on a new line item, add it with addLineItemWithId(String, String) and then call
addOrUpdateInput with the same line ID. Finish each chain with build(), which saves the Rebate
Agreement when the recorded operations run.
- See Also:
-
Field Summary
Fields inherited from interface CalculableLineItemCollectionBuilder
ROOT_LINE_ID -
Method Summary
Modifier and TypeMethodDescriptionaddLineItemWithId(String lineId, String rebateType) Adds a new line item to the Rebate Agreement, specified by the Rebate Type unique name.addLineItemWithId(String parentId, String lineId, String rebateType) Adds a new line item to the specified parent folder of the Rebate Agreement.applyPlaceholder(String placeholder, Object value) Applies a value to a previously registered placeholder.Returns the instance ID of this builder.Marks that the built Rebate Agreement should be submitted after build.Methods inherited from interface CalculableLineItemCollectionBuilder
addLineItem, addLineItem, addLineItem, addOrUpdateInput, addOrUpdateInput, addOrUpdateOutput, addOrUpdateOutput, clearRenderInfo, closeFolder, deleteFolder, deleteItem, deselectItem, getHeaderType, isPostPhase, isPrePhase, markItemDirty, moveItem, openFolder, renameFolder, runCreationWorkflowLogicAfterRecalculation, selectItem, setRenderInfo, switchToAsync, updateField, updateField
-
Method Details
-
getIstanceId
String getIstanceId()Returns the instance ID of this builder. Every builder created in one logic run gets its own ID, so the ID tells apart several Rebate Agreements built by the same logic.This method only reads a value and does not record any operation. The ID identifies the builder, not the Rebate Agreement: it is not the ID or the unique name of the saved agreement.
Example:
def builder = ratBuilder.fromParams(["label": "Annual Bonus 2027"]) def builderId = builder.getIstanceId()- Returns:
- the instance id of this builder
- See Also:
-
addLineItemWithId
Adds a new line item to the Rebate Agreement, specified by the Rebate Type unique name. The line item is added at the top level of the agreement (under theROOTline).The call only records the operation. When the recorded operations run, the application creates the line item with the given line ID. If no Rebate Type with the given unique name exists, the whole batch that contains this Rebate Agreement is rolled back (see
RATBuilder).Example:
def lineItemId = api.uuid() ratBuilder.fromParams(["label": "Annual Bonus 2027"]) .addLineItemWithId(lineItemId, "RebateOnSale") .build()- Parameters:
lineId- usually a generated idrebateType- unique name of the Rebate Type of the new line item- Returns:
- itself
- See Also:
-
addLineItemWithId
Adds a new line item to the specified parent folder of the Rebate Agreement.The call only records the operation. When the recorded operations run, the application creates the line item with the given line ID under the
parentIdfolder. Use"ROOT"asparentIdto add the line item at the top level, which is the same asaddLineItemWithId(String, String). If no Rebate Type with the given unique name exists, the whole batch that contains this Rebate Agreement is rolled back (seeRATBuilder).Example:
def lineCustomerId = api.uuid() ratBuilder.fromParams(["label": "Annual Bonus 2027"]) .addLineItemWithId("ROOT", lineCustomerId, "RebateOnSale") .build()- Parameters:
parentId- the name of the folder you want to add a line item tolineId- usually a randomly generated idrebateType- unique name of the Rebate Type of the new line item- Returns:
- itself
- See Also:
-
applyPlaceholder
Applies a value to a previously registered placeholder.The call only records the operation. When the recorded operations run, the application writes the value to every Rebate Agreement field that the user mapped to this placeholder when running the template. If the placeholder has no mapping, nothing is changed and no error is raised. If writing to a mapped field fails, the remaining fields of that placeholder are skipped and the failure is only logged.
Example:
ratBuilder.registerPlaceholder(InputType.USERENTRY, "discount") ratBuilder.fromParams(["label": "Annual Bonus 2027"]) .applyPlaceholder("discount", 0.05) .build()- Parameters:
placeholder- the placeholder name, as registered withRATBuilder.registerPlaceholder(InputType, String)value- the value to apply- Returns:
- itself
- See Also:
-
submitAfterBuild
RATBuilder.RABuilder submitAfterBuild()Marks that the built Rebate Agreement should be submitted after build.The call only records the operation. It takes effect when
build()is processed: the application saves the Rebate Agreement and then submits it, so its workflow status becomes Submitted. If the Rebate Agreement could not be created (for example,RATBuilder.fromExisting(String)found no agreement), nothing is submitted.Example:
ratBuilder.fromParams(["label": "Annual Bonus 2027"]) .submitAfterBuild() .build()- Returns:
- itself
- See Also:
-