use of com.salesforce.soap.partner.fault.InvalidQueryLocatorFault in project tdi-studio-se by Talend.
the class PartnerSamples method loadQueryResults.
private ArrayList loadQueryResults(QueryResult qr) {
ArrayList returnVal = new ArrayList();
if (qr.getSize() > 0) {
boolean keepLooping = true;
while (keepLooping) {
for (int i = 0; i < qr.getRecords().length; i++) {
MessageElement[] records = qr.getRecords(i).get_any();
HashMap fields = new HashMap();
if (qr.getRecords(i).getId() != null)
fields.put("id", qr.getRecords(i).getId());
for (int j = 0; j < records.length; j++) {
MessageElement record = records[j];
if (!fields.containsKey(record.getName()))
fields.put(record.getName().toLowerCase(), record);
}
returnVal.add(fields);
}
if (qr.isDone())
keepLooping = false;
else
try {
qr = binding.queryMore(qr.getQueryLocator());
} catch (InvalidQueryLocatorFault e) {
System.out.println("\nFailed to query, error message was: \n" + e.getExceptionMessage());
getUserInput("\nHit return to continue...");
} catch (ApiFault af) {
System.out.println("\nFailed to query, error message was: \n" + af.getExceptionMessage());
getUserInput("\nHit return to continue...");
} catch (RemoteException e) {
e.printStackTrace();
getUserInput("\nHit return to continue...");
}
}
}
return returnVal;
}
Aggregations