Package com.highdeal.pnr.hci
Class ChargingPlanDictionaryModel
java.lang.Object
com.highdeal.pnr.hci.ChargingPlanDictionaryModel
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThis string represents the default charging reference in the dictionary. -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty dictionary.ChargingPlanDictionaryModel(LinkedHashMap<String, Object> dictionary, boolean dictionaryTyped) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds all charging references of the given dictionary in the current dictionary.voidaddBackupChargingReference(String internal, String backup) Adds a backup charging reference to the internal charging reference.voidaddCharacterData(String cData) Adds character data to the content element.voidaddChargingReferenceType(String internal, ChargingPlanAccountType type) Adds a charging reference type to the internal charging reference.voidaddChild(String tagName, XMLMarshallable child) Adds a child to the object, thechildrepresenting the marshallable object which must be added to the element.clone()getBackupChargingReference(String internal) Return the backup charging reference corresponding to the internal charging reference.getChargingReferenceType(String internal) Return the account type of the charging reference corresponding to the internal charging reference.Returns the HashMap representing the dictionaryGets a iteration of all internal charging references of the dictionary.getReferences(ChargingPlanAccountType referenceType) Gets the list of charging references of the specified type.hasCycle()Cycle detection in the dictionary.hasCycleFrom(String internal) Cycle detection in the dictionary starting from a internal charging reference.booleanReturns true if the charging references in the dictionary are typed.voidmarshal(XMLOutputter output) Gives an XML representation of this object, including its children.voidremoveInternalChargingReference(String internal) Removes the internal charging reference and shifts all the corresponding backup references to default charging reference.voidreplaceChargingReferenceType(String internal, ChargingPlanAccountType oldType, ChargingPlanAccountType newType) Replace a account type of the charging reference by another one.voidreplaceInternalChargingReference(String oldInternal, String newInternal) Replace an internal charging reference by another one.voidsetAttributes(XMLAttributes atts) Sets the attributes of the XML representation of the element being processed.voidsetDictionaryTyped(boolean dictionaryTyped) intsize()Returns the number charging references in the dictionary.
-
Field Details
-
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
Gets a iteration of all internal charging references of the dictionary.- Returns:
- A iteration of all internal charging references of the dictionary.
-
replaceInternalChargingReference
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
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
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
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
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
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
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
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
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
Cycle detection in the dictionary.- Returns:
- the internal charging reference from which the cycle begin or null otherwise.
-
getReferences
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
Description copied from interface:XMLMarshallableSets the attributes of the XML representation of the element being processed.- Specified by:
setAttributesin interfaceXMLMarshallable- Parameters:
atts- TheXML attributesof the current element
-
addChild
Description copied from interface:XMLMarshallableAdds a child to the object, thechildrepresenting the marshallable object which must be added to the element.- Specified by:
addChildin interfaceXMLMarshallable- Parameters:
tagName- The name of tag for the childchild- The child to be added
-
addCharacterData
Description copied from interface:XMLMarshallableAdds character data to the content element.- Specified by:
addCharacterDatain interfaceXMLMarshallable- Parameters:
cData- The character data to be added
-
marshal
Description copied from interface:XMLMarshallableGives an XML representation of this object, including its children.- Specified by:
marshalin interfaceXMLMarshallable- Parameters:
output- TheXML outputto marshal the object into
-
clone
- Throws:
CloneNotSupportedException
-