OSB_LIB::Contract Class Reference

Collaboration diagram for OSB_LIB::Contract:

Collaboration graph
[legend]
List of all members.

Detailed Description

Contract, network usage agreement.

Remarks:
Copy constructor, assignment and destructor by compiler.

Definition at line 71 of file contract.h.

Locking and object version maintenance

Public Types

Public Member Functions

Read access to data members
Modify data members
PersProduct list maintenance

Static Public Member Functions

Private Member Functions

Apply status requests and changes:

Private Attributes

Friends


Member Typedef Documentation

typedef Id<Contract> OSB_LIB::Contract::Oid

Object id of Contract, database link.

Definition at line 83 of file contract.h.

typedef Id<Associate> OSB_LIB::Contract::OwnerId

Just a convenient short-hand in the header.

Definition at line 86 of file contract.h.


Member Enumeration Documentation

enum OSB_LIB::Contract::AccountingType

Possible accounting types for a contract.

The accounting type indicates if a contract is with a customer, i.e., invoices for sales must be generated, or if it is with a supplier for which reconciliation statements for purchases are created.

Enumerator:
atCustomer  Customer; create invoice for sales.
atSupplier  Supplier; create reconciliation statements for purchases.
atUnknown  Unknown accounting type.

Definition at line 97 of file contract.h.


Constructor & Destructor Documentation

OSB_LIB::Contract::Contract ( const Oid oid = Oid()  )  [inline, explicit]

Constructor with optional object id.

Definition at line 600 of file contract.h.


Member Function Documentation

Contract::AccountingType OSB_LIB::Contract::accountingType (  )  const [inline]

The accounting type.

Definition at line 636 of file contract.h.

References accountingType_.

bool OSB_LIB::Contract::addPersProduct ( OSB_DB::Session session,
PersProduct pp,
bool  noWait 
)

Add a personalized product to the contact.

Add a personalized product entry to the database. Also add it to the persproduct list. Pers. product id, contract id and status of the pers. product will be set and session will be committed if successful.
The action is not allowed when the contract is deactivated.

Parameters:
session Database session.
pp Pers product to be added.
noWait Don't wait for database locks?
Returns:
True if it is successful.
Exceptions:
OsbException from lock(const OSB_DB::Session&, bool) const, see there.
OsbException if the contract is deactivated.

bool OSB_LIB::Contract::applyChange ( const OSB_DB::Session session,
const StatusChange change,
OsbErrors errors,
bool  noWait 
) [private]

Apply a change of the effective status to pers. products.

Parameters:
session Database session to use.
change Status change to process, it contains the old and new effective status.
errors Gets errors and warnings.
noWait Don't wait for database locks?
Needed to lock the pers. products.
Returns:
true if no error occurred during processing, else false.
Note:
Strictly private.

const Id< Billcycle > & OSB_LIB::Contract::billcycleId (  )  const [inline]

The identifier of the billcycle.

Definition at line 626 of file contract.h.

References billcycleId_.

int OSB_LIB::Contract::buildPersParts (  ) 

Build pers parts for all personalized products.

The function calls the member function PersProdct::buildPersParts() for each subscribed product of the contract.

Returns:
0 in case of success, currently no other value.
Exceptions:
OsbException 
  • if the product of a personalized product can not be found.

bool OSB_LIB::Contract::changeStatus ( const OSB_DB::Session session,
StatusChange change,
OsbErrors errors,
bool  noWait 
) [private]

Change the effective status of the contract.

Parameters:
session Database session to use.
change Copy of the status change to process, it contains the max. allowed effective status.
errors Gets errors and warnings.
noWait Don't wait for database locks?
Needed to lock the pers. products.
Returns:
true if no error occurred during processing, else false.
Note:
Even if the function returns true, errors still may contain warnings.

Called only by RequestHandler or Associate.

const DateTime & OSB_LIB::Contract::createdDate (  )  const [inline]

Date when the contract was first created.

Definition at line 616 of file contract.h.

References createdDate_.

const Money & OSB_LIB::Contract::creditLimit (  )  const [inline]

Credit limit amount. Can be zero if no credit limit.

Definition at line 631 of file contract.h.

References creditLimit_.

bool OSB_LIB::Contract::delPersProduct ( OSB_DB::Session session,
const PersProduct::Oid oid,
bool  noWait 
)

Remove a personalized product for this contract.

Including remove an entry from the database, also remove it from the perproduct list. Session will be committed if successful.

Parameters:
session Database session.
oid Object id of personalized product to be removed.
noWait Don't wait for database locks?
Returns:
True if it is successful.
Exceptions:
OsbException from lock(const OSB_DB::Session&, bool) const, see there.
OsbException if the pers. product is not found.

bool OSB_LIB::Contract::delPp ( const OSB_DB::Session session,
const PersProduct::Oid oid 
) [private]

Remove a personalized product for this contract.

Including remove an entry from the database, also remove it from the perproduct list.

Parameters:
session Database session.
oid Object id of personalized product to be removed.
Returns:
True if it is successful.
Exceptions:
OsbException if the pers. product is not found.

const Status & OSB_LIB::Contract::effStatus (  )  const [inline]

Currently effective status.

Definition at line 641 of file contract.h.

References effStatus_.

const DateTime & OSB_LIB::Contract::effStatusDate (  )  const [inline]

Date when effective status became valid.

Definition at line 646 of file contract.h.

References effStatusDate_.

const PersProduct* OSB_LIB::Contract::findPersProduct ( const PersProduct::Oid oid  )  const

Find the pers product based on the given oid.

Parameters:
oid Oid of the pers product.
Returns:
Pointer to the found pers product,
NULL pointer if pers product can not be found.

const PersProduct& OSB_LIB::Contract::getPersProduct ( const PersProduct::Oid oid  )  const

Find the pers product based on the given oid.

Parameters:
oid Oid of the pers product.
Returns:
Reference to the found pers product.
Exceptions:
OsbException if the pers. product is not found.

static void OSB_LIB::Contract::handleObjectStatus ( ObjectStatus  os,
const Contract::Oid id 
) [static, private]

Evalute the object status of a contract.

Parameters:
os Object status to evaluate.
id The id of the contract for which os is valid.
Exceptions:
ObjectDeleted 
ObjectModified 
ObjectBusy if noWait is true and the contract is locked by another database session.

void OSB_LIB::Contract::incObjVs ( const OSB_DB::Session session  )  [private]

Increment the object version by 1.

Parameters:
session Database session to use.
Exceptions:
OsbException (internal error) if the update of the object version fails in the database.
The function should be used only after a successful call of a lock() function.

Remarks:
The object version has to be changed whenever there was a change in Contract itself and a pers. product was added or deleted.

bool OSB_LIB::Contract::insert ( const OSB_DB::Session session  )  [private]

Insert a contract to database.

This method will only be called by associate.
The object's id is not set before the function call. If the function completed successfully, the object will have it's id set, else the id will still be the same (not set).

Parameters:
session Database session to use.
Returns:
true if success else false.

void OSB_LIB::Contract::lock ( const OSB_DB::Session session,
bool  noWait 
) const [private]

Lock a contract in the database.

Parameters:
session Database session to use.
noWait Don't wait for database locks?
Exceptions:
OsbException from handleObjectStatus().

static void OSB_LIB::Contract::lock ( const OSB_DB::Session session,
const Contract::Oid id,
bool  noWait 
) [static, private]

Lock a contract in the database.

Parameters:
session Database session to use.
id The object id of the contract to lock.
noWait Don't wait for database locks?
Exceptions:
OsbException from handleObjectStatus(), (ObjectModified is not applicable).

long OSB_LIB::Contract::objVs (  )  const [inline]

Object version number.

Definition at line 666 of file contract.h.

References objVs_.

const Contract::Oid & OSB_LIB::Contract::oid (  )  const [inline]

Unique object id, database link.

Definition at line 606 of file contract.h.

References oid_.

const Id< Associate > & OSB_LIB::Contract::ownerId (  )  const [inline]

The associate id who owns the contract.

Definition at line 611 of file contract.h.

References ownerId_.

PersProduct* OSB_LIB::Contract::persProduct ( const PersProduct::Oid oid  ) 

Find the pers product based on the given oid.

Parameters:
oid Oid of pers product.
Returns:
Pointer to pers product if found,
else 0.

const Status & OSB_LIB::Contract::prefStatus (  )  const [inline]

Currently prefer status.

Definition at line 651 of file contract.h.

References prefStatus_.

const DateTime & OSB_LIB::Contract::prefStatusDate (  )  const [inline]

Date when prefer status was required.

Definition at line 656 of file contract.h.

References prefStatusDate_.

const PersProducts & OSB_LIB::Contract::products (  )  const [inline]

List of pers product.

Definition at line 661 of file contract.h.

References products_.

bool OSB_LIB::Contract::read ( const OSB_DB::Session session  ) 

Read the contract from the database.

Parameters:
session Database session to use.
Returns:
true if the contract was found and read from the database, else false.

void OSB_LIB::Contract::readStatusChanges ( const OSB_DB::Session session,
const Period period 
)

Get status changes for a period of time.

The function reads the status changes for a contract itself and all personalized products and their nodes of this contract and a time period.

Parameters:
session Database session to use.
period Time period covered by the status requests,
the upper boundary is not included.

void OSB_LIB::Contract::readStatusRequests ( const OSB_DB::Session session,
const Period period 
)

Get status requests for a period of time.

The function reads the status requests for a contract itself and all personalized products and their nodes of this contract and a time period.

Parameters:
session Database session to use.
period Time period covered by the status requests,
the upper boundary is not included.

bool OSB_LIB::Contract::remove ( const OSB_DB::Session session  )  [private]

Remove a contract from database.

This method will be called by associate.
The action only can be done when the status is on svCreated.

Parameters:
session Database session.
Returns:
true if success else false.
Exceptions:
OsbException 
  • object not found
  • object has been modified
  • not in status created
  • as specified by the gateway class.

bool OSB_LIB::Contract::requestStatus ( const OSB_DB::Session session,
StatusRequest request,
OsbErrors errors,
bool  noWait 
)

Set the preferred status of the contract.

Parameters:
session Database session to use.
request Preferred status to set, see below.
errors Get warnings and errors during processing.
noWait Don't wait for database locks?
Returns:
true if the request is accepted, else false.
Exceptions:
OsbException if the contract was modified in the database.
OsbException if the contract is locked and noWait is true.
When calling the function, status must have the requested status set; if the status date is not set the system date is used.
If successful the request id, the requested date/time and the entry timestamp will be set.

bool OSB_LIB::Contract::setAccountingType ( AccountingType  accountingType  )  [inline]

Set the accounting type.

Definition at line 207 of file contract.h.

References accountingType_.

bool OSB_LIB::Contract::setBillCycle ( const Id< Billcycle > &  bcId  )  [inline]

Set billcycle.

Definition at line 195 of file contract.h.

References billcycleId_.

bool OSB_LIB::Contract::setCreditLimit ( const Money credit  )  [inline]

Set the credit limit.

Definition at line 201 of file contract.h.

References creditLimit_.

OsbError OSB_LIB::Contract::setPrefStatus ( const OSB_DB::Session session,
const StatusRequest request 
) [private]

Set the preferred status of the contract.

Parameters:
session Database session to use.
request Status request that triggered the change of the preferred status.
Returns:
The first encountered error.
Note:
Called by RequestHandler only.

bool OSB_LIB::Contract::setTaxkey ( const Id< TaxKey > &  tkId  )  [inline]

Set tax key.

Definition at line 189 of file contract.h.

References taxkey_.

const StatusChanges & OSB_LIB::Contract::statusChanges (  )  const [inline]

Get the status changes.

The list is meaningful only after having called readStatusChanges().

Definition at line 671 of file contract.h.

References chngs_.

const StatusRequests & OSB_LIB::Contract::statusRequests (  )  const [inline]

Get the status requests.

The list is meaningful only after having called readStatusRequests().

Definition at line 676 of file contract.h.

References reqs_.

const Id< TaxKey > & OSB_LIB::Contract::taxkey (  )  const [inline]

The identifier of the taxkey.

Definition at line 621 of file contract.h.

References taxkey_.

static AccountingType OSB_LIB::Contract::toAccountingType ( char  at  )  [static]

Convert a character into an accounting type.

Parameters:
at Value to convert.
Returns:
The accounting type that corresponds to at, atUnknown in case of an unknown type.

static char OSB_LIB::Contract::toChar ( AccountingType  at  )  [static]

Convert an accounting type to a character.

Parameters:
at Accounting type to convert.
Returns:
The character value that corresponds to at, atUnknown in case of an unknown type.

void OSB_LIB::Contract::update ( OSB_DB::Session session,
bool  noWait 
)

This function allow contract to update itself into database.

This function will update an existing contract object in the database. If the function completed successfully, the object's objVs will increment by 1. Session will be committed if successful.

Parameters:
session Database session.
noWait Don't wait for database locks?
Exceptions:
OsbException from lock(const OSB_DB::Session&, bool) const, see there.


Friends And Related Function Documentation

friend class AnCList [friend]

Allow to remove contract.

Definition at line 79 of file contract.h.

friend class Associate [friend]

Definition at line 74 of file contract.h.

friend class OSB_DB::ContractGw [friend]

Definition at line 73 of file contract.h.

friend class OSB_DB::PersProductGw [friend]

Definition at line 72 of file contract.h.

friend class RequestHandler [friend]

Definition at line 76 of file contract.h.


Member Data Documentation

AccountingType OSB_LIB::Contract::accountingType_ [private]

Sales (invoices) or purchases (reconciliation) contract.

Definition at line 590 of file contract.h.

Referenced by accountingType(), and setAccountingType().

Id<Billcycle> OSB_LIB::Contract::billcycleId_ [private]

id of billcycle

Definition at line 570 of file contract.h.

Referenced by billcycleId(), and setBillCycle().

StatusChanges OSB_LIB::Contract::chngs_ [private]

List of status changes.

Definition at line 582 of file contract.h.

Referenced by statusChanges().

DateTime OSB_LIB::Contract::createdDate_ [private]

date when the contract was first created

Definition at line 566 of file contract.h.

Referenced by createdDate().

Money OSB_LIB::Contract::creditLimit_ [private]

Credit limit of contract;.

Definition at line 588 of file contract.h.

Referenced by creditLimit(), and setCreditLimit().

Status OSB_LIB::Contract::effStatus_ [private]

the "currently" effective status

Definition at line 572 of file contract.h.

Referenced by effStatus().

DateTime OSB_LIB::Contract::effStatusDate_ [private]

date when effective status was set

Definition at line 574 of file contract.h.

Referenced by effStatusDate().

long OSB_LIB::Contract::objVs_ [private]

the object version.

Definition at line 580 of file contract.h.

Referenced by objVs().

Oid OSB_LIB::Contract::oid_ [private]

unique id: database link

Definition at line 562 of file contract.h.

Referenced by oid().

OwnerId OSB_LIB::Contract::ownerId_ [private]

id of contract owner

Definition at line 564 of file contract.h.

Referenced by ownerId().

Status OSB_LIB::Contract::prefStatus_ [private]

the perferred status of the associate

Definition at line 576 of file contract.h.

Referenced by prefStatus().

DateTime OSB_LIB::Contract::prefStatusDate_ [private]

date when preferred status was requested

Definition at line 578 of file contract.h.

Referenced by prefStatusDate().

PersProducts OSB_LIB::Contract::products_ [private]

list of personalized products

Definition at line 586 of file contract.h.

Referenced by products().

StatusRequests OSB_LIB::Contract::reqs_ [private]

List of status requests.

Definition at line 584 of file contract.h.

Referenced by statusRequests().

Id<TaxKey> OSB_LIB::Contract::taxkey_ [private]

taxkey of the contract

Definition at line 568 of file contract.h.

Referenced by setTaxkey(), and taxkey().


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