/** Perform a query and return a result set. */
public static ResultSet get(DataRepository data, String forParam,
String[] conditions, String orderBy,
String[] dataNames, String basePrefix) {
// get the list of prefixes
ListData prefixList = getFilteredList(data, forParam, conditions,
orderBy, basePrefix);
// Create a result set to return
ResultSet result = new ResultSet(prefixList.size(), dataNames.length);
// write the column headers into the result set.
result.setColName(0, null);
for (int i=0; i < dataNames.length; i++)
result.setColName(i+1, dataNames[i]);
// get the data and fill the result set.
String prefix, dataName;
if (basePrefix == null) basePrefix = "";
int baseLen = basePrefix.length();
if (baseLen > 0) baseLen++; // remove / as well
for (int p=0; p < prefixList.size(); p++) {
// get the next prefix
Object pfx = prefixList.get(p);
if (pfx instanceof String)
prefix = (String) pfx;
else if (pfx instanceof SimpleData)
prefix = ((SimpleData) pfx).format();
else