Package com.avoka.component.salesforce
Class SalesForceConnection
java.lang.Object
com.avoka.component.salesforce.SalesForceConnection
Provides a SalesForce service connection class.
- Since:
- 3.6.5
-
Constructor Summary
ConstructorsConstructorDescriptionSalesForceConnection(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
Modifier and TypeMethodDescriptionorg.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) booleanperformHttpOperation(org.apache.http.client.methods.HttpEntityEnclosingRequestBase httpRequest, String bodyJsonString) Send a REST request to SalesForceperformHttpOperation(org.apache.http.client.methods.HttpEntityEnclosingRequestBase httpRequest, org.apache.http.HttpEntity entity) Send a REST request to SalesForceperformHttpOperation(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.toString()Return the string representation of the object.
-
Constructor Details
-
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 Details
-
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
- Returns:
- the current version number of the SalesForce API being utilized.
-
setApiVersion
Overrides the default version number of the SalesForce API being utilized.- Parameters:
apiVersion- (e.g. 'v20.0')
-
toString
Return the string representation of the object. -
getHttpGet
- Parameters:
serviceUrl- - URL for the required service- Returns:
- an HttpGet object for the given URL pre-loaded with the SalesForce authentication headers
-
getHttpPost
- Parameters:
serviceUrl- - URL for the required service- Returns:
- an HttpPost object for the given URL pre-loaded with the SalesForce authentication headers
-
getHttpPatch
- Parameters:
serviceUrl- - URL for the required service- Returns:
- an HttpPatch object for the given URL pre-loaded with the SalesForce authentication headers
-
getHttpDelete
- 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
-