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
public class DefaultRestClient extends AbstractClientBase implements RestClient
-
-
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
-
-
Constructor Summary
Constructors Constructor Description DefaultRestClient(SalesforceHttpClient httpClient, String version, SalesforceSession session, SalesforceLoginConfig loginConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapexCall(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.voidapproval(InputStream request, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Submits, approves or rejects particular record.voidapprovals(Map<String,List<String>> headers, RestClient.ResponseCallback callback)Returns a list of all approval processes.protected SalesforceExceptioncreateRestException(org.eclipse.jetty.client.api.Response response, InputStream responseContent)voidcreateSObject(String sObjectName, InputStream sObject, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Creates a record for the specified object.voiddeleteSObject(String sObjectName, String id, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Deletes a record for the specified object ID.voiddeleteSObjectWithId(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 voiddoHttpRequest(org.eclipse.jetty.client.api.Request request, AbstractClientBase.ClientResponseCallback callback)voidgetBasicInfo(String sObjectName, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Describes the individual metadata for the specified object.voidgetBlobField(String sObjectName, String id, String blobFieldName, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Retrieves the specified blob field from an individual record.voidgetDescription(String sObjectName, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Completely describes the individual metadata at all levels for the specified object.voidgetGlobalObjects(Map<String,List<String>> headers, RestClient.ResponseCallback callback)Lists the available objects and their metadata for your organization's data.voidgetResources(Map<String,List<String>> headers, RestClient.ResponseCallback callback)Lists available resources for the specified API version, including resource name and URI.voidgetSObject(String sObjectName, String id, String[] fields, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Retrieves a record for the specified object ID.voidgetSObjectWithId(String sObjectName, String fieldName, String fieldValue, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Retrieves a record for the specified external ID.voidgetVersions(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.voidlimits(Map<String,List<String>> headers, RestClient.ResponseCallback responseCallback)Fetches Organization Limits.voidquery(String soqlQuery, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Executes the specified SOQL query.voidqueryAll(String soqlQuery, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Executes the specified SOQL query including deleted records.voidqueryMore(String nextRecordsUrl, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Get SOQL query results using nextRecordsUrl.voidrecent(Integer limit, Map<String,List<String>> headers, RestClient.ResponseCallback responseCallback)Fetches recently viewed records.voidsearch(String soslQuery, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Executes the specified SOSL search.protected voidsetAccessToken(org.eclipse.jetty.client.api.Request request)voidupdateSObject(String sObjectName, String id, InputStream sObject, Map<String,List<String>> headers, RestClient.ResponseCallback callback)Updates a record for the specified object ID.voidupsertSObject(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
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
-
-
-
-
Constructor Detail
-
DefaultRestClient
public DefaultRestClient(SalesforceHttpClient httpClient, String version, SalesforceSession session, SalesforceLoginConfig loginConfig) throws SalesforceException
- Throws:
SalesforceException
-
-
Method Detail
-
doHttpRequest
protected void doHttpRequest(org.eclipse.jetty.client.api.Request request, AbstractClientBase.ClientResponseCallback callback)- Overrides:
doHttpRequestin classAbstractClientBase
-
createRestException
protected SalesforceException createRestException(org.eclipse.jetty.client.api.Response response, InputStream responseContent)
- Specified by:
createRestExceptionin classAbstractClientBase
-
approval
public void approval(InputStream request, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientSubmits, approves or rejects particular record.- Specified by:
approvalin interfaceRestClientheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
approvals
public void approvals(Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientReturns a list of all approval processes.- Specified by:
approvalsin interfaceRestClient- Parameters:
headers- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
getVersions
public void getVersions(Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientLists summary information about each API version currently available, including the version, label, and a link to each version's root.- Specified by:
getVersionsin interfaceRestClient- Parameters:
headers- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
getResources
public void getResources(Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientLists available resources for the specified API version, including resource name and URI.- Specified by:
getResourcesin interfaceRestClient- Parameters:
headers- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
getGlobalObjects
public void getGlobalObjects(Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientLists the available objects and their metadata for your organization's data.- Specified by:
getGlobalObjectsin interfaceRestClient- Parameters:
headers- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
getBasicInfo
public void getBasicInfo(String sObjectName, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientDescribes the individual metadata for the specified object.- Specified by:
getBasicInfoin interfaceRestClient- Parameters:
sObjectName- specified object nameheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
getDescription
public void getDescription(String sObjectName, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientCompletely describes the individual metadata at all levels for the specified object.- Specified by:
getDescriptionin interfaceRestClient- Parameters:
sObjectName- specified object nameheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto 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:RestClientRetrieves a record for the specified object ID.- Specified by:
getSObjectin interfaceRestClient- Parameters:
sObjectName- specified object nameid- object idheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
createSObject
public void createSObject(String sObjectName, InputStream sObject, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientCreates a record for the specified object.- Specified by:
createSObjectin interfaceRestClient- Parameters:
sObjectName- specified object namesObject- request entityheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto 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:RestClientUpdates a record for the specified object ID.- Specified by:
updateSObjectin interfaceRestClient- Parameters:
sObjectName- specified object nameid- object idsObject- request entityheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
deleteSObject
public void deleteSObject(String sObjectName, String id, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientDeletes a record for the specified object ID.- Specified by:
deleteSObjectin interfaceRestClient- Parameters:
sObjectName- specified object nameid- object idheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto 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:RestClientRetrieves a record for the specified external ID.- Specified by:
getSObjectWithIdin interfaceRestClient- Parameters:
sObjectName- specified object namefieldName- external field namefieldValue- external field valueheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto 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:RestClientCreates or updates a record based on the value of a specified external ID field.- Specified by:
upsertSObjectin interfaceRestClient- Parameters:
sObjectName- specified object namefieldName- external field namefieldValue- external field valueheaders- additional HTTP headers to sendsObject- input object to insert or updatecallback-RestClient.ResponseCallbackto 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:RestClientDeletes a record based on the value of a specified external ID field.- Specified by:
deleteSObjectWithIdin interfaceRestClient- Parameters:
sObjectName- specified object namefieldName- external field namefieldValue- external field valueheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto 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:RestClientRetrieves the specified blob field from an individual record.- Specified by:
getBlobFieldin interfaceRestClient- Parameters:
sObjectName- specified object nameid- identifier of the objectblobFieldName- name of the field holding the blobheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
query
public void query(String soqlQuery, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientExecutes the specified SOQL query.- Specified by:
queryin interfaceRestClient- Parameters:
soqlQuery- SOQL queryheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
queryMore
public void queryMore(String nextRecordsUrl, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientGet SOQL query results using nextRecordsUrl.- Specified by:
queryMorein interfaceRestClient- Parameters:
nextRecordsUrl- URL for next records to fetch, returned by query()headers- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
queryAll
public void queryAll(String soqlQuery, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientExecutes the specified SOQL query including deleted records.- Specified by:
queryAllin interfaceRestClient- Parameters:
soqlQuery- SOQL queryheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto handle response or exception
-
search
public void search(String soslQuery, Map<String,List<String>> headers, RestClient.ResponseCallback callback)
Description copied from interface:RestClientExecutes the specified SOSL search.- Specified by:
searchin interfaceRestClient- Parameters:
soslQuery- SOSL queryheaders- additional HTTP headers to sendcallback-RestClient.ResponseCallbackto 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:RestClientExecutes a user defined APEX REST API call.- Specified by:
apexCallin 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.ResponseCallbackto handle response or exception
-
recent
public void recent(Integer limit, Map<String,List<String>> headers, RestClient.ResponseCallback responseCallback)
Description copied from interface:RestClientFetches recently viewed records.- Specified by:
recentin 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.ResponseCallbackto handle response or exception
-
limits
public void limits(Map<String,List<String>> headers, RestClient.ResponseCallback responseCallback)
Description copied from interface:RestClientFetches Organization Limits.- Specified by:
limitsin interfaceRestClient- Parameters:
headers- additional HTTP headers to sendresponseCallback-RestClient.ResponseCallbackto handle response or exception
-
setAccessToken
protected void setAccessToken(org.eclipse.jetty.client.api.Request request)
- Specified by:
setAccessTokenin classAbstractClientBase
-
-