The First Screen of the Object DataSource Wizard appears as shown in Figure 10.1, “Object DataSource Wizard” In this screen, the Object DataSource name and schema have to be defined.
The Name of the data source must be unique. Any extra description that is used to describe the data source can be entered in the Description text box.
On this page you can define the data class schema by entering the schema and JavaScript manually.
Click Add Column to enter the Data class field name
and select the
corresponding data type from the combo box in the Add Column
dialog.
Click OK to add the column to the Schema Definition table.
In the next screen as shown in Figure 10.2, “JavaScript Editor”, you
can manually enter the JavaScript code to access
the fields in the data source.
The JavaScript entered here must conform to the following pattern:
function pushTo(cxt,dl) { dl.startData(this); importClass(Packages.com.dummy.test.Company); var dIter = Company.getEmployeesAsList(); dIter = dIter.iterator(); while (dIter.hasNext()) { rec = this.newRecordInstance(); data = rec.getData(); dataObj = dIter.next(); data[0] = dataObj.getDeparment(); data[1] = dataObj.getDateJoined(); data[2] = dataObj.getDesignation(); data[3] = dataObj.getName(); data[4] = dataObj.getID(); data[5] = dataObj.getClass(); data[6] = dataObj.hashCode(); data[7] = dataObj.toString(); dl.processRecord(rec); } dl.endData(this); }
Click Finish to add the Object Data Source to the repository.