7. ASOLib—OpenROAD Server Library : XML Parameters for Use with GSCPs : XML and 4GL Data : Example: How You Can Map 4GL Parameter Data to XML
 
Share this page                  
Example: How You Can Map 4GL Parameter Data to XML
The following example illustrates how 4GL parameter data is mapped to XML tags and vice versa. Suppose that you have a database that contains relationships between authors, publishers, editions, and books. The business user classes in the OpenROAD Server have been mapped on to this data and have the following structure.
The attributes of user class uc_author are:
i_id        = INTEGER,
i_age       = INTEGER,
v_name      = VARCHAR(32),
The attributes of user class uc_publisher are:
v_name      = VARCHAR(32),
The attributes of user class 'uc_book' are:
arr_UCEdition = ARRAY OF uc_edition,
v_title       = VARCHAR(32),
UCauthor      = uc_author,
The attributes of user class uc_edition are:
i_issue_no  = INTEGER,
i_year      = INTEGER,
m_cost      = MONEY,
UCpublisher = uc_publisher,
This example uses a Business Policy Manager named uc_author_pm. Certain methods have been selected for exposure, and so GSCPs have been generated for these methods automatically.
Note:  XML-to-4GL mapping is also available for procedure GSCPs if a stateless approach is preferred.
One of the GSCPs generated is scp_GetAuthorAndBooks, which maps to method GetAuthorAndBooks. The GSCP contains all of the underlying method's parameters (plus others added automatically). One of the method's parameters is an input parameter p_i_author_id, which represents an ID of an author. The data returned from this method is a list of books that have been published by the author, together with the author's details.
The parameter list for method GetAuthorAndBooks looks like this:
p_i_author_id  = INTEGER,
b_UCAuthor     = uc_author,
b_arr_UCBooks  = ARRAY of uc_book,
The p_i_author_id parameter is an input parameter, and b_UCAuthor and b_arr_UCBooks constitute output parameters.