public class SalesforceClient extends 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 String |
APPLICATION_FORMURL_ENCODED |
static String |
CLIENT_ID |
static String |
CLIENT_SECRET |
static String |
GRANT_TYPE |
static String |
INVALID_CLIENT |
static String |
INVALID_CLIENT_ID |
static String |
REFRESH_ACCESS_TOKEN_ENDPOINT |
static String |
REFRESH_TOKEN |
Constructor and Description |
---|
SalesforceClient() |
Modifier and Type | Method and Description |
---|---|
void |
addData(String key,
String value)
Adds a key-value pair to parameters list
|
void |
addData(String key,
String value,
boolean encode)
Adds a key-value pair to parameters list with an option not to encode the parameters
|
void |
addParameter(String key,
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.
|
String |
getAccessToken()
Returns the Access Token
|
String |
getClientId()
Returns the Client Identifier.
|
String |
getClientSecret()
Returns the Client Secret.
|
String |
getContentType()
Returns the Content-Type of the Request
|
String |
getData()
Returns the URL encoded parameters used for REST Api calls as a String.
|
String |
getInstanceURL()
Returns the Instance URL for the Salesforce configuration
|
SalesforceClient.AvailableMethods |
getMethod()
Returns the HTTP Method used in the Current Request.
|
HashMap<String,String> |
getParameters()
Returns the list of parameters as a map
|
String |
getPath()
Returns the current REST API endpoint
|
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(String accessToken)
Sets the Access Token
|
void |
setClientId(String clientId)
Sets the Client Identifier.
|
void |
setClientSecret(String clientSecret)
Sets the Client Secret.
|
void |
setContentType(String contentType)
Sets the Content-Type of the Request
|
void |
setData(Map<String,String> data)
Set the URL encoded parameters used for REST Api calls as a Map of key-value pairs.
|
void |
setData(String data)
Set the URL encoded parameters used for REST Api calls as a String.
|
void |
setInstanceURL(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(HashMap<String,String> parameters)
Sets the list of parameters.
|
void |
setPath(String path)
Sets the current REST API endpoint
|
void |
setRefreshToken(String refreshToken)
Sets the Refresh Token
|
void |
setStringMethod(String method)
Sets the HTTP Method as a String to be used in Current Request
|
public static final String INVALID_CLIENT_ID
public static final String INVALID_CLIENT
public static final String CLIENT_ID
public static final String CLIENT_SECRET
public static final String REFRESH_ACCESS_TOKEN_ENDPOINT
public static final String APPLICATION_FORMURL_ENCODED
public static final String GRANT_TYPE
public static final String REFRESH_TOKEN
public String getClientId()
public void setClientId(String clientId)
public String getClientSecret()
public void setClientSecret(String clientSecret)
public String getData()
public void addData(String key, String value, boolean encode)
public void setData(Map<String,String> data)
public void setData(String data)
public String getInstanceURL()
public void setInstanceURL(String instanceURL)
public String getPath()
public void setPath(String path)
public String getAccessToken()
public void setAccessToken(String accessToken)
public String getRefreshToken()
public void setRefreshToken(String refreshToken)
public String getContentType()
public void setContentType(String contentType)
public SalesforceClient.AvailableMethods getMethod()
SalesforceClient.AvailableMethods
public void setMethod(SalesforceClient.AvailableMethods method)
SalesforceClient.AvailableMethods
public void setStringMethod(String method)
public void setParameters(HashMap<String,String> parameters)
public SalesforceResponse executeRequest() throws SalesforceException
SalesforceException
public SalesforceResponse executeGetRequest() throws SalesforceException
SalesforceException
public SalesforceResponse doExecuteGetRequest() throws IOException, SalesforceException
IOException
SalesforceException
public SalesforceResponse executeDataRequest() throws SalesforceException
SalesforceException
public SalesforceResponse doExecuteDataRequest() throws IOException, SalesforceException
IOException
SalesforceException
public SalesforceResponse refreshAccessToken() throws SalesforceException
SalesforceException
public boolean isAccessTokenExpired(SalesforceResponse salesforceResponse) throws SalesforceException
SalesforceException
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"