Class DocuSign


  • public class DocuSign
    extends Object
    Facade over the DocuSign eSignature online platform.
    Since:
    8.5
    Author:
    Marco Meschieri - LogicalDOC
    • Field Detail

      • SIGN_HERE

        public static String SIGN_HERE
        Type of a note that represents a SignHere tab
      • TEXT

        public static String TEXT
        Type of a note that represents a Text tab
      • DATE

        public static String DATE
        Type of a note that represents a Date tab
      • COMPANY

        public static String COMPANY
        Type of a note that represents a Company tab
      • DATE_SIGNED

        public static String DATE_SIGNED
        Type of a note that represents a DateSigned tab
      • TITLE

        public static String TITLE
        Type of a note that represents a Title tab
      • FULL_NAME

        public static String FULL_NAME
        Type of a note that represents a FullName tab
      • ENVELOPE_ID

        public static String ENVELOPE_ID
        Type of a note that represents a EnvelopeId tab
      • EMAIL

        public static String EMAIL
        Type of a note that represents a Email tab to input an email address
      • EMAIL_ADDRESS

        public static String EMAIL_ADDRESS
        Type of a note that represents a Email Address tab to print the recipients's email
      • NOTE_TYPES

        public static String[] NOTE_TYPES
        The different types of document notes used to model DocuSing tabs
    • Constructor Detail

      • DocuSign

        public DocuSign​(long userId)
                 throws com.logicaldoc.core.PersistenceException
        Constructor
        Parameters:
        userId - identifier of the user
        Throws:
        com.logicaldoc.core.PersistenceException - error in the database
    • Method Detail

      • sendEnvelope

        public String sendEnvelope​(List<com.logicaldoc.core.document.Document> documents,
                                   com.logicaldoc.core.document.DocumentHistory transaction,
                                   String subject,
                                   String body,
                                   Date expire)
                            throws Exception
        Prepares and sends an envelope to DocuSign
        Parameters:
        documents - collection of documents in the envelope
        transaction - transaction informations
        subject - subject of the email that notifies the signers
        body - object of the email that notifies the signers
        expire - optional expiration date for the envelope
        Returns:
        identifier of the created envelope
        Throws:
        Exception - error creating the envelope or communicating with DocuSign
      • getEnvelope

        public com.docusign.esign.model.Envelope getEnvelope​(String envelopeId)
                                                      throws com.docusign.esign.client.ApiException
        Retrieves a single envelope
        Parameters:
        envelopeId - unique identifier of the envelope
        Returns:
        the envelope instance
        Throws:
        com.docusign.esign.client.ApiException - Error communicating with DocuSign
      • listEnvelopes

        public List<com.docusign.esign.model.Envelope> listEnvelopes​(String status)
                                                              throws com.docusign.esign.client.ApiException
        Retrieves the envelopes generated by the current user after the last processed date
        Parameters:
        status - optional status to use as search criteria
        Returns:
        list of envelopes
        Throws:
        com.docusign.esign.client.ApiException - Error communicating with DocuSign
      • listEnvelopes

        public List<com.docusign.esign.model.Envelope> listEnvelopes​(String from,
                                                                     String status)
                                                              throws com.docusign.esign.client.ApiException
        Retrieves the envelopes generated by the current user
        Parameters:
        from - optional creation date to use as search criteria (use the RFC3339 format)
        status - optional status to use as search criteria
        Returns:
        list of envelopes
        Throws:
        com.docusign.esign.client.ApiException - Error communicating with DocuSign
      • getCustomValue

        public String getCustomValue​(String envelopeId,
                                     String fieldName)
                              throws com.docusign.esign.client.ApiException
        Throws:
        com.docusign.esign.client.ApiException
      • listSigners

        public List<String> listSigners​(String envelopeId)
                                 throws com.docusign.esign.client.ApiException
        Retrieves the list of signers of an envelope
        Parameters:
        envelopeId - identifier of the envelope
        Returns:
        list of the emails of all the signers
        Throws:
        com.docusign.esign.client.ApiException - Error communicating with DocuSign
      • getCustomValues

        public Map<String,​String> getCustomValues​(String envelopeId)
                                                 throws com.docusign.esign.client.ApiException
        Retrieves the custom fields of an envelope
        Parameters:
        envelopeId - identifier of the envelope
        Returns:
        The map of values
        Throws:
        com.docusign.esign.client.ApiException - Error communicating with DocuSign
      • listDocuments

        public List<com.docusign.esign.model.EnvelopeDocument> listDocuments​(String envelopeId)
                                                                      throws com.docusign.esign.client.ApiException
        Retrieves the list of the documents enclosed in an envelope
        Parameters:
        envelopeId - identifier of the envelope
        Returns:
        the list of contained documents
        Throws:
        com.docusign.esign.client.ApiException - Error communicating with DocuSign
      • downloadDocument

        public void downloadDocument​(String envelopeId,
                                     String docId,
                                     File out)
                              throws com.docusign.esign.client.ApiException,
                                     IOException
        Downloads a document from an envelope into a local file
        Parameters:
        envelopeId - identifier of the envelope
        docId - identifier of the file inside the envelope
        out - file where the contents have to be written
        Throws:
        com.docusign.esign.client.ApiException - Error communicating with DocuSign
        IOException - Error writing the file
      • retrieveAccessToken

        public void retrieveAccessToken()
                                 throws IOException,
                                        com.logicaldoc.core.security.authentication.AuthenticationException
        Shortcut for retrieveAccessToken(null);
        Throws:
        IOException - A communication error
        com.logicaldoc.core.security.authentication.AuthenticationException - The user was not authenticated by DocuSign, probably this means you need another authorization code
      • saveSettings

        public void saveSettings()
        Saves the DocuSign settings
      • getApiBaseUrl

        public String getApiBaseUrl()
      • setApiBaseUrl

        public void setApiBaseUrl​(String apiBaseUrl)
      • getAuthBaseUrl

        public String getAuthBaseUrl()
      • setAuthBaseUrl

        public void setAuthBaseUrl​(String authBaseUrl)
      • getAccountId

        public String getAccountId()
      • setAccountId

        public void setAccountId​(String accountId)
      • getCallbackUrl

        public String getCallbackUrl()
      • getIntegrationKey

        public String getIntegrationKey()
      • setIntegrationKey

        public void setIntegrationKey​(String integrationKey)
      • getSecretKey

        public String getSecretKey()
      • setSecretKey

        public void setSecretKey​(String secretKey)
      • getAccessToken

        public String getAccessToken()
      • getLastProcessed

        public String getLastProcessed()
      • setLastProcessed

        public void setLastProcessed​(String date)
      • setAccessToken

        public void setAccessToken​(String accessToken)
        Sets the access token
        Parameters:
        accessToken - the access token
      • getRefreshToken

        public String getRefreshToken()
      • setRefreshToken

        public void setRefreshToken​(String refreshToken)
        Sets the refresh token
        Parameters:
        refreshToken - the refresh token
      • getUserId

        public long getUserId()