The easiest way to understand view objects is to look at an example. Later sections in this chapter describe how particular mappings occur.
The following example shows how generators map a given import view in the model to a view object:
ADDR_SERVER IMPORTS:
Entity View in address
line1 line2
Group View inGV (2)
Entity View ingroup address line1 line2
From the given import view, five EJB classes are generated. The classes and their properties are shown in the following table:
|
Class |
Attributes |
|---|---|
|
AddrServerImport |
|
|
AddrServer.InAddress |
|
|
AddrServer.Ingv |
|
|
AddrServer.IngvRow |
|
|
AddrServer.IngroupAddress |
|
The number of classes increases in proportion with the number of entity views, work sets, and group views.
To finish the sample, it is beneficial to look at how a programmer gets and sets the various pieces of data in the views. The following code sample is written in Java.
Instantiate the Import View object:
AddrServerImport importView = new AddrServerImport();
Set the command system level data:
importView.Command = "SEND";
Access the InEVAddress line2 attribute:
String value = importView.InEVAddress.Line2Fld;
Get the maximum capacity of the IngvGV group view:
for (int i = 0; i < importView.IngvGV.Capacity; i++)
Set the current IngvGV number of rows:
importView.IngvGV.Length = 2;
Set the line1 attribute of the IngroupEVAddress entity view:
importView.Ingv[2].IngroupEVAddress.Line1Fld = "ABC";
Reset the InAddress Entity View back to defaults:
importView.InAddress.Reset();
|
Copyright © 2013 CA.
All rights reserved.
|
|