For more detailed information on the wwBusiness class, please check the Web Connection documentation, but here's a short highlight of the functionality provided by this class that is important to the Web Store.

Single level business object
wwBusiness is a single level business object which means everything happens on a single flat class hierarchy. wwBusiness has about 20 custom methods and 10 important custom properties. Because of this implementation it's lightweight in terms of overhead and also easy to pick up because you don't have to manange multiple different objects.

All objects except the two lineitems classes are direct subclasses of wwBusiness. The two lineitem classes are subclasses of wwItemList which provides standard behavior for multiple list style items.

The key feature of wwBusiness is that it uses a disconnected approach to storing data - data is loaded from disk and stored in members of the business object. While loaded there's no dependency on any underlying datasource so that data can be easily passed around.

The oData member
wwBusiness is by default tied to an underlying table since this is the most common scenario for how a business object maps to the underlying datasource if any. But you can also implement wwBusiness objects in such a way that data is retrieved from multiple datasources or no data source at all as long as an oData member can be created to describe the data.

The oData member by default is a SCATTER NAME object that is scattered from the result of a single record SQL operation. So Load(pk) loads a specific record into the oData member. Save() then writes the data back to the data source - in between the data is not tied to the data in any way. Any logic inside of the business object that needs to manipulate the data typically does so the through the properties of the business object and then writes the data back when complete calling the Save() method.

Common methods you'll be using with the oData member are Load(lnPk), Find(lcFilter), New() and Save(). All of these default implementations will simply load the oData member (or save from it) using SCATTER NAME or GATHER NAME.

Multiple items - lineitems and temporary lineitems
The base business object does not handle multiline items. However, the class also includes another simple object

Primary Key Requirements
The business object works off primary keys and every table controlled by the wwBusiness class must have an Integer primary key field. By default this name is expected to be PK, but you can override this on the objects PKField property. The key must be of type int!

Furthermore, PKs are generated using an ID file that contains one record per table so the record can be locked to guarantee unique IDs.The table is specified in the cIDTable property and the table must contain a field named TableName (string) and ID (Integer). Every table controlled through a business object must have a record in this table with Tablename set to the name of the table without extension.

The easiest way to set up any new business objects is to use the Web Connection Console and the wwBusiness object Wizard in it to create the business object and mappings, including the entry in the key table for you.


Last Updated: 06/01/03 | Send topic feedback