Class ChargingPlanModel

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

public class ChargingPlanModel extends Object implements XMLMarshallable, ContextualNode
This class represents a charging plan.
Since:
Transactive 4.0

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="chargingPlan">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="usageCharge" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element ref="recurringCharge" minOccurs="0" maxOccurs="1"/>
    <xs:element ref="oneshotCharge" minOccurs="0" maxOccurs="1"/>
    <xs:element ref="defaultCharge" minOccurs="1" maxOccurs="1"/>
   </xs:sequence>
   <xs:attribute name="name" type="xs:string"/>
   <xs:attribute name="description" type="xs:string"/>
  </xs:complexType>
 </xs:element>

  • Constructor Details

    • ChargingPlanModel

      public ChargingPlanModel()
      Creates an empty charging plan.
    • ChargingPlanModel

      public ChargingPlanModel(String name, String description)
      Creates an empty charging plan with a name and a description.
      Parameters:
      name - the name of the chargeable item.
      description - the description given by the user.
  • Method Details

    • getName

      public String getName()
      Gets the name of the charging plan.
      Returns:
      the name of the charging plan.
    • setName

      public void setName(String name)
      Sets the name of the charging plan.
      Parameters:
      name - the nem of the charging plan.
    • getDescription

      public String getDescription()
      Gets the description of the charging plan.
      Returns:
      the description of the chargin plan.
    • setDescription

      public void setDescription(String description)
      Sets the description of the charging plan.
      Parameters:
      description - the description of the charging plan.
    • getUsageCharge

      public UsageChargeModel getUsageCharge(String usageChargeName)
      Returns the usage charge corresponding to the name of the usage charge.
      Parameters:
      usageChargeName - the name of the usage charge.
      Returns:
      the usage charge corresponding to the name of the usage charge.
    • addUsageCharge

      public void addUsageCharge(UsageChargeModel usageCharge)
      Adds a usage charge and returns the old one which has the same name.
      Parameters:
      usageCharge - the usage charge to add.
    • removeUsageCharge

      public UsageChargeModel removeUsageCharge(String usageChargeName)
      Remove the usage charge corresponding to the name.
      Parameters:
      usageChargeName - the name of the usage charge.
      Returns:
      the usage charge removed and null is there isn't no usage charge corresopnding to the name.
    • removeUsageCharge

      public UsageChargeModel removeUsageCharge(int index)
      Remove the usage charge at the index.
      Parameters:
      index - the index of the usage charge.
      Returns:
      the usage charge removed and null is there isn't no usage charge at the index.
    • getUsageCharges

      public List<UsageChargeModel> getUsageCharges()
      Gets a list of all usage charge.
      Returns:
      the list of all usage charge.
    • getDefaultCharge

      public DefaultChargeModel getDefaultCharge()
      Gets the default charge of the charging plan.
      Returns:
      the default charge.
      See Also:
    • setDefaultCharge

      public void setDefaultCharge(DefaultChargeModel defaultCharge)
      Sets the default charge.
      Parameters:
      defaultCharge - the default charge
      See Also:
    • getRecurringCharge

      public RecurringChargeModel getRecurringCharge()
      Gets the recurring charge.
      Returns:
      the recurring charge
      See Also:
    • setRecurringCharge

      public void setRecurringCharge(RecurringChargeModel recurringCharge)
      Sets the recurring charge.
      Parameters:
      recurringCharge - the recurring charge.
      See Also:
    • getOneShotCharge

      public OneShotChargeModel getOneShotCharge()
      Gets the one-shot charge.
      Returns:
      the one-shot charge.
      See Also:
    • setOneShotCharge

      public void setOneShotCharge(OneShotChargeModel oneShotCharge)
      Sets the one-shot charge.
      Parameters:
      oneShotCharge - the one-shot charge
    • retreiveInternalChargingReferences

      public void retreiveInternalChargingReferences(List<String> list)
      Retrieve all the internal charging references defined in the charging plan.
      Parameters:
      list - the list of all the internal charging references defined in the charging plan.
    • hasOnlyInternalChargingReferences

      public boolean hasOnlyInternalChargingReferences()
      Checks if the charging plan has only internal charging references.
      Returns:
      true if the charging plan has only internal charging references.
    • checkValidity

      public boolean checkValidity()
      Check the validity of the charging plan. The charging plan isn't valid when:
      • the name is null or empty.
      • the default doesn't exist or isn't valid.
      • one of the usage charge isn't valid.
      • if the recurring charge exists, it isn't valid.
      • if the one-shot charge exists, it isn't valid.
      Returns:
      true when the charging plan is valid false otherwise.
    • getParent

      public PricePlanModel getParent()
      Gets the price plan parent.
      Returns:
      the price plan parent.
    • setParent

      public void setParent(ContextualNode parent)
      Description copied from interface: ContextualNode
      Sets the parent node
      Specified by:
      setParent in interface ContextualNode
      Parameters:
      parent - The parent node
    • getContext

      public RatingContextDescription getContext(ContextualNode child)
      Description copied from interface: ContextualNode
      Gets the context description for the specified child; The context description contains all the context properties.
      Specified by:
      getContext in interface ContextualNode
      Parameters:
      child - The child node
      Returns:
      The context description
    • inheritedContext

      public RatingContextDescription inheritedContext()
      Description copied from interface: ContextualNode
      Gets the inherited context; The context description contains all the context properties.
      Specified by:
      inheritedContext in interface ContextualNode
      Returns:
      The inherited context
    • 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
    • addChild

      public void addChild(String tagName, 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:
      tagName - The name of tag for the child
      child - The child to be added
    • 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
    • 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