Class PricePlanModel

java.lang.Object
com.highdeal.pnr.hci.PricePlanModel
All Implemented Interfaces:
XMLMarshallable, ContextualNode

public class PricePlanModel extends Object implements XMLMarshallable, ContextualNode
This class represents a price plan.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="pricePlan">
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="counterDescription" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="usage" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="oneShot" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="recurring" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="chargingPlan" minOccurs="0" maxOccurs="1"/>
     </xs:sequence>
     <xs:attribute name="name" type="xs:string"/>
     <xs:attribute name="description" type="xs:string"/>
     <xs:attribute name="freeText" type="xs:string"/>
     <xs:attribute name="currency" type="xs:string" use="optional"/> <!-- deprecated -->
   </xs:complexType>
 </xs:element>

  • Constructor Details

    • PricePlanModel

      public PricePlanModel()
      Builds an empty PricePlanModel.
    • PricePlanModel

      public PricePlanModel(String name, String description, String text, String currencyCode)
      Builds a PricePlanModel.
      Parameters:
      name - the name.
      description - the description.
      text - the free text.
      currencyCode - the currency code.
  • Method Details

    • setName

      public void setName(String name)
      Sets the name.
      Parameters:
      name - the name.
    • getName

      public String getName()
      Gets the name.
      Returns:
      the name.
    • setDescription

      public void setDescription(String description)
      Sets the description.
      Parameters:
      description - the description.
    • getDescription

      public String getDescription()
      Gets the description.
      Returns:
      the description.
    • setFreeText

      public void setFreeText(String text)
      Sets the free text.
      Parameters:
      text - the free text.
    • getFreeText

      public String getFreeText()
      Gets the free text.
      Returns:
      the free text.
    • setCurrencyCode

      @Deprecated public void setCurrencyCode(String currencyCode)
      Sets the currency code.
      Parameters:
      currencyCode - the currency code.
    • getCurrencyCode

      @Deprecated public String getCurrencyCode()
      Gets the currency code.
      Returns:
      the currency code.
    • setProducts

      public void setProducts(Vector<ProductModel> products)
      Sets the products.
      Parameters:
      products - a Vector of ProductModel.
    • getProducts

      public Vector<ProductModel> getProducts()
      Gets the products.
      Returns:
      a Vector of ProductModel.
    • createCounterDescriptions

      public Vector<CounterDescriptionModel> createCounterDescriptions()
      Creates the counter descriptions including persistent and transient counters.
      Returns:
      a Vector of CounterDescriptionModel.
    • setPersistentCounterDescriptions

      public void setPersistentCounterDescriptions(Vector<CounterDescriptionModel> counterDescriptions)
      Sets the persistent counter descriptions.
      Parameters:
      counterDescriptions - a Vector of CounterDescriptionModel.
    • getPersistentCounterDescriptions

      public Vector<CounterDescriptionModel> getPersistentCounterDescriptions()
      Gets the persistent counter descriptions.
      Returns:
      a Vector of CounterDescriptionModel.
    • setTransientCounterDescriptions

      public void setTransientCounterDescriptions(Vector<CounterDescriptionModel> counterDescriptions)
      Sets the transient counter descriptions.
      Parameters:
      counterDescriptions - a Vector of CounterDescriptionModel.
    • getTransientCounterDescriptions

      public Vector<CounterDescriptionModel> getTransientCounterDescriptions()
      Gets the transient counter descriptions.
      Returns:
      a Vector of CounterDescriptionModel.
    • getUsageRates

      public Vector<UsageRateModel> getUsageRates()
      Gets the usage rates. Do not use this to add or remove elements.
      Returns:
      a Vector of UsageRateModel.
    • addUsageRates

      public void addUsageRates(Vector<UsageRateModel> usageRates)
      Adds usage rates.
      Parameters:
      usageRates - a Vector of UsageRateModel.
    • addUsageRate

      public void addUsageRate(UsageRateModel rate)
      Adds an usage rate.
      Parameters:
      rate - the usage rate to add.
    • removeUsageRate

      public void removeUsageRate(int index)
      Removes an usage rate.
      Parameters:
      index - the index of the usage rate to be removed.
    • getUsageRate

      public UsageRateModel getUsageRate(int index)
      Gets an usage rate at a specified index.
      Parameters:
      index - the index of the usage rate to get.
      Returns:
      an usage rate at a specified index.
    • getRecurringRates

      public Vector<RecurringRateModel> getRecurringRates()
      Gets the recurring rates. Do not use this to add or remove elements.
      Returns:
      a Vector of RecurringRateModel.
    • addRecurringRates

      public void addRecurringRates(Vector<RecurringRateModel> recurringRates)
      Adds recurring rates.
      Parameters:
      recurringRates - a Vector of RecurringRateModel.
    • addRecurringRate

      public void addRecurringRate(RecurringRateModel rate)
      Adds a recurring rate.
      Parameters:
      rate - the recurring rate to add.
    • removeRecurringRate

      public void removeRecurringRate(int index)
      Removes a recurring rate.
      Parameters:
      index - the index of the recurring rate to be removed.
    • getRecurringRate

      public RecurringRateModel getRecurringRate(int index)
      Gets a recurring rate.
      Parameters:
      index - the index of the recurring rate to get.
      Returns:
      a recurring rate.
    • getOneShotRates

      public Vector<OneShotRateModel> getOneShotRates()
      Gets one shot rates. Do not use this to add or remove elements.
      Returns:
      a Vector of OneShotRateModel.
    • addOneShotRates

      public void addOneShotRates(Vector<OneShotRateModel> oneShotRates)
      Adds one shot rates.
      Parameters:
      oneShotRates - a Vector of OneShotRateModel.
    • addOneShotRate

      public void addOneShotRate(OneShotRateModel rate)
      Adds a one shot rate.
      Parameters:
      rate - the one shot rate to add.
    • removeOneShotRate

      public void removeOneShotRate(int index)
      Removes a one shot rate.
      Parameters:
      index - the index of the one shot rate to be removed.
    • getChargingPlan

      public ChargingPlanModel getChargingPlan()
      Gets the charging plan.
      Returns:
      the charging plan.
    • setChargingPlan

      public void setChargingPlan(ChargingPlanModel chargingPlan)
      Sets the charging plan.
      Parameters:
      chargingPlan -
    • checkChargingPlanCompatibility

      public void checkChargingPlanCompatibility() throws InvalidInitializationException
      Check if the charging plan is compatible with this price plan.
      Throws:
      InvalidInitializationException
    • setChargingPlanDictionaryModel

      public void setChargingPlanDictionaryModel(ChargingPlanDictionaryModel chargingPlanDictionaryModel)
    • getChargingPlanDictionaryModel

      public ChargingPlanDictionaryModel getChargingPlanDictionaryModel()
    • getOneShotRate

      public OneShotRateModel getOneShotRate(int index)
      Gets a one shot rate.
      Parameters:
      index - the index of the one shot rate to get.
      Returns:
      a one shot rate.
    • getParameters

      public Vector<ParameterModel> getParameters()
      Gets the parameters.
      Returns:
      a Vector of ParameterModel.
    • setParameters

      public void setParameters(Vector<ParameterModel> p)
      Sets the parameters.
      Parameters:
      p - a Vector of ParameterModel.
    • setParent

      public void setParent(ContextualNode node)
      Sets the parent.
      Specified by:
      setParent in interface ContextualNode
      Parameters:
      node - the parent (ignored).
    • getContext

      public RatingContextDescription getContext(ContextualNode child)
      Updates the context for the specified child and returns it.
      Specified by:
      getContext in interface ContextualNode
      Parameters:
      child -
      Returns:
      refreshed context.
    • inheritedContext

      public RatingContextDescription inheritedContext()
      Gets the inherited context.
      Specified by:
      inheritedContext in interface ContextualNode
      Returns:
      the inherited context.
    • setContext

      public void setContext(RatingContextDescription contextDescription)
      Sets the context.
      Parameters:
      contextDescription - the context.
    • checkValidity

      public boolean checkValidity()
      Returns true if the price plan is valid.
      Returns:
      true if the price plan is valid, false otherwise.
    • retrieveAllProperties

      public Vector<PropertyDescriptionModel> retrieveAllProperties()
      Returns all the properties of this price plan.
      Returns:
      a list of PropertyDescriptionModel that represents all the properties defined in this price plan.
    • setAttributes

      public void setAttributes(XMLAttributes atts)
      Description copied from interface: XMLMarshallable
      Sets the attributes of the XML representation of the element being processed.
      Specified by:
      setAttributes in interface XMLMarshallable
      Parameters:
      atts - The XML attributes of the current element
    • addCharacterData

      public void addCharacterData(String cData)
      Description copied from interface: XMLMarshallable
      Adds character data to the content element.
      Specified by:
      addCharacterData in interface XMLMarshallable
      Parameters:
      cData - The character data to be added
    • addChild

      public void addChild(String name, XMLMarshallable child)
      Description copied from interface: XMLMarshallable
      Adds a child to the object, the child representing the marshallable object which must be added to the element.
      Specified by:
      addChild in interface XMLMarshallable
      Parameters:
      name - The name of tag for the child
      child - The child to be added
    • marshal

      public void marshal(XMLOutputter output)
      Description copied from interface: XMLMarshallable
      Gives an XML representation of this object, including its children.
      Specified by:
      marshal in interface XMLMarshallable
      Parameters:
      output - The XML output to marshal the object into
    • findLeaves

      public static final void findLeaves(RateComponentModel component, List<RateComponentModel> leaves)
      Fill the given list with all leaves starting from the given rate component.
      Parameters:
      component - the rate component of the start.
      leaves - the list of all leaves retreived.