Try OpenEdge Now
skip to main content
Java Open Clients
Accessing ABL ProDataSets : Preparing and passing ProDataSets as ProDataGraph parameters : Passing a ProDataGraph as INPUT or INPUT-OUTPUT : Adding data to a ProDataGraph
Adding data to a ProDataGraph
Once you have the ProDataGraph defined with its meta data, you can create and add the rows to the various tables (ProDataObject lists) and generate all the data-relation references between them to complete the ProDataGraph. You can add data to a ProDataGraph in different ways. The following procedure assumes that you know the ABL names of the temp-tables and fields and the field data types in the corresponding ProDataSet.
To add data to a ProDataGraph:
1. For each row you want to add to a temp-table, create a ProDataObject using the following ProDataGraph factory method:
ProDataObject createProDataObject(String tableName)
Where tableName is the temp-table name.
2. For each ProDataObject that you create, add the column property data using one of the following ProDataObject methods, where name is the ABL name for the corresponding temp-table field:
*To set the value of a single-valued property, use the following method:
void setDataTypeName(String name, DataType)
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 data type name for the value.
*To identify the Java data type or class of the column property that maps to the ABL data type of the temp-table field, see Mapping single-valued fields. For example, the following two methods set values for an int property (mapped to an INTEGER field) and a BigDecimal property (mapped to a DECIMAL field):
void setInt(String name, int)
void setBigDecimal(String name, java.math.BigDecimal)
*To set the value of a many-valued property (which maps to a temp-table array field), use the following method, after loading the java.util.List object with the required values:
void setList(String name, java.util.List)
The values in the List all have the data type of the column property.
*To set the value of a column property in the form of the java.lang.Object class, use the following method:
void set(String name, java.lang.Object)
The value in the Object has the data type of the column property or java.util.List if the property is many-valued.
You can also set the values of column properties with overloaded versions of these methods that index into the ProDataObject property list. For more information on determining the index of a column property and other information about column properties of a ProDataObject, see Using Java SDO classes to access Property meta data.
3. Add each ProDataObject, dataObj, filled with data in Step 2 to the ProDataGraph using the following ProDataGraph method:
void addProDataObject(ProDataObject dataObj)
void addProDataObject(int index, ProDataObject dataObj)
This method adds the ProDataObject to the collection (ProDataObject list) identified by its defined table name. Using an index, you can insert the ProDataObject at a location in the list. Otherwise, the object is added to the end of the list.
4. Once all the tables (ProDataObject lists) have been populated with rows of data in Step 3, generate the parent-child ProDataObject references specified by all the ProDataRelationMetaData objects contained in the ProDataGraph using the following ProDataGraph method:
void setChildTableReferences()
You can also generate these references one table at a time using overloads of this method. However, this is the most efficient method to generate data-relation references for a fully populated ProDataGraph.
For more information on methods for building ProDataGraphs, see ProDataGraph class.