/* override */
public Object invoke(final Object thiz, final Object[] args) throws Exception {
CallLogObject[] logsFound = new CallLogObject[0];
TestableScriptableObject testable = null;
int folderID = CallLogNamespace.FOLDER_MISSED_CALLS;
String orderByField = "";
int maxReturn = -1;
boolean isAscending = true;
if (!FindNamespace.isValidFindArguments(args)) {
return logsFound;
}
if (args.length > INDEX_TESTABLE) {
testable = (TestableScriptableObject) args[INDEX_TESTABLE];
}
if (args.length > INDEX_FOLDER_ID) {
if (args[INDEX_FOLDER_ID] != null) {
final Integer i = (Integer) args[INDEX_FOLDER_ID];
folderID = i.intValue();
}
}
if (args.length > INDEX_ORDER_BY) {
if (args[INDEX_ORDER_BY] != null) {
orderByField = (String) args[INDEX_ORDER_BY];
}
}
if (args.length > INDEX_MAX_RETURN) {
if (args[INDEX_MAX_RETURN] != null) {
final Integer i = (Integer) args[INDEX_MAX_RETURN];
maxReturn = i.intValue();
}
}
if (args.length > INDEX_IS_ASCENDING) {
if (args[INDEX_IS_ASCENDING] != null) {
final Boolean b = (Boolean) args[INDEX_IS_ASCENDING];
isAscending = b.booleanValue();
}
}
final boolean isSorted = orderByField != null && orderByField.length() > 0 ? true : false;
final int numberOfCalls = CallLogNamespace.numberOfLogsInFolder(folderID);
final Vector found = new Vector();
int iElement = 0;
for (int i = 0; i < numberOfCalls; i++) {
final CallLog l = CallLogNamespace.callLogAt(i, folderID);
final CallLogObject log = new CallLogObject(l);
if (testable != null) {
if (testable.test(log)) {
FindNamespace.insertElementByOrder(found, log, orderByField, isAscending);
iElement++;
}
}
else {