use of com.sforce.soap.partner.fault.InvalidFieldFault in project teiid by teiid.
the class SalesforceConnectionImpl method queryMore.
public QueryResult queryMore(String queryLocator, int batchSize) throws ResourceException {
if (batchSize > 2000) {
batchSize = 2000;
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_CONNECTOR, "reduced.batch.size");
}
partnerConnection.setQueryOptions(batchSize);
try {
return partnerConnection.queryMore(queryLocator);
} catch (InvalidFieldFault e) {
throw new ResourceException(e);
} catch (UnexpectedErrorFault e) {
throw new ResourceException(e);
} catch (InvalidQueryLocatorFault e) {
throw new ResourceException(e);
} catch (ConnectionException e) {
throw new ResourceException(e);
} finally {
partnerConnection.clearQueryOptions();
}
}
use of com.sforce.soap.partner.fault.InvalidFieldFault in project teiid by teiid.
the class SalesforceConnectionImpl method create.
public int create(DataPayload data) throws ResourceException {
SObject toCreate = new SObject();
toCreate.setType(data.getType());
for (DataPayload.Field field : data.getMessageElements()) {
toCreate.addField(field.name, field.value);
}
SObject[] objects = new SObject[] { toCreate };
SaveResult[] result;
try {
result = partnerConnection.create(objects);
} catch (InvalidFieldFault e) {
throw new ResourceException(e);
} catch (InvalidSObjectFault e) {
throw new ResourceException(e);
} catch (InvalidIdFault e) {
throw new ResourceException(e);
} catch (UnexpectedErrorFault e) {
throw new ResourceException(e);
} catch (ConnectionException e) {
throw new ResourceException(e);
}
return analyzeResult(result);
}
use of com.sforce.soap.partner.fault.InvalidFieldFault in project teiid by teiid.
the class SalesforceConnectionImpl method update.
public int update(List<DataPayload> updateDataList) throws ResourceException {
List<SObject> params = new ArrayList<SObject>(updateDataList.size());
for (int i = 0; i < updateDataList.size(); i++) {
DataPayload data = updateDataList.get(i);
SObject toCreate = new SObject();
toCreate.setType(data.getType());
toCreate.setId(data.getID());
for (DataPayload.Field field : data.getMessageElements()) {
toCreate.addField(field.name, field.value);
}
params.add(i, toCreate);
}
SaveResult[] result;
try {
result = partnerConnection.update(params.toArray(new SObject[params.size()]));
} catch (InvalidFieldFault e) {
throw new ResourceException(e);
} catch (InvalidSObjectFault e) {
throw new ResourceException(e);
} catch (InvalidIdFault e) {
throw new ResourceException(e);
} catch (UnexpectedErrorFault e) {
throw new ResourceException(e);
} catch (ConnectionException e) {
throw new ResourceException(e);
}
return analyzeResult(result);
}
use of com.sforce.soap.partner.fault.InvalidFieldFault in project teiid by teiid.
the class SalesforceConnectionImpl method upsert.
public int upsert(DataPayload data) throws ResourceException {
SObject toCreate = new SObject();
toCreate.setType(data.getType());
for (DataPayload.Field field : data.getMessageElements()) {
toCreate.addField(field.name, field.value);
}
SObject[] objects = new SObject[] { toCreate };
UpsertResult[] results;
try {
results = partnerConnection.upsert(ID_FIELD_NAME, objects);
} catch (InvalidFieldFault e) {
throw new ResourceException(e);
} catch (InvalidSObjectFault e) {
throw new ResourceException(e);
} catch (InvalidIdFault e) {
throw new ResourceException(e);
} catch (UnexpectedErrorFault e) {
throw new ResourceException(e);
} catch (ConnectionException e) {
throw new ResourceException(e);
}
for (UpsertResult result : results) {
if (!result.isSuccess()) {
throw new ResourceException(result.getErrors()[0].getMessage());
}
}
return results.length;
}
use of com.sforce.soap.partner.fault.InvalidFieldFault in project teiid by teiid.
the class SalesforceConnectionImpl method query.
public QueryResult query(String queryString, int batchSize, boolean queryAll) throws ResourceException {
if (batchSize > 2000) {
batchSize = 2000;
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_CONNECTOR, "reduced.batch.size");
}
QueryResult qr = null;
partnerConnection.setQueryOptions(batchSize);
try {
if (queryAll) {
qr = partnerConnection.queryAll(queryString);
} else {
partnerConnection.setMruHeader(false);
qr = partnerConnection.query(queryString);
}
} catch (InvalidFieldFault e) {
throw new ResourceException(e);
} catch (MalformedQueryFault e) {
throw new ResourceException(e);
} catch (InvalidSObjectFault e) {
throw new ResourceException(e);
} catch (InvalidIdFault e) {
throw new ResourceException(e);
} catch (UnexpectedErrorFault e) {
throw new ResourceException(e);
} catch (InvalidQueryLocatorFault e) {
throw new ResourceException(e);
} catch (ConnectionException e) {
throw new ResourceException(e);
} finally {
partnerConnection.clearMruHeader();
partnerConnection.clearQueryOptions();
}
return qr;
}
Aggregations