Try OpenEdge Now
skip to main content
Java Open Clients
Accessing ABL ProDataSets : Preparing and passing ProDataSets as ProDataGraph parameters : Passing a ProDataGraph as OUTPUT : Accessing the ProDataGraph meta data for an unknown schema
 
Accessing the ProDataGraph meta data for an unknown schema
You might not know any or all of the schema for an output ProDataGraph. In this case, you can introspect the ProDataGraph to identify all of its meta data, including the names and locations of all ProDataGraph components that map to the corresponding ProDataSet OUTPUT parameter. These components can include only the functional Java components of the ProDataGraph or they can also include the names, locations, and data types of the ProDataSet, its temp-tables, fields, and data-relations, as you might require.
You can get meta data for an unknown ProDataGraph in different ways. The following procedure shows one approach for accessing ProDataGraph, primarily by identifying and using component names. You can also identify component locations and use indexes (rather than names) to more directly and efficiently access components.
To access the meta data of a ProDataGraph:
1. If you need the ABL name of the ProDataSet that the ProDataGraph maps to, use the following ProDataGraph method:
Syntax
java.lang.String getProDataGraphName()
2. To get ABL schema information for temp-tables or get information on data-relations that have been passed in the ProDataGraph, get its associated ProDataGraphMetaData object using the following ProDataGraph method:
Syntax
ProDataGraphMetaData getMetaData()
3. To get ABL schema information for each temp-table passed in the ProDataGraph:
a. Get the ABL names for all ProDataSet temp-tables (ProDataObject collections) in the ProDataGraph using the following ProDataGraphMetaData method:
Syntax
java.lang.String[] getTableNames()
b. Get the ProDataObjectMetaData for a temp-table using the following ProDataGraphMetaData method:
Syntax
ProDataObjectMetaData getTableMetaData(int idx)
Where the idx value corresponds to the index into the list of table names that refers to the name of the given temp-table.
c. Some useful schema information you can get from this meta data for an output temp-table is the field name, the ABL data type, any extent (for an array), and the specified user order of each temp-table field using the following ProDataObjectMetaData methods:
Syntax
int getFieldName(int propertyIndex)
int getProType(int propertyIndex)
int getExtent(int propertyIndex)
int getUserOrder(int propertyIndex)
The propertyIndex is a 0-based value that you can obtain by looping through the number of temp-table fields returned by the following ProDataObjectMetaData method:
Syntax
int getFieldCount()
This value is also identical to the index in the corresponding ProDataObject property list that references the corresponding column property (see Using Java SDO classes to access Property meta data).
For more information on ProDataObjectMetaData methods, see ProDataObjectMetaData class.
4. To get the meta data for data-relations passed in the ProDataGraph:
a. Get the number of ProDataRelationMetaData objects in the ProDataGraph using the following ProDataGraphMetaData method:
Syntax
int getNumRelations()
b. Get each ProDataRelationMetaData object associated with the ProDataGraph using the following ProDataGraphMetaData method:
Syntax
ProDataRelationMetaData getRelationMetaData(int idx)
Where idx starts at 0 for the number of data-relations in the ProDataGraph.
c. Some useful data-relation information you can get from each ProDataRelationMetaData object for an output ProDataGraph is the specified data-relation name, parent table name, parent table index columns, child table name, and child table index columns. These are all specified according to a corresponding ProDataSet data-relation and accessible using the following ProDataRelationMetaData methods:
Syntax
String getRelationName()
String getParentTable()
int[] getParentColumns()
String getChildTable()
int[] getChildColumns()
For more information on ProDataGraphMetaData methods, see ProDataGraphMetaDataclass.