SearchControls controls = new SearchControls();
int n = parameters.length;
for(int i=0; i<n; i++) {
Any property = parameters[i];
if (property.isMap()) {
AnyMap map = property.toMap();
String key = map.getLeft().toString();
if (key.equalsIgnoreCase("scope")) {
controls.setSearchScope(map.getRight().toInt());
} else if (key.equalsIgnoreCase("countlimit")) {
controls.setCountLimit(map.getRight().toInt());
} else if (key.equalsIgnoreCase("timelimit")) {
controls.setTimeLimit(map.getRight().toInt());
} else if (key.equalsIgnoreCase("attributes")) {
Any right = map.getRight();
if (right.isNull()) {
controls.setReturningAttributes(null);
} else {
String[] attributes = AnyUtils.toStringArray(right);
controls.setReturningAttributes(attributes);
}
} else if (key.equalsIgnoreCase("returnobject")) {
controls.setReturningObjFlag(map.getRight().toBoolean());
} else if (key.equalsIgnoreCase("dereflinks")) {
controls.setDerefLinkFlag(map.getRight().toBoolean());
} else {
throw context.BadParameter("Invalid attribute: '"+key+"'");
}
} else if (property.isString()) {