Search in sources :

Example 1 with GetDeletedResult

use of com.salesforce.soap.partner.GetDeletedResult in project tdi-studio-se by Talend.

the class PartnerSamples method getDeletedSample.

private void getDeletedSample() {
    // call the login function to do so
    if (!loggedIn) {
        if (!login()) {
            return;
        }
    }
    try {
        // Calendar deletedDate
        GregorianCalendar cal = (GregorianCalendar) binding.getServerTimestamp().getTimestamp();
        GregorianCalendar calEnd = (GregorianCalendar) cal.clone();
        cal.add(GregorianCalendar.MINUTE, -5);
        GetDeletedResult mr = binding.getDeleted("Contact", cal, calEnd);
        if (mr.getDeletedRecords() != null) {
            for (int i = 0; i < mr.getDeletedRecords().length; i++) {
                System.out.println(mr.getDeletedRecords(i).getId() + " was deleted on " + mr.getDeletedRecords(i).getDeletedDate().getTime().toString());
            }
        } else {
            System.out.println("No deletions from contacts in the last 5 minutes.");
        }
        getUserInput("\nHit return to continue...");
    } catch (ApiFault af) {
        System.out.println("\nFailed to get deleted records, error message was: \n" + af.getExceptionMessage());
        getUserInput("\nHit return to continue...");
    } catch (Exception ex) {
        System.out.println("\nFailed to get deleted records, error message was: \n" + ex.getMessage());
        getUserInput("\nHit return to continue...");
    }
}
Also used : ApiFault(com.salesforce.soap.partner.fault.ApiFault) GregorianCalendar(java.util.GregorianCalendar) GetDeletedResult(com.salesforce.soap.partner.GetDeletedResult) RemoteException(java.rmi.RemoteException) ServiceException(javax.xml.rpc.ServiceException) IOException(java.io.IOException)

Example 2 with GetDeletedResult

use of com.salesforce.soap.partner.GetDeletedResult in project tdi-studio-se by Talend.

the class SforceManagementImpl method getDeleted.

@Override
public GetDeletedResult getDeleted(String objectType, Calendar startDate, Calendar endDate) throws Exception {
    GetDeleted getDeleted = new GetDeleted();
    getDeleted.setSObjectType(objectType);
    getDeleted.setStartDate(startDate);
    getDeleted.setEndDate(endDate);
    GetDeletedResult result = sforceConn.getDeleted(getDeleted).getResult();
    // }
    return result;
}
Also used : GetDeletedResult(com.salesforce.soap.partner.GetDeletedResult) GetDeleted(com.salesforce.soap.partner.GetDeleted)

Aggregations

GetDeletedResult (com.salesforce.soap.partner.GetDeletedResult)2 GetDeleted (com.salesforce.soap.partner.GetDeleted)1 ApiFault (com.salesforce.soap.partner.fault.ApiFault)1 IOException (java.io.IOException)1 RemoteException (java.rmi.RemoteException)1 GregorianCalendar (java.util.GregorianCalendar)1 ServiceException (javax.xml.rpc.ServiceException)1