Class ChargingPlanDictionaryModel

java.lang.Object
com.highdeal.pnr.hci.ChargingPlanDictionaryModel
All Implemented Interfaces:
XMLMarshallable, Cloneable

public class ChargingPlanDictionaryModel extends Object implements XMLMarshallable, Cloneable
This class represents the dictionary for all the charging plans of the charge component.
Since:
Transactive 4.0

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="chargingPlanDictionary">
  <xs:complexType>
   <xs:sequence>
    <xs:choice>
     <xs:element ref="dictionaryComponent" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element ref="typedDictionaryComponent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
<xs:element name="dictionaryComponent">
   <xs:complexType>
     <xs:attribute name="internalChargingReference" type="xs:string" use="required"/>
     <xs:attribute name="backupChargingReference" type="xs:string" default="_default_charging_reference_"/>
   </xs:complexType>
 </xs:element>
<xs:element name="typedDictionaryComponent">
   <xs:complexType>
     <xs:attribute name="internalChargingReference" type="xs:string" use="required"/>
     <xs:attribute name="chargingReferenceType" type="AccountType" use="required"/>
   </xs:complexType>
 </xs:element>

  • Field Details

    • DEFAULT_CHARGING_REFERENCE

      public static final String DEFAULT_CHARGING_REFERENCE
      This string represents the default charging reference in the dictionary.
      See Also:
  • Constructor Details

    • ChargingPlanDictionaryModel

      public ChargingPlanDictionaryModel()
      Create an empty dictionary.
    • ChargingPlanDictionaryModel

      public ChargingPlanDictionaryModel(LinkedHashMap<String,Object> dictionary, boolean dictionaryTyped)
  • Method Details

    • getInternalChargingReferences

      public Iterator<String> getInternalChargingReferences()
      Gets a iteration of all internal charging references of the dictionary.
      Returns:
      A iteration of all internal charging references of the dictionary.
    • replaceInternalChargingReference

      public void replaceInternalChargingReference(String oldInternal, String newInternal)
      Replace an internal charging reference by another one. If the reference is referenced as backup in the dictionary, this backup is replaced too.
      Parameters:
      oldInternal - the reference to replace.
      newInternal - the new reference.
      Throws:
      NullPointerException - is thrown in the twice following cases:
      • the parameter "oldInternal" is null
      • the parameter "newInternal" is null
    • removeInternalChargingReference

      public void removeInternalChargingReference(String internal)
      Removes the internal charging reference and shifts all the corresponding backup references to default charging reference.
      Parameters:
      internal - the internal charging reference.
      Throws:
      NullPointerException - is thrown when the parameter "internal" is null.
    • getChargingReferenceType

      public ChargingPlanAccountType getChargingReferenceType(String internal)
      Return the account type of the charging reference corresponding to the internal charging reference.
      Parameters:
      internal - the internal charging reference for which, we want the corresponding account type.
      Returns:
      the account type of the charging reference corresponding to the internal charging reference. It can be null if the internal charging reference doesn't exist in the dictionary or doesn't define an account type.
    • addChargingReferenceType

      public void addChargingReferenceType(String internal, ChargingPlanAccountType type)
      Adds a charging reference type to the internal charging reference.

      Parameters:
      internal - the internal charging reference.
      type - the internal charging reference type.
      Throws:
      NullPointerException - is thrown in the twice following cases:
      • the parameter "internal" is null
      • the parameter "type" is null
    • replaceChargingReferenceType

      public void replaceChargingReferenceType(String internal, ChargingPlanAccountType oldType, ChargingPlanAccountType newType)
      Replace a account type of the charging reference by another one.
      Parameters:
      oldType - the reference type to replace.
      newType - the new reference type.
      Throws:
      NullPointerException - is thrown in the twice following cases:
      • the parameter "oldType" is null
      • the parameter "newType" is null
    • getBackupChargingReference

      public String getBackupChargingReference(String internal)
      Return the backup charging reference corresponding to the internal charging reference.
      Parameters:
      internal - the internal charging reference for which, we want the corresponding backup.
      Returns:
      the backup charging reference corresponding to the internal charging reference. It can be null if the internal charging reference doesn't exist in the dictionary.
    • addBackupChargingReference

      public void addBackupChargingReference(String internal, String backup)
      Adds a backup charging reference to the internal charging reference.

      The backup charging reference has to be already present in the dictionary and the internal charging reference has to be a new one in the dictionary.

      Parameters:
      internal - the internal charging reference.
      backup - the backup charging reference corresponding to the internal charging reference.
      Throws:
      NullPointerException - is thrown in the twice following cases:
      • the parameter "internal" is null
      • the parameters "backup" is null
      IllegalArgumentException - is thrown in the twice following cases:
      • the internal charging reference already exists in the dictionary (then already has a backup)
      • the internal charging reference is the default one
      • the backup charging reference doesn't exist in the dictionary (except the default one)
    • addAllReferencesFrom

      public void addAllReferencesFrom(ChargingPlanDictionaryModel other)
      Adds all charging references of the given dictionary in the current dictionary.
      Parameters:
      other - The dictionary from which we get the charging references.
    • size

      public int size()
      Returns the number charging references in the dictionary.
      Returns:
      The number charging references in the dictionary.
    • getDictionary

      public HashMap<String,Object> getDictionary()
      Returns the HashMap representing the dictionary
      Returns:
      The HashMap representing the dictionary
    • setDictionaryTyped

      public void setDictionaryTyped(boolean dictionaryTyped)
    • isDictionaryTyped

      public boolean isDictionaryTyped()
      Returns true if the charging references in the dictionary are typed.
      Returns:
      true if the charging references in the dictionary are typed.
    • hasCycleFrom

      public String hasCycleFrom(String internal)
      Cycle detection in the dictionary starting from a internal charging reference.

      Parameters:
      internal - the internal charging reference of the start.
      Returns:
      the internal charging reference from which the cycle begin or null otherwise.
    • hasCycle

      public String hasCycle()
      Cycle detection in the dictionary.

      Returns:
      the internal charging reference from which the cycle begin or null otherwise.
    • getReferences

      public List<String> getReferences(ChargingPlanAccountType referenceType)
      Gets the list of charging references of the specified type.
      Parameters:
      referenceType - the type of charging reference
      Returns:
      the list of charging references of the specified type
    • 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
    • clone

      public Object clone() throws CloneNotSupportedException
      Throws:
      CloneNotSupportedException