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
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoiddownloadDocument(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.EnvelopegetEnvelope(String envelopeId) Retrieves a single envelopelongList<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 envelopevoidShortcut for retrieveAccessToken(null);voidretrieveAccessToken(String authorizationToken) This is the second step of the authentication process.voidSaves 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 DocuSignvoidsetAccessToken(String accessToken) Sets the access tokenvoidsetAccountId(String accountId) voidsetApiBaseUrl(String apiBaseUrl) voidsetAuthBaseUrl(String authBaseUrl) voidsetIntegrationKey(String integrationKey) voidsetLastProcessed(String date) voidsetRefreshToken(String refreshToken) Sets the refresh tokenvoidsetSecretKey(String secretKey) 
- 
Constructor Details- 
DocuSignpublic 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- 
sendEnvelopepublic 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 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:
- com.logicaldoc.core.PersistenceException- Error in the database layer
- IOException- I/O error
- com.docusign.esign.client.ApiException- error creating the envelope or communicating with DocuSign
 
- 
getEnvelopepublic 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
 
- 
listEnvelopespublic 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
 
- 
listEnvelopespublic 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
 
- 
getCustomValuepublic String getCustomValue(String envelopeId, String fieldName) throws com.docusign.esign.client.ApiException - Throws:
- com.docusign.esign.client.ApiException
 
- 
listSignersRetrieves 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
 
- 
getCustomValuespublic 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
 
- 
listDocumentspublic 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
 
- 
downloadDocumentpublic 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
 
- 
getAuthorizationUrlThis 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
 
- 
retrieveAccessTokenpublic void retrieveAccessToken() throws IOException, com.logicaldoc.core.security.authentication.AuthenticationExceptionShortcut 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
 
- 
retrieveAccessTokenpublic 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 error
- com.logicaldoc.core.security.authentication.AuthenticationException- The user was not authenticated by DocuSign, probably this means you need another authorization code
 
- 
saveSettingspublic void saveSettings()Saves the DocuSign settings
- 
getApiBaseUrl
- 
setApiBaseUrl
- 
getAuthBaseUrl
- 
setAuthBaseUrl
- 
getAccountId
- 
setAccountId
- 
getCallbackUrl
- 
getIntegrationKey
- 
setIntegrationKey
- 
getSecretKey
- 
setSecretKey
- 
getAccessToken
- 
getLastProcessed
- 
setLastProcessed
- 
setAccessTokenSets the access token- Parameters:
- accessToken- the access token
 
- 
getRefreshToken
- 
setRefreshTokenSets the refresh token- Parameters:
- refreshToken- the refresh token
 
- 
getUserIdpublic long getUserId()
 
-