Package com.avoka.component.salesforce
Class SalesForceConnection
- java.lang.Object
-
- com.avoka.component.salesforce.SalesForceConnection
-
public class SalesForceConnection extends Object
Provides a SalesForce service connection class.- Since:
- 3.6.5
-
-
Constructor Summary
Constructors Constructor Description SalesForceConnection(String username, String passwordSecurityToken, String consumerKey, String consumerSecret, String loginServerURL)Create a SalesForce connection with parameters and initialize an authenticated session.SalesForceConnection(String username, String password, String securityToken, String consumerKey, String consumerSecret, String loginServerURL)Create a SalesForce connection with parameters and initialize an authenticated session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetApiVersion()org.apache.http.client.methods.HttpDeletegetHttpDelete(String serviceUrl)org.apache.http.client.methods.HttpGetgetHttpGet(String serviceUrl)org.apache.http.client.methods.HttpPatchgetHttpPatch(String serviceUrl)org.apache.http.client.methods.HttpPostgetHttpPost(String serviceUrl)booleanisPrettyPrint()StringperformHttpOperation(org.apache.http.client.methods.HttpEntityEnclosingRequestBase httpRequest, String bodyJsonString)Send a REST request to SalesForceStringperformHttpOperation(org.apache.http.client.methods.HttpEntityEnclosingRequestBase httpRequest, org.apache.http.HttpEntity entity)Send a REST request to SalesForceStringperformHttpOperation(org.apache.http.client.methods.HttpRequestBase httpRequest)Send a REST request to SalesForcevoidsetApiVersion(String apiVersion)Overrides the default version number of the SalesForce API being utilized.voidsetPrettyPrint(boolean isPrettyPrint)Set the PrettyPrint property of the connection.StringtoString()Return the string representation of the object.
-
-
-
Constructor Detail
-
SalesForceConnection
public SalesForceConnection(String username, String passwordSecurityToken, String consumerKey, String consumerSecret, String loginServerURL) throws SalesForceException
Create a SalesForce connection with parameters and initialize an authenticated session.- Parameters:
username- the SalesForce login username (required)passwordSecurityToken- the SalesForce login passwordSecurityToken {password}{security token} (required)consumerKey- the SalesForce consumer key (required)consumerSecret- the SalesForce consumer secret (required)loginServerURL- the SalesForce server URL (required)- Throws:
SalesForceException- if a SalesForce connection could not be established
-
SalesForceConnection
public SalesForceConnection(String username, String password, String securityToken, String consumerKey, String consumerSecret, String loginServerURL) throws SalesForceException
Create a SalesForce connection with parameters and initialize an authenticated session.- Parameters:
username- the SalesForce login username (required)password- the SalesForce login password (required)securityToken- the SalesForce login SecurityToken {password}{security token} (optional)consumerKey- the SalesForce consumer key (required)consumerSecret- the SalesForce consumer secret (required)loginServerURL- the SalesForce server URL (required)- Throws:
SalesForceException- if a SalesForce connection could not be established- Since:
- 4.2.0
-
-
Method Detail
-
isPrettyPrint
public boolean isPrettyPrint()
- Returns:
- the PrettyPrint property of the connection
-
setPrettyPrint
public void setPrettyPrint(boolean isPrettyPrint)
Set the PrettyPrint property of the connection. This will format any JSON responses in a more readable form- Parameters:
isPrettyPrint- true/false
-
getApiVersion
public String getApiVersion()
- Returns:
- the current version number of the SalesForce API being utilized.
-
setApiVersion
public void setApiVersion(String apiVersion)
Overrides the default version number of the SalesForce API being utilized.- Parameters:
apiVersion- (e.g. 'v20.0')
-
toString
public String toString()
Return the string representation of the object.
-
getHttpGet
public org.apache.http.client.methods.HttpGet getHttpGet(String serviceUrl)
- Parameters:
serviceUrl- - URL for the required service- Returns:
- an HttpGet object for the given URL pre-loaded with the SalesForce authentication headers
-
getHttpPost
public org.apache.http.client.methods.HttpPost getHttpPost(String serviceUrl)
- Parameters:
serviceUrl- - URL for the required service- Returns:
- an HttpPost object for the given URL pre-loaded with the SalesForce authentication headers
-
getHttpPatch
public org.apache.http.client.methods.HttpPatch getHttpPatch(String serviceUrl)
- Parameters:
serviceUrl- - URL for the required service- Returns:
- an HttpPatch object for the given URL pre-loaded with the SalesForce authentication headers
-
getHttpDelete
public org.apache.http.client.methods.HttpDelete getHttpDelete(String serviceUrl)
- Parameters:
serviceUrl- - URL for the required service- Returns:
- an HttpDelete object for the given URL pre-loaded with the SalesForce authentication headers
-
performHttpOperation
public String performHttpOperation(org.apache.http.client.methods.HttpRequestBase httpRequest) throws IOException
Send a REST request to SalesForce- Parameters:
httpRequest- The required SalesForce API REST request- Returns:
- a string representation of the HTTP response
- Throws:
IOException- if an IO error occurs
-
performHttpOperation
public String performHttpOperation(org.apache.http.client.methods.HttpEntityEnclosingRequestBase httpRequest, org.apache.http.HttpEntity entity) throws IOException
Send a REST request to SalesForce- Parameters:
httpRequest- The required SalesForce API REST requestentity- Additional entity to attach to the request- Returns:
- a string representation of the HTTP response
- Throws:
IOException- if an IO error occurs
-
performHttpOperation
public String performHttpOperation(org.apache.http.client.methods.HttpEntityEnclosingRequestBase httpRequest, String bodyJsonString) throws IOException
Send a REST request to SalesForce- Parameters:
httpRequest- The required SalesForce API REST requestbodyJsonString- JSON String to be sent in the request body- Returns:
- a string representation of the HTTP response
- Throws:
IOException- if an IO error occurs
-
-