Class DocuSignUtil


  • public class DocuSignUtil
    extends Object
    A set of utility methods for DocuSign
    Since:
    8.5
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • DocuSignUtil

        public DocuSignUtil()
    • Method Detail

      • formatDate

        public static String formatDate​(Date date)
        Formats a date in RFC3339 format
        Parameters:
        date - the date to format
        Returns:
        the formatted date
      • parseDate

        public static Date parseDate​(String date)
                              throws ParseException
        Parses a date in RFC3339 format
        Parameters:
        date - the date to parse
        Returns:
        the parsed date
        Throws:
        ParseException - a parsing error
      • isEnvelopeProcessed

        public static boolean isEnvelopeProcessed​(String envelopeId)
                                           throws com.logicaldoc.core.PersistenceException
        Checks if the given envelope has been processed.
        Parameters:
        envelopeId - identifier of the envelope
        Returns:
        if the envelope has been processed
        Throws:
        com.logicaldoc.core.PersistenceException - Error at database level
      • markEnvelopeAsProcessed

        public static void markEnvelopeAsProcessed​(String envelopeId,
                                                   String envelopeSubject,
                                                   com.logicaldoc.core.security.User user)
                                            throws com.logicaldoc.core.PersistenceException
        Marks a given envelope as already processed that is a generic with:
        • type = docusign-env
        • subtype = envelopeId
        • string1 = subject
        Parameters:
        envelopeId - identifier of the envelope
        envelopeSubject - subject to give to the envelope notifications
        user - the user whose DocuSign profile belongs to
        Throws:
        com.logicaldoc.core.PersistenceException - Error at database level
      • listUsersWithDocuSignProfile

        public static List<com.logicaldoc.core.security.User> listUsersWithDocuSignProfile()
        Gets the list of users with a DocuSign profile
        Returns:
        list of users
      • processCompletedEnvelope

        public static long processCompletedEnvelope​(String envelopeId,
                                                    long userId,
                                                    org.slf4j.Logger log)
                                             throws IOException,
                                                    com.docusign.esign.client.ApiException,
                                                    com.logicaldoc.core.security.authentication.AuthenticationException,
                                                    com.logicaldoc.core.PersistenceException
        Takes the documents already signed from the envelope and updates the local documents
        Parameters:
        envelopeId - identifier of the completed envelope
        userId - the user that created the envelope
        log - the logger to use
        Returns:
        the number of updated documents
        Throws:
        IOException - exception downloading the files from DocuSign or writing in the local storage
        com.docusign.esign.client.ApiException - error interacting with DocuSign
        com.logicaldoc.core.security.authentication.AuthenticationException - the user has not been authenticated by DocuSign
        com.logicaldoc.core.PersistenceException - error in the database
      • processCompletedEnvelope

        public static long processCompletedEnvelope​(com.docusign.esign.model.Envelope envelope,
                                                    DocuSign docuSign,
                                                    org.slf4j.Logger log)
                                             throws IOException,
                                                    com.docusign.esign.client.ApiException,
                                                    com.logicaldoc.core.security.authentication.AuthenticationException,
                                                    com.logicaldoc.core.PersistenceException
        Takes the documents already signed from the envelope and updates the local documents
        Parameters:
        envelope - the envelope to process
        log - the logger to use
        docuSign - the DocuSign facade, if not provided it will be created
        Returns:
        the number of updated documents
        Throws:
        IOException - exception downloading the files from DocuSign or writing in the local storage
        com.docusign.esign.client.ApiException - error interacting with DocuSign
        com.logicaldoc.core.security.authentication.AuthenticationException - the user has not been authenticated by DocuSign
        com.logicaldoc.core.PersistenceException - error in the database