Use the
ENEQuery.setSelection() method for Java implementations.
For Java-based implementations, you specify the selection list by
calling the
setSelection() method of the
ENEQuery object. Use the following syntax:
ENEQuery.setSelection(FieldList selectFields)
where
selectFields is a list of property or dimension
names that should be returned with each record. You can populate the
FieldList object with string names (such as
"P_WineType") or with Property or Dimension objects. In the case of objects,
the
FieldList.addField() method automatically extracts
the string name from the object and adds it to the
FieldList object.
During development, you can use the
ENEQuery.getSelection() method (which returns a
FieldList object) to check which fields are set.
The
FieldList object contains a list of Oracle Commerce property
and/or dimension names for the query. For details about the methods of the
FieldList class, see the Oracle Commerce Javadocs for the
Presentation API.
Note
The
setSelection() and
getSelection() methods are also available in the
UrlENEQuery class.
Example 26. Java Select example
The following is a simple Java example of setting an Oracle Commerce property
and dimension for a navigation query. When the
ENEQueryResults object is returned, it will have a
list of records that have been tagged with the P_WineType property and the
Designation dimension. You extract the records as with any record query.
// Create a query
ENEQuery usq = new UrlENEQuery(request.getQueryString(),"UTF-8");
// Create an empty selection list
FieldList fList = new FieldList();
// Add an Oracle Commerce property to the list
fList.addField("P_WineType");
// Add an Oracle Commerce dimension to the list
fList.addField("Designation");
// Add the selection list to the query
usq.setSelection(fList);
// Make the MDEX Engine query
ENEQueryResults qr = nec.query(usq);

