Package com.logicaldoc.docusign
Class DocuSign
java.lang.Object
com.logicaldoc.docusign.DocuSign
Facade over the DocuSign eSignature online platform.
- Since:
- 8.5
- Author:
- Marco Meschieri - LogicalDOC
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
Type of a note that represents a Company tabstatic String
Type of a note that represents a Date tabstatic String
Type of a note that represents a DateSigned tabstatic String
Type of a note that represents a Email tab to input an email addressstatic String
Type of a note that represents a Email Address tab to print the recipients's emailstatic String
Type of a note that represents a EnvelopeId tabstatic String
Type of a note that represents a FullName tabstatic String[]
The different types of document notes used to model DocuSing tabsstatic String
Type of a note that represents a SignHere tabstatic String
Type of a note that represents a Text tabstatic String
Type of a note that represents a Title tab -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
downloadDocument
(String envelopeId, String docId, File out) Downloads a document from an envelope into a local fileThis is the first authentication step to be used when it is the first time you connect or when the previous access token has expired.getCustomValue
(String envelopeId, String fieldName) getCustomValues
(String envelopeId) Retrieves the custom fields of an envelopecom.docusign.esign.model.Envelope
getEnvelope
(String envelopeId) Retrieves a single envelopelong
List<com.docusign.esign.model.EnvelopeDocument>
listDocuments
(String envelopeId) Retrieves the list of the documents enclosed in an envelopeList<com.docusign.esign.model.Envelope>
listEnvelopes
(String status) Retrieves the envelopes generated by the current user after the last processed dateList<com.docusign.esign.model.Envelope>
listEnvelopes
(String from, String status) Retrieves the envelopes generated by the current userlistSigners
(String envelopeId) Retrieves the list of signers of an envelopevoid
Shortcut for retrieveAccessToken(null);void
retrieveAccessToken
(String authorizationToken) This is the second step of the authentication process.void
Saves the DocuSign settingssendEnvelope
(List<com.logicaldoc.core.document.Document> documents, com.logicaldoc.core.document.DocumentHistory transaction, String subject, String body, Date expire) Prepares and sends an envelope to DocuSignvoid
setAccessToken
(String accessToken) Sets the access tokenvoid
setAccountId
(String accountId) void
setApiBaseUrl
(String apiBaseUrl) void
setAuthBaseUrl
(String authBaseUrl) void
setIntegrationKey
(String integrationKey) void
setLastProcessed
(String date) void
setRefreshToken
(String refreshToken) Sets the refresh tokenvoid
setSecretKey
(String secretKey)
-
Field Details
-
SIGN_HERE
Type of a note that represents a SignHere tab -
TEXT
Type of a note that represents a Text tab -
DATE
Type of a note that represents a Date tab -
COMPANY
Type of a note that represents a Company tab -
DATE_SIGNED
Type of a note that represents a DateSigned tab -
TITLE
Type of a note that represents a Title tab -
FULL_NAME
Type of a note that represents a FullName tab -
ENVELOPE_ID
Type of a note that represents a EnvelopeId tab -
EMAIL
Type of a note that represents a Email tab to input an email address -
EMAIL_ADDRESS
Type of a note that represents a Email Address tab to print the recipients's email -
NOTE_TYPES
The different types of document notes used to model DocuSing tabs
-
-
Constructor Details
-
DocuSign
public DocuSign(long userId) throws com.logicaldoc.core.PersistenceException Constructor- Parameters:
userId
- identifier of the user- Throws:
com.logicaldoc.core.PersistenceException
- error at data layer
-
-
Method Details
-
sendEnvelope
public String sendEnvelope(List<com.logicaldoc.core.document.Document> documents, com.logicaldoc.core.document.DocumentHistory transaction, String subject, String body, Date expire) throws com.logicaldoc.core.PersistenceException, IOException, com.docusign.esign.client.ApiException Prepares and sends an envelope to DocuSign- Parameters:
documents
- collection of documents in the envelopetransaction
- transaction informationssubject
- subject of the email that notifies the signersbody
- object of the email that notifies the signersexpire
- optional expiration date for the envelope- Returns:
- identifier of the created envelope
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database layerIOException
- I/O errorcom.docusign.esign.client.ApiException
- 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
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 envelopedocId
- identifier of the file inside the envelopeout
- file where the contents have to be written- Throws:
com.docusign.esign.client.ApiException
- Error communicating with DocuSignIOException
- Error writing the file
-
getAuthorizationUrl
This is the first authentication step to be used when it is the first time you connect or when the previous access token has expired. Generates the URL to request the authorization code the user must be redirected to. See https://developers.docusign.com/platform/auth/authcode.- Returns:
- the URL to redirect the user to
-
retrieveAccessToken
public void retrieveAccessToken() throws IOException, com.logicaldoc.core.security.authentication.AuthenticationExceptionShortcut for retrieveAccessToken(null);- Throws:
IOException
- A communication errorcom.logicaldoc.core.security.authentication.AuthenticationException
- The user was not authenticated by DocuSign, probably this means you need another authorization code
-
retrieveAccessToken
public void retrieveAccessToken(String authorizationToken) throws IOException, com.logicaldoc.core.security.authentication.AuthenticationException This is the second step of the authentication process. Invoke this method before invoking the others. If a refresh token is available, then it is used to get the access token, otherwise a new access token is asked using the authorization code previously saved bygetAuthorizationUrl()
.
for a test access token see https://developers.docusign.com/oauth-token-generator
See also https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant- Parameters:
authorizationToken
- optional authorization code- Throws:
IOException
- A communication errorcom.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
-
setApiBaseUrl
-
getAuthBaseUrl
-
setAuthBaseUrl
-
getAccountId
-
setAccountId
-
getCallbackUrl
-
getIntegrationKey
-
setIntegrationKey
-
getSecretKey
-
setSecretKey
-
getAccessToken
-
getLastProcessed
-
setLastProcessed
-
setAccessToken
Sets the access token- Parameters:
accessToken
- the access token
-
getRefreshToken
-
setRefreshToken
Sets the refresh token- Parameters:
refreshToken
- the refresh token
-
getUserId
public long getUserId()
-