Search in sources :

Example 1 with GetUpdatedResult

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

the class PartnerSamples method getUpdatedSample.

private void getUpdatedSample() {
    // 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);
        GetUpdatedResult mr = binding.getUpdated("Account", cal, calEnd);
        if (mr.getIds() != null && mr.getIds().length > 0) {
            for (int i = 0; i < mr.getIds().length; i++) {
                System.out.println(mr.getIds(i) + " was updated.");
            }
        } else {
            System.out.println("No updates to accounts in the last 5 minutes.");
        }
        getUserInput("\nHit return to continue...");
    } catch (ApiFault af) {
        System.out.println("\nFailed to get updated records, error message was: \n" + af.getExceptionMessage());
        getUserInput("\nHit return to continue...");
    } catch (Exception ex) {
        System.out.println("\nFailed to get updated records, error message was: \n" + ex.getMessage());
        getUserInput("\nHit return to continue...");
    }
}
Also used : GetUpdatedResult(com.salesforce.soap.partner.GetUpdatedResult) ApiFault(com.salesforce.soap.partner.fault.ApiFault) GregorianCalendar(java.util.GregorianCalendar) RemoteException(java.rmi.RemoteException) ServiceException(javax.xml.rpc.ServiceException) IOException(java.io.IOException)

Example 2 with GetUpdatedResult

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

the class SforceManagementImpl method getUpdated.

@Override
public ID[] getUpdated(String objectType, Calendar startDate, Calendar endDate) throws Exception {
    GetUpdated getUpdated = new GetUpdated();
    getUpdated.setSObjectType(objectType);
    getUpdated.setStartDate(startDate);
    getUpdated.setEndDate(endDate);
    GetUpdatedResult result = sforceConn.getUpdated(getUpdated).getResult();
    ID[] ids = result.getIds();
    return ids;
}
Also used : GetUpdated(com.salesforce.soap.partner.GetUpdated) GetUpdatedResult(com.salesforce.soap.partner.GetUpdatedResult) ID(com.salesforce.soap.partner.ID)

Aggregations

GetUpdatedResult (com.salesforce.soap.partner.GetUpdatedResult)2 GetUpdated (com.salesforce.soap.partner.GetUpdated)1 ID (com.salesforce.soap.partner.ID)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