OpenBiz Document 1.2

1. Overview of Openbiz 1.2
Openbiz 1.2 architecture stack
Openbiz 1.2 package organization
Sequence diagram of a typical RPC call
2. Difference between 1.2 and 1.1.x
BizSystem - the infrastructure class
BizDataObj - Query and get results
BizForm - RPC calls
Metadata changes
Logging and debugging
3. Installation
4. Build your application
5. API document

Overview of Openbiz 1.2

Openbiz was rewritten in its 1.2 version. Some facts drove this code rewritings. 

1.1 Openbiz 1.2 architecture stack

1.2 Openbiz 1.2 package organization

Package Class
BizSystem BizSystem
- Provide a global variable accessed anywhere in openbiz application
- Provide the Get method for ObjectFactory, SessionContext, TypeManager, ClientProxy and Configuration
- Provide static methods for accessing XML metadata, logging and error reporting.
ObjectFactory 
- It's a factory class to get metadata-driven objects (BizView, BizForm, BizdataObj and their extended classes) 
SessionContext
- Session management class that has additional methods to save/get session variables of metadata-driven stateful objects through their GetSessionVars|SetSessionVars interfaces
TypeManager
- Type management class that has help methods to format data to UI and unformat UI input to data
ClientProxy
- It's a class that is treated as the bi-direction proxy of client. Through this class, others can get client form inputs, redraw client form or call client javascript functions.
Configuration
- A class that has help methods to get data from config.xml
BizDataObj BizDataObj
- It's the base class of all data object classes. Before Openbiz 1.2, BizDataObj was called BizObj. Since BizObj means Business Object, but it acts as business data unit, in 1.2 it is changed as BizDataObj.
BizRecord
- BizRecord class implements basic function of handling record
BizField
- BizField is the class of a logic field which mapps to a table column
BizDataSql
- BizObjSql is the class to constrcut SQL statement for BizDataObj
CacheRecordList
- CacheRecordList implements the cache for BizDataObj
BizView BizView
- BizView is the class that contains list of forms. View is same as html page.
BizForm
- BizForm is the base class that contains UI controls. BizForm is a html form that is included in a BizView which is a html page.
RecordRow
- RecordRow is the class that contains FieldControls
ToolBar
- ToolBar is the class that contains HTMLControls
NavBar
- NavBar is the class that contains navigation buttons
HTMLControl
- HTMLControl is the base class of HTML controls
FieldControl
- FieldControl is the base class of field control who binds with a bizfield
DisplayMode
- contains the BizForm display mode information

1.3 Sequence diagram of a typical RPC call

 

Difference between Openbiz 1.2 and 1.1.x

2.1 BizSystem - the infrastructure class

Before 1.2, all infrastructure functionalities are implemented as functions in system.php.

In 1.2, a new BizSystem class is introduced to provides an entry point of infrastructure funtionalities

Example of getting metadata-driven object instance

2.2 BizDataObj - Query and get results

1.1.x BizObj is renamed as BizDataObj in 1.2, because it mainly acts as business data unit. 

1.1.x use GetField and SetField to do get and set field values. In 1.2, no field level methods, but using GetRecord() and UpdateRecord() method to do record level operations. The idea behind is to make easier coding to retrieve query results and provide coarse-grained interfaces between 2 layers.

1.1.x way to query and get records

$bizobj->SetSearchRule("...");    // set search rule
$bizobj->RunSearch(-1);    // run query against the database tables. 
$bizobj->Home();    // reset the result record set
$hasVal = $bizobj->MoveFirst();    // move cursor to first record
while ($hasVal)
{
    foreach ($fieldlist as $field)
        $field_val[] = $bizobj->GetField($field);
   
// user logic code can be put here. 
    $hasVal = $bizobj->MoveNext();    // move cursor to next record
}

1.2 way to query and get records

$bizobj->SetSearchRule("...");    // set search rule
$bizobj->RunSearch(-1);    // run query against the database tables. 
while ($recArray = $bizobj->GetRecord(1))    // get current record and move the cursor to the next record 
{
    // user logic code can be put here. recArray is an associated array whose key is "fieldname" and value is value of the field
}

2.3 BizForm - RPC calls

From Openbiz 1.2, ClientProxy acts as a middle man between client and BizForm (server). It have convenient methods for BizForm to call to get client inputs and redraw client components.

  1.1.x 1.2
Get the client inputs Need to explicitly specify $currentRowNum and $currentControl as input arguments of BizForm methods $currentRowNum and $currentControl can be retrieved from ClientProxy object by calling GetFormInputs method
Return html content Need to explicitly call BuildTgtCtnt function to generate client-updating html  Call RedrawForm method in ClientProxy object to generate client-updating html

2.4 Metadata changes

Openbiz 1.2 use almost the "same" metadata files used in 1.1.x. Only trivial change needs to be done make upgrade the 1.1.x metadata files.

2.5 Logging and debugging

In Openbiz 1.2, developers can add diagnostic code using new logging and debugging functionalities.

- Logging. BizSystem::log() method  can be called to log 4 priority levels LOG_EMERG, LOG_ERR, LOG_WARNING and LOG_DEBUG. Also a subject can be specified to give log messages different categories.

- Debugging. Other than the DEBUG flag in 1.1.x is still valid, developers can turn on other 2 debug flags.
  1) Turn on SQL debug flag. Uncomment //$this->m_DbConnection[$rDBName]->debug = true; in BizSystem::GetDBConnection().
  2) Turn on RPC debug flag, each RPC response is printed in a separate window. Set var RPC_DEBUG = true; in clientUtil.js.

 

Installation

Installation of Openbiz 1.2 is almost same as installation steps for Openbiz 1.1.x. Please note some difference described below:

OpenBiz is written by PHP5 scripts, it won't work in PHP4.x web server. We recommend platforms as

Installation directory changed from evtmgr (1.1.x) to openbiz, or you can configure apache using: Alias /openbiz /path/to/openbiz.

Windows installer is not in Openbiz 1.2 beta. It'll be available in 1.2 final release.

Openbiz Deisgn Tools is not in Openbiz 1.2 beta. It'll be available in 1.2 final release.

 

Build Your Application

The way to build application with Openbiz 1.2 is same as that of Openbiz 1.1.x. Please refer to the Openbiz manual for 1.1.x.

Since Openbiz Deisgn Tools is not in Openbiz 1.2 beta, developers need to use xml/text editors to modify the metadata xml files.