Package com.highdeal.pnr.hci
Class ChargingPlanModel
java.lang.Object
com.highdeal.pnr.hci.ChargingPlanModel
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionCreates an empty charging plan.ChargingPlanModel(String name, String description) Creates an empty charging plan with a name and a description. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCharacterData(String cData) Adds character data to the content element.voidaddChild(String tagName, XMLMarshallable child) Adds a child to the object, thechildrepresenting the marshallable object which must be added to the element.voidaddUsageCharge(UsageChargeModel usageCharge) Adds a usage charge and returns the old one which has the same name.booleanCheck the validity of the charging plan.getContext(ContextualNode child) Gets the context description for the specified child; The context description contains all the context properties.Gets the default charge of the charging plan.Gets the description of the charging plan.getName()Gets the name of the charging plan.Gets the one-shot charge.Gets the price plan parent.Gets the recurring charge.getUsageCharge(String usageChargeName) Returns the usage charge corresponding to the name of the usage charge.Gets a list of all usage charge.booleanChecks if the charging plan has only internal charging references.Gets the inherited context; The context description contains all the context properties.voidmarshal(XMLOutputter output) Gives an XML representation of this object, including its children.removeUsageCharge(int index) Remove the usage charge at the index.removeUsageCharge(String usageChargeName) Remove the usage charge corresponding to the name.voidRetrieve all the internal charging references defined in the charging plan.voidsetAttributes(XMLAttributes atts) Sets the attributes of the XML representation of the element being processed.voidsetDefaultCharge(DefaultChargeModel defaultCharge) Sets the default charge.voidsetDescription(String description) Sets the description of the charging plan.voidSets the name of the charging plan.voidsetOneShotCharge(OneShotChargeModel oneShotCharge) Sets the one-shot charge.voidsetParent(ContextualNode parent) Sets the parent nodevoidsetRecurringCharge(RecurringChargeModel recurringCharge) Sets the recurring charge.
-
Constructor Details
-
ChargingPlanModel
public ChargingPlanModel()Creates an empty charging plan. -
ChargingPlanModel
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
Gets the name of the charging plan.- Returns:
- the name of the charging plan.
-
setName
Sets the name of the charging plan.- Parameters:
name- the nem of the charging plan.
-
getDescription
Gets the description of the charging plan.- Returns:
- the description of the chargin plan.
-
setDescription
Sets the description of the charging plan.- Parameters:
description- the description of the charging plan.
-
getUsageCharge
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
Adds a usage charge and returns the old one which has the same name.- Parameters:
usageCharge- the usage charge to add.
-
removeUsageCharge
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
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
Gets a list of all usage charge.- Returns:
- the list of all usage charge.
-
getDefaultCharge
Gets the default charge of the charging plan.- Returns:
- the default charge.
- See Also:
-
setDefaultCharge
Sets the default charge.- Parameters:
defaultCharge- the default charge- See Also:
-
getRecurringCharge
Gets the recurring charge.- Returns:
- the recurring charge
- See Also:
-
setRecurringCharge
Sets the recurring charge.- Parameters:
recurringCharge- the recurring charge.- See Also:
-
getOneShotCharge
Gets the one-shot charge.- Returns:
- the one-shot charge.
- See Also:
-
setOneShotCharge
Sets the one-shot charge.- Parameters:
oneShotCharge- the one-shot charge
-
retreiveInternalChargingReferences
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
Gets the price plan parent.- Returns:
- the price plan parent.
-
setParent
Description copied from interface:ContextualNodeSets the parent node- Specified by:
setParentin interfaceContextualNode- Parameters:
parent- The parent node
-
getContext
Description copied from interface:ContextualNodeGets the context description for the specified child; The context description contains all the context properties.- Specified by:
getContextin interfaceContextualNode- Parameters:
child- The child node- Returns:
- The context description
-
inheritedContext
Description copied from interface:ContextualNodeGets the inherited context; The context description contains all the context properties.- Specified by:
inheritedContextin interfaceContextualNode- Returns:
- The inherited context
-
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
-