Class PricingPlanScenarioBuilder

Object
PricingPlanScenarioBuilder

public class PricingPlanScenarioBuilder extends Object
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:

Example:


 def pps = api.createPricingPlanScenario(pprTypedId)
     .withName("my-scenario")
     .withLabel("My Scenario")
     .withScenarioType(ppstTypedId)
     .build()
 
Since:
17.0
  • Constructor Details

    • PricingPlanScenarioBuilder

      public PricingPlanScenarioBuilder(PersistedObjectService objService, String pprTypedId)
  • Method Details

    • withName

      public PricingPlanScenarioBuilder withName(String name)
      Sets the unique name (business key) of the scenario.
      Parameters:
      name - unique name
      Returns:
      this builder
    • withLabel

      public PricingPlanScenarioBuilder withLabel(String label)
      Sets the display label of the scenario.
      Parameters:
      label - display label
      Returns:
      this builder
    • withDescription

      public PricingPlanScenarioBuilder withDescription(String description)
      Sets the description of the scenario.
      Parameters:
      description - description text
      Returns:
      this builder
    • withScenarioType

      public PricingPlanScenarioBuilder withScenarioType(String ppstTypedId)
      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 archived
      IllegalStateException - if the scenario fails validation