Search in sources :

Example 1 with DeletedObject

use of org.teiid.translator.salesforce.execution.DeletedObject in project teiid by teiid.

the class SalesforceConnectionImpl method getDeleted.

public DeletedResult getDeleted(String objectName, Calendar startCalendar, Calendar endCalendar) throws ResourceException {
    GetDeletedResult deleted;
    try {
        deleted = partnerConnection.getDeleted(objectName, startCalendar, endCalendar);
    } catch (InvalidSObjectFault e) {
        throw new ResourceException(e);
    } catch (UnexpectedErrorFault e) {
        throw new ResourceException(e);
    } catch (ConnectionException e) {
        throw new ResourceException(e);
    }
    DeletedResult result = new DeletedResult();
    result.setLatestDateCovered(deleted.getLatestDateCovered());
    result.setEarliestDateAvailable(deleted.getEarliestDateAvailable());
    DeletedRecord[] records = deleted.getDeletedRecords();
    List<DeletedObject> resultRecords = new ArrayList<DeletedObject>();
    if (records != null) {
        for (DeletedRecord record : records) {
            DeletedObject object = new DeletedObject();
            object.setID(record.getId());
            object.setDeletedDate(record.getDeletedDate());
            resultRecords.add(object);
        }
    }
    result.setResultRecords(resultRecords);
    return result;
}
Also used : InvalidSObjectFault(com.sforce.soap.partner.fault.InvalidSObjectFault) DeletedResult(org.teiid.translator.salesforce.execution.DeletedResult) ArrayList(java.util.ArrayList) ResourceException(javax.resource.ResourceException) UnexpectedErrorFault(com.sforce.soap.partner.fault.UnexpectedErrorFault) ConnectionException(com.sforce.ws.ConnectionException) DeletedObject(org.teiid.translator.salesforce.execution.DeletedObject)

Aggregations

InvalidSObjectFault (com.sforce.soap.partner.fault.InvalidSObjectFault)1 UnexpectedErrorFault (com.sforce.soap.partner.fault.UnexpectedErrorFault)1 ConnectionException (com.sforce.ws.ConnectionException)1 ArrayList (java.util.ArrayList)1 ResourceException (javax.resource.ResourceException)1 DeletedObject (org.teiid.translator.salesforce.execution.DeletedObject)1 DeletedResult (org.teiid.translator.salesforce.execution.DeletedResult)1