public class SalesforceClient
extends java.lang.Object
SalesforceClient
uses the Salesforce REST API to authenticate and query Salesforce.Modifier and Type | Class and Description |
---|---|
static class |
SalesforceClient.AvailableMethods |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLICATION_FORMURL_ENCODED |
static java.lang.String |
CLIENT_ID |
static java.lang.String |
CLIENT_SECRET |
static java.lang.String |
GRANT_TYPE |
static java.lang.String |
INVALID_CLIENT |
static java.lang.String |
INVALID_CLIENT_ID |
static java.lang.String |
REFRESH_ACCESS_TOKEN_ENDPOINT |
static java.lang.String |
REFRESH_TOKEN |
Constructor and Description |
---|
SalesforceClient() |
Modifier and Type | Method and Description |
---|---|
void |
addData(java.lang.String key,
java.lang.String value)
Adds a key-value pair to parameters list
|
void |
addData(java.lang.String key,
java.lang.String value,
boolean encode)
Adds a key-value pair to parameters list with an option not to encode the parameters
|
void |
addParameter(java.lang.String key,
java.lang.String value)
Adds a parameter to the param list
|
SalesforceResponse |
doExecuteDataRequest()
Executes the Current POST/PATCH Request
|
SalesforceResponse |
doExecuteGetRequest()
Executes the Current GET Request
|
SalesforceResponse |
executeDataRequest()
Executes the Current POST/PATCH Request and refreshes the access token if expired
|
SalesforceResponse |
executeGetRequest()
Executes the Current GET Request and refreshes the access token if expired
|
SalesforceResponse |
executeRequest()
Executes the current request.
|
java.lang.String |
getAccessToken()
Returns the Access Token
|
java.lang.String |
getClientId()
Returns the Client Identifier.
|
java.lang.String |
getClientSecret()
Returns the Client Secret.
|
java.lang.String |
getContentType()
Returns the Content-Type of the Request
|
java.lang.String |
getData()
Returns the URL encoded parameters used for REST Api calls as a String.
|
java.lang.String |
getInstanceURL()
Returns the Instance URL for the Salesforce configuration
|
SalesforceClient.AvailableMethods |
getMethod()
Returns the HTTP Method used in the Current Request.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getParameters()
Returns the list of parameters as a map
|
java.lang.String |
getPath()
Returns the current REST API endpoint
|
java.lang.String |
getRefreshToken()
Returns the Refresh Token
|
boolean |
isAccessTokenExpired(SalesforceResponse salesforceResponse)
Checks if the currently set access token has been expired or not
|
SalesforceResponse |
refreshAccessToken()
Refreshes the Access Token using the refresh_token
Assumes that the client_id and client_secret are set before invoking this function
|
void |
setAccessToken(java.lang.String accessToken)
Sets the Access Token
|
void |
setClientBuilderFactory(HttpClientBuilderFactory clientBuilderFactory)
Sets the HTTP Client Builder factory
|
void |
setClientId(java.lang.String clientId)
Sets the Client Identifier.
|
void |
setClientSecret(java.lang.String clientSecret)
Sets the Client Secret.
|
void |
setContentType(java.lang.String contentType)
Sets the Content-Type of the Request
|
void |
setData(java.util.Map<java.lang.String,java.lang.String> data)
Set the URL encoded parameters used for REST Api calls as a Map of key-value pairs.
|
void |
setData(java.lang.String data)
Set the URL encoded parameters used for REST Api calls as a String.
|
void |
setInstanceURL(java.lang.String instanceURL)
Sets the Instance URL for the Salesforce configuration
|
void |
setMethod(SalesforceClient.AvailableMethods method)
Sets the HTTP Method used in the Current Request.
|
void |
setParameters(java.util.HashMap<java.lang.String,java.lang.String> parameters)
Sets the list of parameters.
|
void |
setPath(java.lang.String path)
Sets the current REST API endpoint
|
void |
setRefreshToken(java.lang.String refreshToken)
Sets the Refresh Token
|
void |
setStringMethod(java.lang.String method)
Sets the HTTP Method as a String to be used in Current Request
|
public static final java.lang.String INVALID_CLIENT_ID
public static final java.lang.String INVALID_CLIENT
public static final java.lang.String CLIENT_ID
public static final java.lang.String CLIENT_SECRET
public static final java.lang.String REFRESH_ACCESS_TOKEN_ENDPOINT
public static final java.lang.String APPLICATION_FORMURL_ENCODED
public static final java.lang.String GRANT_TYPE
public static final java.lang.String REFRESH_TOKEN
public java.lang.String getClientId()
public void setClientId(java.lang.String clientId)
public java.lang.String getClientSecret()
public void setClientSecret(java.lang.String clientSecret)
public java.lang.String getData()
public void addData(java.lang.String key, java.lang.String value)
public void addData(java.lang.String key, java.lang.String value, boolean encode)
public void setData(java.util.Map<java.lang.String,java.lang.String> data)
public void setData(java.lang.String data)
public java.lang.String getInstanceURL()
public void setInstanceURL(java.lang.String instanceURL)
public java.lang.String getPath()
public void setPath(java.lang.String path)
public java.lang.String getAccessToken()
public void setAccessToken(java.lang.String accessToken)
public java.lang.String getRefreshToken()
public void setRefreshToken(java.lang.String refreshToken)
public java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
public SalesforceClient.AvailableMethods getMethod()
SalesforceClient.AvailableMethods
public void setMethod(SalesforceClient.AvailableMethods method)
SalesforceClient.AvailableMethods
public void setStringMethod(java.lang.String method)
public void addParameter(java.lang.String key, java.lang.String value)
public java.util.HashMap<java.lang.String,java.lang.String> getParameters()
public void setParameters(java.util.HashMap<java.lang.String,java.lang.String> parameters)
public void setClientBuilderFactory(HttpClientBuilderFactory clientBuilderFactory)
clientBuilderFactory
- The HTTP Client Builder factorypublic SalesforceResponse executeRequest() throws SalesforceException
SalesforceException
public SalesforceResponse executeGetRequest() throws SalesforceException
SalesforceException
public SalesforceResponse doExecuteGetRequest() throws java.io.IOException, SalesforceException
java.io.IOException
SalesforceException
public SalesforceResponse executeDataRequest() throws SalesforceException
SalesforceException
public SalesforceResponse doExecuteDataRequest() throws java.io.IOException, SalesforceException
java.io.IOException
SalesforceException
public SalesforceResponse refreshAccessToken() throws SalesforceException
SalesforceException
public boolean isAccessTokenExpired(SalesforceResponse salesforceResponse) throws SalesforceException
SalesforceException
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"