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 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

      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.
      Overrides:
      toString in class Object
      Returns:
      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 request
      entity - 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 request
      bodyJsonString - JSON String to be sent in the request body
      Returns:
      a string representation of the HTTP response
      Throws:
      IOException - if an IO error occurs