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 a ProDataGraph with a known schema
 
Accessing a ProDataGraph with a known schema
If you already know the schema of the ProDataSet, you can use this information to access the data in the ProDataGraph. If you do not know the schema, see Accessing the ProDataGraph meta data for an unknown schema.
To access the data in a ProDataGraph:
1. Return the ProDataObject list from the ProDataGraph that maps to a specified temp-table using the following ProDataGraph method, where tableName is the ABL name of the temp-table:
java.util.List getProDataObjects(String tableName)
2. Iterate through the ProDataObject list returned in Step 1 and locate a ProDataObject instance that contains data that you want.
3. Use the appropriate ProDataObject property access methods to return the values of specified column properties of the ProDataObject found in Step 2, where propertyIndex is the index into the ProDataObject column property list, and name is the ABL name of the temp-table field that the property maps to.
Note: For more information on determining the propertyIndex of a column property and other information about column properties of a ProDataObject, see the Using Java SDO classes to access Property meta data.
*To return the value of a specified single-valued column property in the form of the Property data type, use one of the following ProDataObject methods:
DataType getDataTypeName(int propertyIndex)
DataType getDataTypeName(String name)
Where DataType is the full Java classname or intrinsic type name of the property data type and DataTypeName is a name that closely matches the name of the data type that the method returns:
To identify the Java intrinsic data type or class of the column property that maps to the ABL data type of the temp-table field, see Mappingsingle-valued fields. For example, the following two methods return values for an int property (mapped to an INTEGER field) and a BigDecimal property (mapped to a DECIMAL field):
int getInt(String name)
java.math.BigDecimal getBigDecimal(String name)
*To return the value of a specified many-valued property (which maps to a temp-table array field), use one of the following ProDataObject methods:
java.util.List getList(int propertyIndex)
java.util.List getList(String name)
The objects in the List all have the data type of the column Property.
You can check that a column Property is many-valued, and therefore returns a List, by testing the value returned by its isMany() method.
*To return the value of a specified column property in the form of the java.lang.Object class, use one of the following ProDataObject methods:
java.lang.Object get(int propertyIndex)
java.lang.Object get(String name)
The returned Object has the data type of the specified column property, including java.util.List if the property is many-valued.
4. If you need to access parent or child relations of the ProDataObject that you access in Step 3, you can use the following methods:
*To return a list of child rows for the specified ProDataObject, use the following ProDataObject method:
java.util.List getChildRows(java.lang.String relationName)
The method returns a list of child rows (ProDataObject instances) for this parent ProDataObject according to the data-relation specified by name (relationName). Iterate through the list to locate a ProDataObject that you want to access.
*To return a parent row for the specified ProDataObject, use the following ProDataObject method:
ProDataObject getParentRow(java.lang.String relationName)
The method returns a parent ProDataObject for this child ProDataObject according to the data-relation specified by name (relationName).
For a ProDataGraph, the relationName identifies a DATA-RELATION defined in the corresponding ProDataSet parameter of the application service, and this name is identical to the ABL name of the specified DATA-RELATION.
Once you have a child or parent ProDataObject, you can continue with Step 3 to access its data.
For more information on ProDataObject methods, see ProDataObject class.