Class PricingPlanScenarioBuilder
Object
PricingPlanScenarioBuilder
Creates a Pricing Plan Scenario (PPS) in an existing Pricing Plan Revision. Obtain it with
api.createPricingPlanScenario(). The revision must be in DRAFT status.
The scenario type is one of the Pricing Plan Scenario Types that the Pricing Plan Type of the parent Pricing Plan allows:
- A type named with
withScenarioType(String)must be one of the allowed types and must be Active. - Without
withScenarioType(String), the builder selects the allowed type that is Active. If no allowed type is Active, or more than one is,build()throws anIllegalArgumentException.
Example:
def pps = api.createPricingPlanScenario(pprTypedId)
.withName("my-scenario")
.withLabel("My Scenario")
.withScenarioType(ppstTypedId)
.build()
- Since:
- 17.0
-
Constructor Summary
ConstructorsConstructorDescriptionPricingPlanScenarioBuilder(PersistedObjectService objService, String pprTypedId) -
Method Summary
Modifier and TypeMethodDescriptionPricingPlanScenariobuild()Creates and persists the PricingPlanScenario with the configured properties.withDescription(String description) Sets the description of the scenario.Sets the display label of the scenario.Sets the unique name (business key) of the scenario.withScenarioType(String ppstTypedId) Sets the scenario type.
-
Constructor Details
-
PricingPlanScenarioBuilder
-
-
Method Details
-
withName
Sets the unique name (business key) of the scenario.- Parameters:
name- unique name- Returns:
- this builder
-
withLabel
Sets the display label of the scenario.- Parameters:
label- display label- Returns:
- this builder
-
withDescription
Sets the description of the scenario.- Parameters:
description- description text- Returns:
- this builder
-
withScenarioType
Sets the scenario type. It must be one of the types allowed by the Pricing Plan Type of the parent Pricing Plan, and it must be Active. If omitted, the builder selects the only allowed type that is Active.- Parameters:
ppstTypedId- typed ID of the scenario type (e.g."42.PPST")- Returns:
- this builder
-
build
public PricingPlanScenario build()Creates and persists the PricingPlanScenario with the configured properties.- Returns:
- the persisted PPS entity (converted to a safe map by the sandbox)
- Throws:
IllegalArgumentException- if name was not set, or the scenario type cannot be resolved, or the resolved scenario type is archivedIllegalStateException- if the scenario fails validation
-