Class DefaultRestClient
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.component.salesforce.internal.client.AbstractClientBase
org.apache.camel.component.salesforce.internal.client.DefaultRestClient
- All Implemented Interfaces:
AutoCloseable
,HttpClientHolder
,RestClient
,SalesforceSession.SalesforceSessionListener
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.camel.component.salesforce.internal.client.AbstractClientBase
AbstractClientBase.ClientResponseCallback
Nested classes/interfaces inherited from interface org.apache.camel.component.salesforce.internal.client.RestClient
RestClient.ResponseCallback
-
Field Summary
Fields inherited from class org.apache.camel.component.salesforce.internal.client.AbstractClientBase
accessToken, APPLICATION_JSON_UTF8, APPLICATION_XML_UTF8, httpClient, instanceUrl, log, loginConfig, session, version
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
ConstructorDescriptionDefaultRestClient
(SalesforceHttpClient httpClient, String version, SalesforceSession session, SalesforceLoginConfig loginConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoid
apexCall
(String httpMethod, String apexUrl, Map<String, Object> queryParams, InputStream requestDto, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Executes a user defined APEX REST API call.void
approval
(InputStream request, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Submits, approves or rejects particular record.void
Returns a list of all approval processes.void
createSObject
(String sObjectName, InputStream sObject, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Creates a record for the specified object.void
deleteSObject
(String sObjectName, String id, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Deletes a record for the specified object ID.void
deleteSObjectWithId
(String sObjectName, String fieldName, String fieldValue, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Deletes a record based on the value of a specified external ID field.protected void
doHttpRequest
(org.eclipse.jetty.client.api.Request request, AbstractClientBase.ClientResponseCallback callback) void
getBasicInfo
(String sObjectName, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Describes the individual metadata for the specified object.void
getBlobField
(String sObjectName, String id, String blobFieldName, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Retrieves the specified blob field from an individual record.void
getDescription
(String sObjectName, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Completely describes the individual metadata at all levels for the specified object.void
getGlobalObjects
(Map<String, List<String>> headers, RestClient.ResponseCallback callback) Lists the available objects and their metadata for your organization's data.void
getResources
(Map<String, List<String>> headers, RestClient.ResponseCallback callback) Lists available resources for the specified API version, including resource name and URI.void
getSObject
(String sObjectName, String id, String[] fields, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Retrieves a record for the specified object ID.void
getSObjectWithId
(String sObjectName, String fieldName, String fieldValue, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Retrieves a record for the specified external ID.void
getVersions
(Map<String, List<String>> headers, RestClient.ResponseCallback callback) Lists summary information about each API version currently available, including the version, label, and a link to each version's root.void
Fetches Organization Limits.void
Executes the specified SOQL query.void
Executes the specified SOQL query including deleted records.void
queryMore
(String nextRecordsUrl, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Get SOQL query results using nextRecordsUrl.void
recent
(Integer limit, Map<String, List<String>> headers, RestClient.ResponseCallback responseCallback) Fetches recently viewed records.void
Executes the specified SOSL search.protected void
setAccessToken
(org.eclipse.jetty.client.api.Request request) void
updateSObject
(String sObjectName, String id, InputStream sObject, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Updates a record for the specified object ID.void
upsertSObject
(String sObjectName, String fieldName, String fieldValue, Map<String, List<String>> headers, InputStream sObject, RestClient.ResponseCallback callback) Creates or updates a record based on the value of a specified external ID field.Methods inherited from class org.apache.camel.component.salesforce.internal.client.AbstractClientBase
createRestException, doStart, doStop, getHttpClient, getRequest, getRequest, onLogin, onLogout, setAccessToken, setInstanceUrl
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
DefaultRestClient
public DefaultRestClient(SalesforceHttpClient httpClient, String version, SalesforceSession session, SalesforceLoginConfig loginConfig) throws SalesforceException - Throws:
SalesforceException
-
-
Method Details
-
doHttpRequest
protected void doHttpRequest(org.eclipse.jetty.client.api.Request request, AbstractClientBase.ClientResponseCallback callback) - Overrides:
doHttpRequest
in classAbstractClientBase
-
approval
public void approval(InputStream request, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Submits, approves or rejects particular record.- Specified by:
approval
in interfaceRestClient
headers
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
approvals
Description copied from interface:RestClient
Returns a list of all approval processes.- Specified by:
approvals
in interfaceRestClient
- Parameters:
headers
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getVersions
Description copied from interface:RestClient
Lists summary information about each API version currently available, including the version, label, and a link to each version's root.- Specified by:
getVersions
in interfaceRestClient
- Parameters:
headers
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getResources
Description copied from interface:RestClient
Lists available resources for the specified API version, including resource name and URI.- Specified by:
getResources
in interfaceRestClient
- Parameters:
headers
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getGlobalObjects
public void getGlobalObjects(Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Lists the available objects and their metadata for your organization's data.- Specified by:
getGlobalObjects
in interfaceRestClient
- Parameters:
headers
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getBasicInfo
public void getBasicInfo(String sObjectName, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Describes the individual metadata for the specified object.- Specified by:
getBasicInfo
in interfaceRestClient
- Parameters:
sObjectName
- specified object nameheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getDescription
public void getDescription(String sObjectName, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Completely describes the individual metadata at all levels for the specified object.- Specified by:
getDescription
in interfaceRestClient
- Parameters:
sObjectName
- specified object nameheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getSObject
public void getSObject(String sObjectName, String id, String[] fields, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Retrieves a record for the specified object ID.- Specified by:
getSObject
in interfaceRestClient
- Parameters:
sObjectName
- specified object nameid
- object idheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
createSObject
public void createSObject(String sObjectName, InputStream sObject, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Creates a record for the specified object.- Specified by:
createSObject
in interfaceRestClient
- Parameters:
sObjectName
- specified object namesObject
- request entityheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
updateSObject
public void updateSObject(String sObjectName, String id, InputStream sObject, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Updates a record for the specified object ID.- Specified by:
updateSObject
in interfaceRestClient
- Parameters:
sObjectName
- specified object nameid
- object idsObject
- request entityheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
deleteSObject
public void deleteSObject(String sObjectName, String id, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Deletes a record for the specified object ID.- Specified by:
deleteSObject
in interfaceRestClient
- Parameters:
sObjectName
- specified object nameid
- object idheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getSObjectWithId
public void getSObjectWithId(String sObjectName, String fieldName, String fieldValue, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Retrieves a record for the specified external ID.- Specified by:
getSObjectWithId
in interfaceRestClient
- Parameters:
sObjectName
- specified object namefieldName
- external field namefieldValue
- external field valueheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
upsertSObject
public void upsertSObject(String sObjectName, String fieldName, String fieldValue, Map<String, List<String>> headers, InputStream sObject, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Creates or updates a record based on the value of a specified external ID field.- Specified by:
upsertSObject
in interfaceRestClient
- Parameters:
sObjectName
- specified object namefieldName
- external field namefieldValue
- external field valueheaders
- additional HTTP headers to sendsObject
- input object to insert or updatecallback
-RestClient.ResponseCallback
to handle response or exception
-
deleteSObjectWithId
public void deleteSObjectWithId(String sObjectName, String fieldName, String fieldValue, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Deletes a record based on the value of a specified external ID field.- Specified by:
deleteSObjectWithId
in interfaceRestClient
- Parameters:
sObjectName
- specified object namefieldName
- external field namefieldValue
- external field valueheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
getBlobField
public void getBlobField(String sObjectName, String id, String blobFieldName, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Retrieves the specified blob field from an individual record.- Specified by:
getBlobField
in interfaceRestClient
- Parameters:
sObjectName
- specified object nameid
- identifier of the objectblobFieldName
- name of the field holding the blobheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
query
public void query(String soqlQuery, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Executes the specified SOQL query.- Specified by:
query
in interfaceRestClient
- Parameters:
soqlQuery
- SOQL queryheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
queryMore
public void queryMore(String nextRecordsUrl, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Get SOQL query results using nextRecordsUrl.- Specified by:
queryMore
in interfaceRestClient
- Parameters:
nextRecordsUrl
- URL for next records to fetch, returned by query()headers
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
queryAll
public void queryAll(String soqlQuery, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Executes the specified SOQL query including deleted records.- Specified by:
queryAll
in interfaceRestClient
- Parameters:
soqlQuery
- SOQL queryheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
search
public void search(String soslQuery, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Executes the specified SOSL search.- Specified by:
search
in interfaceRestClient
- Parameters:
soslQuery
- SOSL queryheaders
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
apexCall
public void apexCall(String httpMethod, String apexUrl, Map<String, Object> queryParams, InputStream requestDto, Map<String, List<String>> headers, RestClient.ResponseCallback callback) Description copied from interface:RestClient
Executes a user defined APEX REST API call.- Specified by:
apexCall
in interfaceRestClient
- Parameters:
httpMethod
- HTTP method to execute.apexUrl
- APEX api url.queryParams
- optional query parameters for GET methods, may be empty.requestDto
- optional input DTO for POST, etc. may be null.headers
- additional HTTP headers to sendcallback
-RestClient.ResponseCallback
to handle response or exception
-
recent
public void recent(Integer limit, Map<String, List<String>> headers, RestClient.ResponseCallback responseCallback) Description copied from interface:RestClient
Fetches recently viewed records.- Specified by:
recent
in interfaceRestClient
- Parameters:
limit
- optional limit that specifies the maximum number of records to be returned. If this parameter is not specified, the default maximum number of records returned is the maximum number of entries in RecentlyViewed, which is 200 records per object.headers
- additional HTTP headers to sendresponseCallback
-RestClient.ResponseCallback
to handle response or exception
-
limits
Description copied from interface:RestClient
Fetches Organization Limits.- Specified by:
limits
in interfaceRestClient
- Parameters:
headers
- additional HTTP headers to sendresponseCallback
-RestClient.ResponseCallback
to handle response or exception
-
setAccessToken
protected void setAccessToken(org.eclipse.jetty.client.api.Request request) - Specified by:
setAccessToken
in classAbstractClientBase
-