Package com.highdeal.pnr.hci
Class PricePlanModel
java.lang.Object
com.highdeal.pnr.hci.PricePlanModel
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionBuilds an empty PricePlanModel.PricePlanModel(String name, String description, String text, String currencyCode) Builds a PricePlanModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCharacterData(String cData) Adds character data to the content element.voidaddChild(String name, XMLMarshallable child) Adds a child to the object, thechildrepresenting the marshallable object which must be added to the element.voidAdds a one shot rate.voidaddOneShotRates(Vector<OneShotRateModel> oneShotRates) Adds one shot rates.voidAdds a recurring rate.voidaddRecurringRates(Vector<RecurringRateModel> recurringRates) Adds recurring rates.voidaddUsageRate(UsageRateModel rate) Adds an usage rate.voidaddUsageRates(Vector<UsageRateModel> usageRates) Adds usage rates.voidCheck if the charging plan is compatible with this price plan.booleanReturns true if the price plan is valid.Creates the counter descriptions including persistent and transient counters.static final voidfindLeaves(RateComponentModel component, List<RateComponentModel> leaves) Fill the given list with all leaves starting from the given rate component.Gets the charging plan.getContext(ContextualNode child) Updates the context for the specified child and returns it.Deprecated.Gets the description.Gets the free text.getName()Gets the name.getOneShotRate(int index) Gets a one shot rate.Gets one shot rates.Gets the parameters.Gets the persistent counter descriptions.Gets the products.getRecurringRate(int index) Gets a recurring rate.Gets the recurring rates.Gets the transient counter descriptions.getUsageRate(int index) Gets an usage rate at a specified index.Gets the usage rates.Gets the inherited context.voidmarshal(XMLOutputter output) Gives an XML representation of this object, including its children.voidremoveOneShotRate(int index) Removes a one shot rate.voidremoveRecurringRate(int index) Removes a recurring rate.voidremoveUsageRate(int index) Removes an usage rate.Returns all the properties of this price plan.voidsetAttributes(XMLAttributes atts) Sets the attributes of the XML representation of the element being processed.voidsetChargingPlan(ChargingPlanModel chargingPlan) Sets thecharging plan.voidsetChargingPlanDictionaryModel(ChargingPlanDictionaryModel chargingPlanDictionaryModel) voidsetContext(RatingContextDescription contextDescription) Sets the context.voidsetCurrencyCode(String currencyCode) Deprecated.voidsetDescription(String description) Sets the description.voidsetFreeText(String text) Sets the free text.voidSets the name.voidSets the parameters.voidsetParent(ContextualNode node) Sets the parent.voidsetPersistentCounterDescriptions(Vector<CounterDescriptionModel> counterDescriptions) Sets the persistent counter descriptions.voidsetProducts(Vector<ProductModel> products) Sets the products.voidsetTransientCounterDescriptions(Vector<CounterDescriptionModel> counterDescriptions) Sets the transient counter descriptions.
-
Constructor Details
-
PricePlanModel
public PricePlanModel()Builds an empty PricePlanModel. -
PricePlanModel
Builds a PricePlanModel.- Parameters:
name- the name.description- the description.text- the free text.currencyCode- the currency code.
-
-
Method Details
-
setName
Sets the name.- Parameters:
name- the name.
-
getName
Gets the name.- Returns:
- the name.
-
setDescription
Sets the description.- Parameters:
description- the description.
-
getDescription
Gets the description.- Returns:
- the description.
-
setFreeText
Sets the free text.- Parameters:
text- the free text.
-
getFreeText
Gets the free text.- Returns:
- the free text.
-
setCurrencyCode
Deprecated.Sets the currency code.- Parameters:
currencyCode- the currency code.
-
getCurrencyCode
Deprecated.Gets the currency code.- Returns:
- the currency code.
-
setProducts
Sets the products.- Parameters:
products- a Vector ofProductModel.
-
getProducts
Gets the products.- Returns:
- a Vector of
ProductModel.
-
createCounterDescriptions
Creates the counter descriptions including persistent and transient counters.- Returns:
- a Vector of
CounterDescriptionModel.
-
setPersistentCounterDescriptions
Sets the persistent counter descriptions.- Parameters:
counterDescriptions- a Vector ofCounterDescriptionModel.
-
getPersistentCounterDescriptions
Gets the persistent counter descriptions.- Returns:
- a Vector of
CounterDescriptionModel.
-
setTransientCounterDescriptions
Sets the transient counter descriptions.- Parameters:
counterDescriptions- a Vector ofCounterDescriptionModel.
-
getTransientCounterDescriptions
Gets the transient counter descriptions.- Returns:
- a Vector of
CounterDescriptionModel.
-
getUsageRates
Gets the usage rates. Do not use this to add or remove elements.- Returns:
- a Vector of
UsageRateModel.
-
addUsageRates
Adds usage rates.- Parameters:
usageRates- a Vector ofUsageRateModel.
-
addUsageRate
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
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
Gets the recurring rates. Do not use this to add or remove elements.- Returns:
- a Vector of
RecurringRateModel.
-
addRecurringRates
Adds recurring rates.- Parameters:
recurringRates- a Vector ofRecurringRateModel.
-
addRecurringRate
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
Gets a recurring rate.- Parameters:
index- the index of the recurring rate to get.- Returns:
- a recurring rate.
-
getOneShotRates
Gets one shot rates. Do not use this to add or remove elements.- Returns:
- a Vector of
OneShotRateModel.
-
addOneShotRates
Adds one shot rates.- Parameters:
oneShotRates- a Vector ofOneShotRateModel.
-
addOneShotRate
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
Gets the charging plan.- Returns:
- the
charging plan.
-
setChargingPlan
Sets thecharging plan.- Parameters:
chargingPlan-
-
checkChargingPlanCompatibility
Check if the charging plan is compatible with this price plan.- Throws:
InvalidInitializationException
-
setChargingPlanDictionaryModel
-
getChargingPlanDictionaryModel
-
getOneShotRate
Gets a one shot rate.- Parameters:
index- the index of the one shot rate to get.- Returns:
- a one shot rate.
-
getParameters
Gets the parameters.- Returns:
- a Vector of
ParameterModel.
-
setParameters
Sets the parameters.- Parameters:
p- a Vector ofParameterModel.
-
setParent
Sets the parent.- Specified by:
setParentin interfaceContextualNode- Parameters:
node- the parent (ignored).
-
getContext
Updates the context for the specified child and returns it.- Specified by:
getContextin interfaceContextualNode- Parameters:
child-- Returns:
- refreshed context.
-
inheritedContext
Gets the inherited context.- Specified by:
inheritedContextin interfaceContextualNode- Returns:
- the inherited context.
-
setContext
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
Returns all the properties of this price plan.- Returns:
- a list of
PropertyDescriptionModelthat represents all the properties defined in this price plan.
-
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
-
addCharacterData
Description copied from interface:XMLMarshallableAdds character data to the content element.- Specified by:
addCharacterDatain interfaceXMLMarshallable- Parameters:
cData- The character data to be added
-
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:
name- The name of tag for the childchild- The child 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
-
findLeaves
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.
-
ChargeComponentModel.getCurrencyCode().