Class PricingPlanRevisionBuilder

Object
PricingPlanRevisionBuilder

public class PricingPlanRevisionBuilder extends Object
Creates a Pricing Plan Revision (PPR) in an existing Pricing Plan. Obtain it with api.createPricingPlanRevision().

The builder creates the revision in DRAFT status. It sets no activeFrom or activeTo dates. The publish or schedule step assigns them later.

The revision type is one of the Pricing Plan Revision Types that the Pricing Plan Type of the Pricing Plan allows:

Example:


 def ppr = api.createPricingPlanRevision(ppTypedId)
     .withName("my-revision")
     .withLabel("My Revision")
     .withDescription("Created via Groovy API")
     .withRevisionType(pprtTypedId)
     .build()
 
Since:
17.0
  • Constructor Details

    • PricingPlanRevisionBuilder

      public PricingPlanRevisionBuilder(PersistedObjectService objService, String ppTypedId)
  • Method Details

    • withName

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

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

      public PricingPlanRevisionBuilder withDescription(String description)
      Sets the description of the revision.
      Parameters:
      description - description text
      Returns:
      this builder
    • withRevisionType

      public PricingPlanRevisionBuilder withRevisionType(String pprtTypedId)
      Sets the revision type. It must be one of the types allowed by the Pricing Plan Type of the Pricing Plan, and it must be Active. If omitted, the builder selects the only allowed type that is Active.
      Parameters:
      pprtTypedId - typed ID of the revision type (e.g. "42.PPRT")
      Returns:
      this builder
      Since:
      18.0
    • build

      public PricingPlanRevision build()
      Creates and persists the PricingPlanRevision with the configured properties.
      Returns:
      the persisted PPR entity (converted to a safe map by the sandbox)
      Throws:
      IllegalArgumentException - if name was not set, or the revision type cannot be resolved, or the resolved revision type is archived
      IllegalStateException - if the revision fails validation