OSB_LIB::BillingXml Class Reference

Inheritance diagram for OSB_LIB::BillingXml:

Inheritance graph
[legend]
Collaboration diagram for OSB_LIB::BillingXml:

Collaboration graph
[legend]
List of all members.

Detailed Description

Enables various invoice items and their details to be written in XML format.

Class BillingXml provides XML writer functions needed to create OSB XML invoices. Such writers exist for the invoice itself, each type of invoice item and all basic billing classes that need to be written to the invoice. The invoice XML writer is the entry point and should be called by the billing application to print an invoice. All XML writers are collected in a class so that you can easily store thread specific data as members of this class.

Class BillingXml contains default implementations of XML writers for commonly used billing classes. It can be extended by inheritance. In order to overload functions of this class, e.g., BillingXml::writeInfo(), remember to use a using-declaration in the derived class:

      class MyBillingXml : public OSB_LIB::BillingXml {
      public:
          // Make writeInfo() functions of the base class visible
          using OSB_LIB::BillingXml::writeInfo;

          // ...
      }

Furthermore, note how we use dynamic_cast in connection with template functions. This seems necessary because template functions cannot be virtual.

Definition at line 239 of file billingxml.h.

Public Member Functions

Protected Member Functions


Constructor & Destructor Documentation

OSB_LIB::BillingXml::BillingXml ( std::ostream &  o  )  [inline]

Constructor.

Parameters:
o Output stream for the generated XML.

Definition at line 246 of file billingxml.h.

virtual OSB_LIB::BillingXml::~BillingXml (  )  [inline, virtual]

Destructor.

Definition at line 248 of file billingxml.h.


Member Function Documentation

virtual void OSB_LIB::BillingXml::writeAddress ( const Address address,
AddressType  addressType 
) [virtual]

Address XML writer for a given address type.

Parameters:
address Address.
addressType Address type.

virtual void OSB_LIB::BillingXml::writeAssociate ( const Associate associate  )  [virtual]

Associate XML writer.

Parameters:
associate Associate.

virtual void OSB_LIB::BillingXml::writeBaseAmount ( const BaseAmount baseAmount  )  [virtual]

Base amount XML writer.

Parameters:
baseAmount Base amount.

virtual void OSB_LIB::BillingXml::writeInvoice ( Invoice invoice,
const Contract contract,
const AssociateList associates 
) [virtual]

XML writer for an OSB invoice.

This is the starting point to write an OSB XML invoice. Its main task is to invoke the writeXml() method of each invoice item on the invoice. In addition, it prints an XML header and footer and before each invoice item is written, it prints its section.

This method should not need to be overwritten except if you want to change the basic structure of an XML invoice. Instead, changes to the contents of XML invoices can be made by adding new invoice items and corresponding XML writers or customizing existing XML writers.

Here is the default implementation of writeInvoice():

          void BillingXml::writeInvoice(Invoice& invoice,
                                        const Contract& contract,
                                        const AssociateList& associates)
          {
              writeXmlHeader();
              for (Invoice::ItemListI i=invoice.itemListBegin();
                   i != invoice.itemListEnd(); ++i) {
                  writeSection((*i)->section(), contract, associates);
                  (*i)->writeXml(*this);
              }
              writeXmlFooter();
          }

Parameters:
invoice The invoice to be written.
contract Contract for which the invoice is generated.
associates List of all associates (owner and all product users) related to the contract.

Implements OSB_LIB::BillingXmlBase.

virtual void OSB_LIB::BillingXml::writeInvoiceInfo ( const InvoiceInfo invInfo  )  [virtual]

Invoice Info XML writer.

Parameters:
invInfo Invoice info to to write.

virtual void OSB_LIB::BillingXml::writeMoney ( const Money money,
bool  withCurrency = true 
) [virtual]

Money XML writer.

Parameters:
money Money.
withCurrency Flag whether currency should be written.

virtual void OSB_LIB::BillingXml::writeOtc ( const OnetimeCharge otc  )  [virtual]

One-time charge XML writer.

Parameters:
otc One-time charge.

virtual void OSB_LIB::BillingXml::writeOtcItem ( const OnetimeChargeItem otcItem  )  [virtual]

One-time charge item XML writer.

Parameters:
otcItem One-time charge item.

void OSB_LIB::BillingXml::writeSection ( const Section section,
const Contract contract,
const AssociateList associates 
)

Section XML writer.

This function will not be overloaded as all behaviours for writing a section should be the same.

Parameters:
section Section.
contract Contract for which the invoice is generated.
associates List of all associates (owner and all product users) related to the contract.

virtual void OSB_LIB::BillingXml::writeSubsCharge ( const SubsCharge subsCharge  )  [virtual]

Subscription charge XML writer.

Parameters:
subsCharge Subscription charge.

virtual void OSB_LIB::BillingXml::writeSubsItem ( const SubsItem subsItem  )  [virtual]

Subscription item XML writer.

Parameters:
subsItem Subscription item.

virtual void OSB_LIB::BillingXml::writeSummaryCharges ( const SummaryCharges sumCharges  )  [virtual]

Summary charges XML writer.

Parameters:
sumCharges Summary charges to write.

virtual void OSB_LIB::BillingXml::writeTaxAmount ( const TaxAmount taxAmount  )  [virtual]

Tax amount XML writer.

The currency is only written if the currency code passed as parameter is not the same as that of the tax amount.

Parameters:
taxAmount Tax amount.

virtual void OSB_LIB::BillingXml::writeTotalItem ( const TotalItem totalItem  )  [virtual]

Total item XML writer.

Parameters:
totalItem Total item.

virtual void OSB_LIB::BillingXml::writeUsagerecord ( const Usagerecord usagerecord  )  [protected, virtual]

Usage record XML writer.

Parameters:
usagerecord Usage record.

virtual void OSB_LIB::BillingXml::writeUsagerecordDetail ( const UsagerecordDetail UsagerecordDetail  )  [virtual]

Usage detail XML writer.

Parameters:
UsagerecordDetail Usage detail.

virtual void OSB_LIB::BillingXml::writeUsagerecordItem ( const UsagerecordItem usagerecordItem  )  [virtual]

Usage item XML writer.

Parameters:
usagerecordItem Usage item.

virtual void OSB_LIB::BillingXml::writeXmlFooter (  )  [virtual]

Write XML invoice footer.

Implements OSB_LIB::BillingXmlBase.

virtual void OSB_LIB::BillingXml::writeXmlHeader (  )  [virtual]

Write XML invoice header.

Implements OSB_LIB::BillingXmlBase.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:09:54 2006 for OSB Library by  doxygen 1.4.7