Class SubmissionDao


  • public class SubmissionDao
    extends AbstractDao
    Provides a DAO for the Submission entity.
    See Also:
    Submission
    • Constructor Detail

      • SubmissionDao

        public SubmissionDao()
    • Method Detail

      • getSubmission

        public Submission getSubmission​(Object id)
        Return the submission with the specified OID
        Parameters:
        id - the OID
        Returns:
        the matching submission, or null if not found
      • getSubmissionsForExternalUserId

        public List<Submission> getSubmissionsForExternalUserId​(String externalUserId)
        Return the list of submissions with the given external user ID, ordered by submission time. Submissions with a Form Status of 'Opened' will be excluded.
        Parameters:
        externalUserId - the external user ID to look for
        Returns:
        the list of matching submissions
      • updateSubmissionExpiryDate

        public int[] updateSubmissionExpiryDate​(Long formId,
                                                Date newExpiryDate)
        Return an int array containing the total number of updated records
        Parameters:
        formId - the form Id (required)
        newExpiryDate - the new expiry date (required)
        Returns:
        a single element int array containing the total number of updated submission(s), otherwise an empty array
        Since:
        21.5.2
      • getFormSubmissions

        public List<Submission> getFormSubmissions​(Form form,
                                                   int fetchLimit)
        Return the most recent non-test form submissions for the given form.
        Parameters:
        form - the form to get the submissions for
        fetchLimit - the maximum number of submissions to return
        Returns:
        the most recent non-test form submissions for the given form
      • getAdminCachedFormSubmissions

        public List<Submission> getAdminCachedFormSubmissions​(Form form,
                                                              int fetchLimit)
        Return the most recent non-test administrator cached form submissions for the given form.
        Parameters:
        form - the form to get the submissions for
        fetchLimit - the maximum number of submissions to return
        Returns:
        the most recent non-test form submissions for the given form
        Since:
        4.3.2
      • getFormSubmissions

        public List<Submission> getFormSubmissions​(String clientId,
                                                   int fetchLimit)
        Return the most recent form submissions for the specified client or all clients if not specified.
        Parameters:
        clientId - the client ID to get the submissions for
        fetchLimit - the maximum number of submissions to return
        Returns:
        the most recent form submissions
        Since:
        4.0.0
      • getAdminFormSubmissions

        public List<Submission> getAdminFormSubmissions​(String clientId)
        Return the most recent form submissions for the specified admin client or all clients if not specified.
        Parameters:
        clientId - the client ID to get the submissions for
        Returns:
        the most recent form submissions
        Since:
        4.3.2
      • getToDoSubmissionsForUserAndForm

        public List<Submission> getToDoSubmissionsForUserAndForm​(UserAccount userAccount,
                                                                 Form form,
                                                                 boolean includeGroupSubmission)
        Gets the submissions for user and form. This is used for internally managed group access
        Parameters:
        userAccount - the user account
        form - the form
        includeGroupSubmission - the include group submission
        Returns:
        the submissions for user and form
      • getNextRestDeliverySubmission

        public Submission getNextRestDeliverySubmission​(DeliveryDetails deliveryDetails)
        Return the next REST delivery submission ready for delivery.
        Parameters:
        deliveryDetails - the delivery details (required)
        Returns:
        the delivery submissions for the specified delivery details and delivery status
        Since:
        4.1.8
      • getSubmissionsForDeliveryDetailsAndStatus

        public List<Submission> getSubmissionsForDeliveryDetailsAndStatus​(DeliveryDetails deliveryDetails,
                                                                          String deliveryStatus)
        Return the delivery submissions for the specified delivery details and delivery status.
        Parameters:
        deliveryDetails - the delivery details (required)
        deliveryStatus - the delivery status (required)
        Returns:
        the delivery submissions for the specified delivery details and delivery status
        Since:
        4.1.8
      • getRESTDeliveryRetrySubmissions

        public List<Submission> getRESTDeliveryRetrySubmissions()
        Return the list of submissions with the delivery status of 'In-Progress' and delivery method 'REST Service' and where their next_delivery_time exceeds the current time.
        Returns:
        list of REST Service delivery submissions which should be retried.
        Since:
        4.1.8
      • getNextSubmissionsForDeliveryDetailsAndStatus

        public Submission getNextSubmissionsForDeliveryDetailsAndStatus​(DeliveryDetails deliveryDetails,
                                                                        String deliveryStatus)
        Return the next delivery submissions for the specified delivery details and delivery status.

        This method is intended for use by the REST Delivery API, and will only return submissions which have not been purge, and where their next delivery time is ready when getting submissions with a deliveryStatus of 'Error'.

        Parameters:
        deliveryDetails - the delivery details (required)
        deliveryStatus - the delivery status (required)
        Returns:
        the delivery submissions for the specified delivery details and delivery status
        Since:
        4.2.0
      • getSubmissionsForDeliveryDetailsAndStatus

        public List<Submission> getSubmissionsForDeliveryDetailsAndStatus​(DeliveryDetails deliveryDetails,
                                                                          String deliveryStatus,
                                                                          int fetchLimit)
        Return the delivery submissions for the specified delivery details and delivery status.

        This method is intended for use by the REST Delivery API, and will only return submissions which have not been purge, and where their next delivery time is ready when getting submissions with a deliveryStatus of 'Error'.

        Parameters:
        deliveryDetails - the delivery details (required)
        deliveryStatus - the delivery status (required)
        fetchLimit - the query fetch limit
        Returns:
        the delivery submissions for the specified delivery details and delivery status
        Since:
        4.2.0
      • getSubmissionsForDeliveryNoDeliveryDetails

        public List<Submission> getSubmissionsForDeliveryNoDeliveryDetails()
        Return submissions for delivery, but with no delivery details configured.
        Returns:
        submissions for delivery, but with no delivery details configured
        Since:
        4.3.4
      • getSubmissionsReadyForDelivery

        public List<Submission> getSubmissionsReadyForDelivery​(int maxRows)
        Return a list of the n most recent submission that are ready for delivery and for which a delivery method is configured. Note that abandoned submissions are not included.
        Parameters:
        maxRows - the value for n, limiting the result size
        Returns:
        the list of matching submission
      • getAbandonedSubmissionsForDelivery

        @Deprecated
        public List<Submission> getAbandonedSubmissionsForDelivery​(int maxRows)
        Deprecated.
        Return a list of the n most recent submission that are abandoned and ready for delivery
        Parameters:
        maxRows - the value for n, limiting the result size
        Returns:
        the list of matching submissions
      • getAnonymousBgSaveSubmissionsForAbandonment

        public List<Submission> getAnonymousBgSaveSubmissionsForAbandonment​(int maxRows)
        Return a list of Form Starts (auto saved, but no user save), which are configured for abandonment delivery and reach the form configured abandon submitted timeout.
        Parameters:
        maxRows - the value for n, limiting the result size
        Returns:
        the list of matching submissions
        Since:
        4.0.0
      • getOpenedSubmissionsForAbandonment

        public List<Submission> getOpenedSubmissionsForAbandonment​(int maxRows)
        Return a list of the n most recent opened and background save only submissions that are ready for abandonment
        Parameters:
        maxRows - the value for n, limiting the result size
        Returns:
        the list of matching submissions
        Since:
        4.0.0
      • getSavedSubmissionsForAbandonment

        public List<Submission> getSavedSubmissionsForAbandonment​(int maxRows)
        Return a list of the n most recent save submissions that are ready for abandonment
        Parameters:
        maxRows - the value for n, limiting the result size
        Returns:
        the list of matching submissions
        Since:
        4.0.0
      • getSubmittedSubmissionsForAbandonment

        public List<Submission> getSubmittedSubmissionsForAbandonment​(int maxRows)
        Return a list of the n most recent save submissions that are ready for abandonment
        Parameters:
        maxRows - the value for n, limiting the result size
        Returns:
        the list of matching submissions
        Since:
        4.0.0
      • getInProgressSubmissionsForFormAndExpiryDate

        public List<Submission> getInProgressSubmissionsForFormAndExpiryDate​(Form form,
                                                                             Date submissionExpiryDate)
        Return the list of in progress submissions (Opened, Assigned, Saved, Submitted) for the given form and submission expiry date.
        Parameters:
        form - the form to get the submissions from (required)
        submissionExpiryDate - the sumission expiry date
        Returns:
        the list of in progress submissions (Opened, Assigned, Saved, Submitted) for the given form and expiry date
        Since:
        4.3.0
      • getSubmissionsDeliveredViaEmailBefore

        public List<Submission> getSubmissionsDeliveredViaEmailBefore​(Date cutoffTime,
                                                                      int maxRows)
        Return the list of submissions for which secure email delivery was initiated before a specified cutoff time
        Parameters:
        cutoffTime - the cutoff date/time
        maxRows - the maximum number of rows to retrieve
        Returns:
        the list of matching submissions
      • getEscalations

        public Map<String,​Long> getEscalations​(Date cutoffTime)
        Return information on how many clients have submissions for which delivery has not been completed after a specified cutoff time
        Parameters:
        cutoffTime - the cutoff date/time
        Returns:
        a map containing client codes and the number of submissions to escalate for each client
      • getExpiredSubmissionsToAbandon

        public List<Submission> getExpiredSubmissionsToAbandon​(int fetchLimit)
        Return the list of expired submissions to abandon.
        Parameters:
        fetchLimit - the query fetch limit
        Returns:
        the list of expired submissions to abandon
        Since:
        18.5.0
      • getSubmissionByKey

        public Submission getSubmissionByKey​(String submitKey)
        Return a submission with the specified surrogate key
        Parameters:
        submitKey - the surrogate key of an existing submission
        Returns:
        the matching submission
      • getSubmissionByEmailVerificationKey

        public Submission getSubmissionByEmailVerificationKey​(String emailKey)
        Return a submission with the specified email verification key.
        Parameters:
        emailKey - email verification key
        Returns:
        the matching submission
      • getSubmissionByReceiptNumber

        public Submission getSubmissionByReceiptNumber​(String receiptNumber)
                                                throws ApplicationException
        Return a submission with the specified receipt number
        Parameters:
        receiptNumber - the receipt number of an existing submission (required)
        Returns:
        the matching submission
        Throws:
        ApplicationException - if multiple submissions with the given receipt number were found
      • getSubmissionByTrackingNumber

        public Submission getSubmissionByTrackingNumber​(String trackingNumber)
                                                 throws ApplicationException
        Return a submission with the specified tracking number
        Parameters:
        trackingNumber - the tracking number of an existing submission (required)
        Returns:
        the matching submission
        Throws:
        ApplicationException - if multiple submissions with the given receipt number were found
        Since:
        4.0.0
      • hasTrackingNumberSubmission

        public boolean hasTrackingNumberSubmission​(String trackingNumber)
        Return true if there is a submission for the given tracking number.
        Parameters:
        trackingNumber - the tracking number to test
        Returns:
        true if there is a submission with the given tracking number
        Since:
        4.1.0
      • getSubmissionsByTransRefNumber

        public List<Submission> getSubmissionsByTransRefNumber​(String transRefNumber)
        Return the list of submissions matching the specified transaction reference number, ordered by PK.
        Parameters:
        transRefNumber - the transaction reference number
        Returns:
        the list of submissions matching the specified transaction reference number, ordered by PK.
        Since:
        3.6.0
      • getSubmissionByOfflineKey

        public Submission getSubmissionByOfflineKey​(String offlineSubmitKey)
        Return the submission with the given offline submit key
        Parameters:
        offlineSubmitKey - the offline submit key of the submission
        Returns:
        the matching submission
      • getSubmissionByKeyAndClient

        public Submission getSubmissionByKeyAndClient​(String clientKey,
                                                      String submitKey)
        Return a submission for the given submission and client surrogate keys. It is important to use both keys from a security perspective.
        Parameters:
        clientKey - the surrogate key of the client associated with the submission
        submitKey - the surrogate key of the submission
        Returns:
        the matching submission
      • getCompletedSubmissionsForUser

        public List<Submission> getCompletedSubmissionsForUser​(String keywordLike,
                                                               UserAccount userAccount,
                                                               Portal portal,
                                                               List<String> groupNames,
                                                               Set<Long> clientIdSet,
                                                               Integer fetchLimit)
        Provide the keyword search Submission History results based on the user own account or group access control. Only used by webservice api for externally managed group access
        Parameters:
        keywordLike - the keyword like to search
        userAccount - the logged in user account
        portal - the current portal
        groupNames - the list of group names for which to include submissions
        clientIdSet - the set of clients to filter on (optional; pass in null to skip client filtering)
        fetchLimit - the fetch limit (optional; if not specified, the default fetch limit will be used)
        Returns:
        the keyword search Submission History results
        Since:
        3.6.0
      • getCompletedSubmissionsForUser

        public List<Submission> getCompletedSubmissionsForUser​(String keywordLike,
                                                               UserAccount userAccount,
                                                               Portal portal,
                                                               boolean includeGroupSubmission)
        Provide the keyword search Submission History results based on the user own account or group access control.
        Parameters:
        keywordLike - the keyword like to search
        userAccount - the logged in user account
        portal - the current portal
        includeGroupSubmission - the include group submission
        Returns:
        the keyword search Submission History results
        Since:
        3.6.0
      • getCompletedSubmissionsForUser

        public List<Submission> getCompletedSubmissionsForUser​(UserAccount user,
                                                               String keyword,
                                                               String clientName,
                                                               String formNameLike,
                                                               Date fromDate,
                                                               Date toDate,
                                                               Portal portal,
                                                               Map<String,​String> submissionExtractDataSearch,
                                                               boolean includeGroupSubmission)
        Return the list of completed submissions for the given user. Only used in classic portal
        Parameters:
        user - the non-null user account object
        keyword - a keyword to search for in the receipt number (optional)
        clientName - the name of the client associated with the submission (optional)
        formNameLike - a substring of the name of the form associated with the submission (optional)
        fromDate - the lower bound on the time form completed (optional)
        toDate - the upper bound on the time form completed (optional)
        portal - the non-null portal that submissions must be associated with
        submissionExtractDataSearch - - obsolete filter parameter which is not supported
        includeGroupSubmission - the include group submission
        Returns:
        the list of matching submissions with form status Submission.STATUS_Completed
      • getSubmittedOrCompletedSubmissionsForUser

        public List<Submission> getSubmittedOrCompletedSubmissionsForUser​(UserAccount userAccount,
                                                                          Portal portal,
                                                                          List<String> groupNames,
                                                                          boolean includeGroupSubmission)
        Return the list of completed submissions for the given user. Used for field worker
        Parameters:
        userAccount - the non-null user account object
        portal - the non-null portal that submissions must be associated with
        groupNames - the list of group names for which to include submissions
        includeGroupSubmission - whether to include submissions made by other group members
        Returns:
        the list of matching submissions with form status Submission.STATUS_Completed
        Since:
        3.5.1
      • getCompletedSubmissionsForUserAndForms

        public List<Submission> getCompletedSubmissionsForUserAndForms​(UserAccount user,
                                                                       Collection<String> formCodes,
                                                                       Date fromDate,
                                                                       Date toDate,
                                                                       Portal portal,
                                                                       Map<String,​String> submissionExtractDataSearch,
                                                                       boolean includeGroupSubmission)
        Return the list of completed submissions for the given user. Only used by classic portal
        Parameters:
        user - the non-null user account object
        formCodes - the non-empty collection of form codes of forms associated with the submissions
        fromDate - the lower bound on the time form completed (optional)
        toDate - the upper bound on the time form completed (optional)
        portal - the non-null portal that submissions must be associated with
        submissionExtractDataSearch - a set of submission extract data key-value pairs tha submissions must contain (optional)
        includeGroupSubmission - the include group submission
        Returns:
        the list of matching submissions with form status Submission.STATUS_Completed
        Since:
        3.6.0
      • getMandatoryRequiredAttachments

        public List<RequiredAttachment> getMandatoryRequiredAttachments​(Submission submission)
        Return the list of mandatory required attachments for the given submission
        Parameters:
        submission - the non-null submission
        Returns:
        the list of mandatory required attachments
      • getOptionalRequiredAttachments

        public List<RequiredAttachment> getOptionalRequiredAttachments​(Submission submission)
        Return the list of optional required attachments for the given submission
        Parameters:
        submission - the non-null submission
        Returns:
        the list of optional required attachments
      • getSubmissionDeliveryList

        public List<Submission> getSubmissionDeliveryList​(String deliveryStatus,
                                                          String clientId,
                                                          String deliveryDetailsId,
                                                          String formCode,
                                                          String deliveryMessageLike,
                                                          Date startDate,
                                                          Date endDate,
                                                          int fetchLimit)
        Return a list of submissions which match the delivery criteria.
        Parameters:
        deliveryStatus - the delivery status (required)
        clientId - the selected client Id (optional)
        deliveryDetailsId - the associated client delivery details (optional)
        formCode - the associated form (optional)
        deliveryMessageLike - the delivery message like criteria (optional)
        startDate - the start date range (optional)
        endDate - the end date range (optional)
        fetchLimit - the maximum number of records to return
        Returns:
        a list of submissions which match the delivery criteria.
        Since:
        3.6.0
      • getSupportSearchList

        public List<Submission> getSupportSearchList​(String clientId,
                                                     String formId,
                                                     String portalId,
                                                     String refNumber,
                                                     String userOrEmail,
                                                     Boolean tasksInclude,
                                                     Boolean jobsInclude,
                                                     String formStatus,
                                                     String attachmentStatus,
                                                     String paymentStatus,
                                                     String signatureStatus,
                                                     String emailVerifStatus,
                                                     String receiptStatus,
                                                     String deliveryStatus,
                                                     Date startDate,
                                                     Date endDate,
                                                     int fetchLimit)
        Provides a Transaction Support Search query.
        Parameters:
        clientId - the client id (optional)
        formId - the form id (optional)
        portalId - the portal id (optional)
        refNumber - the ref number (optional)
        userOrEmail - the user login or contact email (optional)
        tasksInclude - filter to include or exclude form and review tasks (optional)
        jobsInclude - filter to include or exclude job transactions (optional)
        formStatus - the form status (optional)
        attachmentStatus - the attachment status (optional)
        paymentStatus - the payment status (optional)
        signatureStatus - the signature status (optional)
        emailVerifStatus - the email verification status (optional)
        receiptStatus - the receipt status (optional)
        deliveryStatus - the delivery status (optional)
        startDate - the start date (optional)
        endDate - the end date (optional)
        fetchLimit - the query fetch limit
        Returns:
        the support search transactions
        Since:
        4.3.2
      • getSavedSubmissionList

        public List<Submission> getSavedSubmissionList​(String genericSearchValue,
                                                       String clientId,
                                                       String portalId,
                                                       Integer transactionScore,
                                                       Date startDate,
                                                       Date endDate)
        Return the list of submission with a form status of 'Saved' which meet the specified criteria.
        Parameters:
        genericSearchValue - the generic search value (optional)
        clientId - the Client id (optional)
        portalId - the Portal id (optional)
        transactionScore - the transaction score (optional)
        startDate - the search start date (optional)
        endDate - the search end date (optional)
        Returns:
        the list of submission with a form status of 'Saved' which meet the specified criteria
        Since:
        4.0.0
      • getAbandonedSubmissionList

        public List<Submission> getAbandonedSubmissionList​(String genericSearchValue,
                                                           String clientId,
                                                           String portalId,
                                                           String abandonmentType,
                                                           Integer transactionScore,
                                                           Date startDate,
                                                           Date endDate)
        Return the list of submission with a form status of 'Abandoned' which meet the specified criteria.
        Parameters:
        genericSearchValue - the free text search value (optional)
        clientId - the Client id (optional)
        portalId - the Portal id (optional)
        abandonmentType - the abandonment type (optional)
        transactionScore - the transaction score (optional)
        startDate - the search start date (optional)
        endDate - the search end date (optional)
        Returns:
        the list of submission with a form status of 'Abandoned' which meet the specified criteria
        Since:
        4.0.0
      • getSubmissionList

        public List<Submission> getSubmissionList​(String keyword,
                                                  String clientId,
                                                  Date startDate,
                                                  Date endDate,
                                                  String formStatus,
                                                  String attachmentStatus,
                                                  String paymentStatus,
                                                  String emailVerificationStatus,
                                                  String deliveryStatus,
                                                  int offset,
                                                  int pageSize)
        Return the list of submissions matching the specified search criteria
        Parameters:
        keyword - the value entered into the generic search field
        clientId - the OID of the client associated with the submission (optional)
        startDate - the lower bound on the submission time (optional)
        endDate - the upper bound on the submission time (optional)
        formStatus - the form status, one of Submission.FORM_STATUS_VALUES (optional)
        attachmentStatus - the attachment status, one of Submission.ATTACHMENT_STATUS_VALUES (optional)
        paymentStatus - the payment status, one of Submission.PAYMENT_STATUS_VALUES (optional)
        emailVerificationStatus - the email verification status, one of Submission.EMAIL_VERIFICATION_STATUS_VALUES (optional)
        deliveryStatus - the delivery status, one of Submission.DELIVERY_STATUS_VALUES (optional)
        offset - the offset to be used in the query
        pageSize - the number of items to be returned
        Returns:
        the list of matching submissions
      • getTotalSubmissionCount

        public int getTotalSubmissionCount()
        Return the total number of submission entries, including "Opened" submissions.
        Returns:
        the total number of submission entries
      • getSubmissionSearchCount

        public int getSubmissionSearchCount()
        Return the number of submission entries, excluding "Opened" submissions
        Returns:
        the number of submission entries
        Since:
        4.0.0
      • getOpenedSubmissionCount

        public int getOpenedSubmissionCount()
        Return the number of opened submission entries
        Returns:
        the number of opened submission entries
        Since:
        4.1.0
      • getSavedSubmissionCount

        public int getSavedSubmissionCount()
        Return the number of saved submission entries
        Returns:
        the number of saved submission entries
      • getCompletedAbandonedSubmissionCount

        public int getCompletedAbandonedSubmissionCount()
        Gets the finished submission count (Completed or Abandoned).
        Returns:
        the finished submission count
        Since:
        3.6.0
      • getAbandonedSubmissionCount

        public int getAbandonedSubmissionCount​(String genericSearchValue,
                                               String clientId,
                                               Date startDate,
                                               Date endDate,
                                               String attachmentStatus,
                                               String paymentStatus,
                                               String emailVerificationStatus,
                                               String deliveryStatus,
                                               Integer transactionScore)
        Return the number of abandoned submissions matching the specified search criteria.
        Parameters:
        genericSearchValue - the value entered into the generic search field
        clientId - the OID of the client associated with the submission (optional)
        startDate - the lower bound on the submission time (optional)
        endDate - the upper bound on the submission time (optional)
        attachmentStatus - the attachment status, one of Submission.ATTACHMENT_STATUS_VALUES (optional)
        paymentStatus - the payment status, one of Submission.PAYMENT_STATUS_VALUES (optional)
        emailVerificationStatus - the email verification status, one of Submission.EMAIL_VERIFICATION_STATUS_VALUES (optional)
        deliveryStatus - the delivery status, one of Submission.DELIVERY_STATUS_VALUES (optional)
        transactionScore - the transaction score
        Returns:
        the number of matching submissions
        Since:
        4.0.0
      • getSubmissionsReadyForDelivery

        public List<Submission> getSubmissionsReadyForDelivery​(Client client)
        Return the list of submissions for a specified client that are ready to be delivered, ordered by submission time
        Parameters:
        client - the non-null client object
        Returns:
        the list of matching submissions
      • getSubmissionsReadyForWSDelivery

        public List<String> getSubmissionsReadyForWSDelivery​(Client client)
        Return the list of submissions that are ready for delivery via a web service delivery method
        Parameters:
        client - the non-null clients that submissions must belong to
        Returns:
        the list of matching submissions keys
        Since:
        4.0.0
      • getSubmissionsToReceipt

        public List<Submission> getSubmissionsToReceipt​(int fetchLimit,
                                                        int maxRenderAttempts)
        Return submissions that are ready for receipt generation, ordered by submission time.
        Parameters:
        fetchLimit - the maximum number of submissions to fetch
        maxRenderAttempts - the max render attempts
        Returns:
        the list of matching submissions
      • getToDoSubmissionsForUser

        public List<Submission> getToDoSubmissionsForUser​(UserAccount userAccount,
                                                          String keywordLike,
                                                          String clientName,
                                                          List<String> statusList,
                                                          Date fromDateTime,
                                                          Date toDateTime,
                                                          Portal portal,
                                                          boolean includeGroupSubmission)
        Return the list of incomplete submissions matching the specified search criteria. This method should only be invoked by the Classic Portal.
        Parameters:
        userAccount - the non-null user account object
        keywordLike - a keyword to search for in the receipt number (optional)
        clientName - the name of the client associated with the submission (optional)
        statusList - the set of form status values to search for (optional, defaults to saved and submitted submissions)
        fromDateTime - the lower bound on the submission time (optional)
        toDateTime - the upper bound on the submission time (optional)
        portal - the non-null portal that submissions must be associated with
        includeGroupSubmission - the include group submission
        Returns:
        the list of matching submissions that are saved or submitted
      • getPortalToDoSubmissionsForUser

        public List<Submission> getPortalToDoSubmissionsForUser​(UserAccount userAccount,
                                                                String keyword,
                                                                List<String> submissionStatusList,
                                                                Portal portal,
                                                                List<String> groupNames,
                                                                Set<Long> clientIdSet,
                                                                Integer fetchLimit)
        Gets the portal to do submissions for user. Only used for webservice api for groupNames are externally managed
        Parameters:
        userAccount - the user account
        keyword - the keyword
        submissionStatusList - the submission status list
        portal - the portal
        groupNames - the group names
        clientIdSet - the set of clients to filter on (optional; pass in null to skip client filtering)
        fetchLimit - the fetch limit (optional)
        Returns:
        the portal to do submissions for user
      • getPortalToDoSubmissionsForUser

        public List<Submission> getPortalToDoSubmissionsForUser​(UserAccount userAccount,
                                                                String keywordLike,
                                                                List<String> statusList,
                                                                Portal portal,
                                                                boolean includeGroupSubmission)
        Return the list of incomplete submissions matching the specified search criteria. Used by the new responsive portal
        Parameters:
        userAccount - the non-null user account object
        keywordLike - a keyword to search for in the receipt number (optional)
        statusList - the status list
        portal - the non-null portal that submissions must be associated with
        includeGroupSubmission - the include group submission
        Returns:
        the list of matching submissions that are saved or submitted
      • getSubmissionsSearch

        public List<Submission> getSubmissionsSearch​(String clientId,
                                                     String value)
        Return a list of submissions whose form name contain the search string, or whose OID, form OID or user OID matches the search string if it is numeric.
        Parameters:
        clientId - the OID of an existing client (optional)
        value - the search value (optional)
        Returns:
        the list of matching submissions
      • addProcessingStatus

        public ProcessingStatus addProcessingStatus​(Submission submission,
                                                    String status,
                                                    UserAccount user)
        Return a processing status entry to a submission.
        Parameters:
        submission - the submission to add the processing status update to (required)
        status - the new processing status value (required)
        user - the user account creating the processing status (optional)
        Returns:
        the new ProcessingStatus added to the submission
      • addProcessingStatusWithLoginName

        public ProcessingStatus addProcessingStatusWithLoginName​(Submission submission,
                                                                 String status,
                                                                 String loginName)
        Return a processing status entry to a submission.
        Parameters:
        submission - the submission to add the processing status update to (required)
        status - the new processing status value (required)
        loginName - the user account login name (optional)
        Returns:
        the new ProcessingStatus added to the submission
        Since:
        4.0.0
      • getRequiredPaymentSubmissionsCount

        public int getRequiredPaymentSubmissionsCount​(int hours,
                                                      Client client)
        Return a list of the n submissions with a Payment Status of "Required" which are older than a configurable period of time in days.
        Parameters:
        hours - the configurable period of time in hours
        client - the client
        Returns:
        the number of outstanding payment count
      • getLastSubmissionId

        public long getLastSubmissionId()
        Return the last submission id.
        Returns:
        the last submission id
      • getDraftsForUser

        public List<Submission> getDraftsForUser​(UserAccount userAccount,
                                                 Portal portal,
                                                 List<String> groupNames,
                                                 boolean includeGroupSubmission)
        Return the list of draft or 'Saved' submissions for a given user and portal. For field worker only.
        Parameters:
        userAccount - the user (required)
        portal - the portal
        groupNames - the list of group names for which to include draft submissions
        includeGroupSubmission - whether to include draft submissions made by other group members
        Returns:
        the list of draft or 'Saved' submissions for a given user and portal.
      • getAllSubmissionsByFilter

        @Deprecated
        public List<Submission> getAllSubmissionsByFilter​(String submissionQueryFilter,
                                                          String dateField,
                                                          Date cutoffDate)
        Deprecated.
        Gets the all submissions by filter.
        Parameters:
        submissionQueryFilter - the submission query filter
        dateField - the date field
        cutoffDate - the cutoff date
        Returns:
        the all submissions by filter
      • setPaymentStatusGuarded

        public void setPaymentStatusGuarded​(String submitKey,
                                            String newPaymentStatus,
                                            String oldPaymentStatus)
        Updates a submission status only if the current status matches the specified old status
        Parameters:
        submitKey - the submission to update
        newPaymentStatus - the new payment status
        oldPaymentStatus - the old payment status
      • copyRequiredAttachmentToSubmission

        public void copyRequiredAttachmentToSubmission​(RequiredAttachment requiredAttachment,
                                                       Submission targetSubmission)
        Copy the required attachment to the specified submission, cloning the associated attachment and file data. If the required attachment does not exist on the target submission it will be new required attachment will be created.
        Parameters:
        requiredAttachment - the required attachment to copy (required)
        targetSubmission - the submission to copy the required attachment to (required)
      • copyRequiredAttachmentToSubmission

        public void copyRequiredAttachmentToSubmission​(RequiredAttachment requiredAttachment,
                                                       Submission targetSubmission,
                                                       Document targetXmlDoc)
        Copy the required attachment to the specified submission, cloning the associated attachment and file data. If the required attachment does not exist on the target submission it will be new required attachment will be created.
        Parameters:
        requiredAttachment - the required attachment to copy (required)
        targetSubmission - the submission to copy the required attachment to (required)
        targetXmlDoc - the target submission form XML data document (optional)
        Since:
        4.1.0
      • copyAttachmentToSubmission

        public Attachment copyAttachmentToSubmission​(Attachment attachment,
                                                     Submission targetSubmission,
                                                     RequiredAttachment targetRA)
        Copy the attachment to the specified submission, cloning the file upload data.
        Parameters:
        attachment - the attachment to copy (required)
        targetSubmission - the submission to copy the attachment to (required)
        targetRA - the required attachment to associate the attachment with (optional)
        Returns:
        the new attachment
        Since:
        4.1.0
      • updateScheduledSaveAbandonTime

        public void updateScheduledSaveAbandonTime​(Submission submission)
        Sets the scheduled abandonment time for a saved submission.
        Parameters:
        submission - the submission (required)
        Since:
        4.3.3
      • getPurgeSubmissionIdList

        public List<Long> getPurgeSubmissionIdList​(int fetchLimit)
        Return the list of Submission ID to purge.
        Parameters:
        fetchLimit - the query fetch limit
        Returns:
        the list of Submission ID to purge
        Since:
        4.3.3
      • setPurgeDatesForSavedForms

        public void setPurgeDatesForSavedForms​(Submission submission)
        Deprecated.
        use updateScheduledSaveAbandonTime instead. This method may be removed in a future release.
        Sets the scheduled abandonment time for a saved submission.
        Parameters:
        submission - the submission (required)
        Since:
        4.1.0
      • setPurgeDateForSubmissionAndSavedAbandonedData

        @Deprecated
        public void setPurgeDateForSubmissionAndSavedAbandonedData​(Submission submission)
        Deprecated.
        This method has been deprecated, please use updateScheduledSaveAbandonTime.
        Parameters:
        submission - deprecated
      • setPurgeDeliveredDate

        @Deprecated
        public void setPurgeDeliveredDate​(Submission submission)
        Deprecated.
        This method has been deprecated, please use setPurgeDatesForDeliveredAbandonedForms.
        Parameters:
        submission - the new purge delivered date
      • setPurgeDatesForDeliveredAbandonedForms

        public void setPurgeDatesForDeliveredAbandonedForms​(Submission submission)
        Sets the submission data purge date for finished (Completed or Abandoned) form data.
        Parameters:
        submission - the new purge delivered date
        Since:
        4.1.0
      • updatePurgeTime

        @Deprecated
        public void updatePurgeTime​(Submission submission)
        Deprecated.
        Sets the purge time for a finished submission.
        Parameters:
        submission - the submission (required, must be of form status "Completed" or "Abandoned")
        Since:
        4.3.3
      • recalcPurgeSubmissionTime

        public void recalcPurgeSubmissionTime​(int ageOfDays)
        Recalc purge data time.
        Parameters:
        ageOfDays - the age of days
      • recalcSaveAbandonTime

        public void recalcSaveAbandonTime​(Long formId,
                                          Long clientId,
                                          int maxAgeInDays)
        Recalculate save abandon scheduled times after a policy change on the form, organization or system level.
        Parameters:
        formId - the form id (optional; if not set, clientId will be considered)
        clientId - the client id (optional; if neither formId nor clientId is set, it is assumed that the system policy has changed)
        maxAgeInDays - the maximum age of saved submissions in days before they will be abandoned
        Since:
        4.3.3
      • recalcPurgeDeliveredDataTime

        public void recalcPurgeDeliveredDataTime​(Long clientId,
                                                 int ageOfDays)
        Recalc purge delivered data time.
        Parameters:
        clientId - the client id
        ageOfDays - the age of days
      • recalcDeliveredSubmissionRetentionTimeForForm

        public void recalcDeliveredSubmissionRetentionTimeForForm​(Form form,
                                                                  int maxDeliveredSubmissionAgeDays)
        Recalculate purge time for delivered submissions of a form.
        Parameters:
        form - the form for which retention settings have changed (required)
        maxDeliveredSubmissionAgeDays - the new maximum delivered submission age in days
        Since:
        4.1.0
      • iterateOverSubmissionsWithOverdueEmailVerification

        public void iterateOverSubmissionsWithOverdueEmailVerification​(Form form,
                                                                       Date submittedBefore,
                                                                       org.apache.cayenne.ResultIteratorCallback<Submission> op)
        Iterates over the list of submissions for which email verification is overdue (i.e. the user has not responded and the timeout has been exceeded). Note that the queries are form based as timeout settings are configured on a form level.
        Parameters:
        form - the form (required)
        submittedBefore - the cutoff date for the submission time (required); submissions older than this are considered overdue
        op - an operation to apply to each submission.
      • iterateOverSubmissionsForEmailVerificationReminders

        public void iterateOverSubmissionsForEmailVerificationReminders​(Form form,
                                                                        Date lastReminderSentBefore,
                                                                        int maxAttempts,
                                                                        org.apache.cayenne.ResultIteratorCallback<Submission> op)
        Iterates over the list of submissions for which an email verification reminder needs to be sent (i.e. the user has not responded, we have not reached the maximum number of emails to send and the reminder interval has passed since the last email was sent). Note that the queries are form based as number of attempts and the reminder interval are configured on a form level.
        Parameters:
        form - the form (required)
        lastReminderSentBefore - the cutoff date for the email verification email (required); submissions with times older than this may need a reminder now
        maxAttempts - the maximum number of emails to send (required); if as many or more reminders were already sent, the submission will be excluded
        op - an operation to be invoked on each object during iteration.
      • getAssignedTasksForUser

        public List<Submission> getAssignedTasksForUser​(UserAccount userAccount,
                                                        Portal portal,
                                                        int maxNumber,
                                                        boolean includeGroupTasks)
        Get the list of assigned task submissions for the specified user and portal. Assigned tasks include transactions with the status: [ Assigned | Opened | Saved | Submitted ]. This method is called by the FieldWorker Sync Rest Service.
        Parameters:
        userAccount - the user account
        portal - the portal
        maxNumber - the max number
        includeGroupTasks - the include tasks assigned to groups the user belongs to
        Returns:
        the list of task submissions assigned to the user, ordered by scheduled timestamp and then creation timestamp
      • getAssignedTaskCountForUser

        public int getAssignedTaskCountForUser​(UserAccount userAccount,
                                               Portal portal,
                                               boolean includeGroupTasks)
        Get the number of assigned task submissions for the specified user and portal.
        Parameters:
        userAccount - the user account
        portal - the portal
        includeGroupTasks - the include tasks assigned to groups the user belongs to
        Returns:
        the total field worker tasks count for user
      • getTaskByKey

        public Submission getTaskByKey​(String taskKey)
        Return the submission with the specified task key.
        Parameters:
        taskKey - the task key (required)
        Returns:
        the matching submission, or null if not found
        Since:
        4.0.0
      • getTaskSubmissionsToAbandon

        public List<Submission> getTaskSubmissionsToAbandon​(int fetchLimit)
        Return the list of Assigned and Opened Tasks, without expiry or associated Job which can be abandoned.
        Parameters:
        fetchLimit - the query fetch limit
        Returns:
        the list of matching task submissions
        Since:
        18.5.0
      • getExpiredTasksRequiringAbandonment

        public List<Submission> getExpiredTasksRequiringAbandonment​(int fetchLimit)
        Returns the list of tasks which have been 'Expired' and data deleted but have no purge time set.
        Returns:
        the list of tasks which have been 'Expired' and data deleted but have no purge time set.
        Since:
        18.5.0
      • getAbandonedLegacyTasks

        public List<Submission> getAbandonedLegacyTasks​(int fetchLimit)
        Returns:
        the list of legacy tasks which have been 'Abandoned' but have no purge time set.
        Since:
        18.5.0
      • getAbandonedLegacyTransactions

        public List<Submission> getAbandonedLegacyTransactions​(int fetchLimit)
        Returns:
        the list of legacy transactions which have been 'Abandoned' but have no purge time set.
        Since:
        18.5.0
      • getTaskSubmissionList

        public List<Submission> getTaskSubmissionList​(String clientId,
                                                      String keyword,
                                                      String type,
                                                      String status,
                                                      Date startDate,
                                                      Date endDate)
        Return the list of task submissions matching the specified search criteria
        Parameters:
        clientId - the OID of the client to filter on (optional)
        keyword - the keyword search (optional)
        type - the submission task type, one of Submission.TASK_TYPE_VALUES (optional)
        status - the form status, one of Submission.TASK_STATUS_VALUES (optional)
        startDate - the lower bound on the task creation time (optional)
        endDate - the upper bound on the task creation time (optional)
        Returns:
        the list of matching task submissions
      • getTaskSubmissionList

        public List<Submission> getTaskSubmissionList​(String clientId,
                                                      String keyword,
                                                      String type,
                                                      String status,
                                                      Date startDate,
                                                      Date endDate,
                                                      int pageSize,
                                                      int fetchLimit)
        Return the list of task submissions matching the specified search criteria
        Parameters:
        clientId - the OID of the client to filter on (optional)
        keyword - the keyword search (optional)
        type - the submission task type, one of Submission.TASK_TYPE_VALUES (optional)
        status - the form status, one of Submission.TASK_STATUS_VALUES (optional)
        startDate - the lower bound on the task creation time (optional)
        endDate - the upper bound on the task creation time (optional)
        pageSize - the query page size
        fetchLimit - the query fetch limit
        Returns:
        the list of matching task submissions
      • getSubmissionTrendData

        public List<SubmissionTrendBean> getSubmissionTrendData​(Long clientId,
                                                                String portalId,
                                                                Collection<TemplateVersion> versions,
                                                                String deviceType,
                                                                String periodType,
                                                                boolean excludeJobsTasks,
                                                                Date startDate,
                                                                Date endDate)
        Return live submission trend data for a time period and period type and optionally a specific form version. Note: Test data is included. Submissions may be counted multiple times (e.g. if multiple saves occur). The data is intended to measure user activity.
        Parameters:
        clientId - the OID of the selected client (optional)
        portalId - the OID of the selected portal (optional)
        versions - the form versions to filter on (optional)
        deviceType - the device type to filter on (optional; one of UserAgentInfo.DEVICE_TYPES)
        excludeJobsTasks - exclude job and task transactions (optional)
        periodType - the period type (required, must be DataUtils.PERIOD_TYPE_DAY or DataUtils.PERIOD_TYPE_HOUR)
        startDate - the start date/time (required)
        endDate - the end date/time (required)
        Returns:
        the list of trend data for the selected period, with an entry for each hour / day, sorted ascending by date
      • getSubmissionTrendData

        @Deprecated
        public List<SubmissionTrendBean> getSubmissionTrendData​(Long clientId,
                                                                String portalId,
                                                                Collection<TemplateVersion> versions,
                                                                String deviceType,
                                                                String periodType,
                                                                Date startDate,
                                                                Date endDate)
        Deprecated.
        Return live submission trend data for a time period and period type and optionally a specific form version. Note: Test data is included. Submissions may be counted multiple times (e.g. if multiple saves occur). The data is intended to measure user activity. Note: Job & Tasks are excluded
        Parameters:
        clientId - the OID of the selected client (optional)
        portalId - the OID of the selected portal (optional)
        versions - the form versions to filter on (optional)
        deviceType - the device type to filter on (optional; one of UserAgentInfo.DEVICE_TYPES)
        periodType - the period type (required, must be DataUtils.PERIOD_TYPE_DAY or DataUtils.PERIOD_TYPE_HOUR)
        startDate - the start date/time (required)
        endDate - the end date/time (required)
        Returns:
        the list of trend data for the selected period, with an entry for each hour / day, sorted ascending by date
        Since:
        4.1.0
      • getSubmissionSummaryData

        public SubmissionSummaryBean getSubmissionSummaryData​(Long clientId,
                                                              String portalId,
                                                              Collection<TemplateVersion> versions,
                                                              boolean excludeJobsTasks,
                                                              Date startDate,
                                                              Date endDate)
        Return live submission summary data for a time period. Note: Test data is included. Submissions may be counted multiple times (e.g. if multiple saves occur). The data is intended to measure user activity.
        Parameters:
        clientId - the OID of the selected client (optional)
        portalId - the OID of selected portal (optional)
        versions - the list of form versions to filter on (optional)
        excludeJobsTasks - exclude job and task transactions (optional)
        startDate - the start date/time (required)
        endDate - the end date/time (required)
        Returns:
        summary data for the selected period
      • getSubmissionSummaryData

        @Deprecated
        public SubmissionSummaryBean getSubmissionSummaryData​(Long clientId,
                                                              String portalId,
                                                              Collection<TemplateVersion> versions,
                                                              Date startDate,
                                                              Date endDate)
        Deprecated.
        Return live submission summary data for a time period. Note: Test data is included. Submissions may be counted multiple times (e.g. if multiple saves occur). The data is intended to measure user activity. Note: Excludes jobs & tasks
        Parameters:
        clientId - the OID of the selected client (optional)
        portalId - the OID of selected portal (optional)
        versions - the list of form versions to filter on (optional)
        startDate - the start date/time (required)
        endDate - the end date/time (required)
        Returns:
        summary data for the selected period
        Since:
        4.1.0
      • getSubmissionOverviewData

        public List<SubmissionTrendBean> getSubmissionOverviewData​(Long clientId,
                                                                   String portalId,
                                                                   Collection<TemplateVersion> versions,
                                                                   String deviceType,
                                                                   boolean excludeJobsTasks,
                                                                   String periodType,
                                                                   Date startDate,
                                                                   Date endDate)
        Return live submission overview data for a time period. Note: Test data is included. Submissions may be counted multiple times. The data is intended to measure user activity.
        Parameters:
        clientId - the OID of the selected client (optional)
        portalId - the OID of the selected portal (optional)
        versions - the list of form versions to filter on (optional)
        deviceType - the device type to filter on (optional; one of UserAgentInfo.DEVICE_TYPES)
        excludeJobsTasks - exclude job and task transactions (optional)
        periodType - the period type to group by (DataUtils.PERIOD_TYPE_HOUR or DataUtils.PERIOD_TYPE_DAY)
        startDate - the start date/time (required)
        endDate - the end date/time (required)
        Returns:
        trend data for the selected period
      • getSubmissionOverviewData

        @Deprecated
        public List<SubmissionTrendBean> getSubmissionOverviewData​(Long clientId,
                                                                   String portalId,
                                                                   Collection<TemplateVersion> versions,
                                                                   String deviceType,
                                                                   String periodType,
                                                                   Date startDate,
                                                                   Date endDate)
        Deprecated.
        Return live submission overview data for a time period. Note: Test data is included. Submissions may be counted multiple times. The data is intended to measure user activity. Note: excludes jobs & Tasks
        Parameters:
        clientId - the OID of the selected client (optional)
        portalId - the OID of the selected portal (optional)
        versions - the list of form versions to filter on (optional)
        deviceType - the device type to filter on (optional; one of UserAgentInfo.DEVICE_TYPES)
        periodType - the period type to group by (DataUtils.PERIOD_TYPE_HOUR or DataUtils.PERIOD_TYPE_DAY)
        startDate - the start date/time (required)
        endDate - the end date/time (required)
        Returns:
        trend data for the selected period
        Since:
        4.1.0
      • safelyAbandonSubmission

        public boolean safelyAbandonSubmission​(Long submissionId,
                                               String currentFormStatus,
                                               String abandonmentType,
                                               String deliveryStatus)
        Safely mark a submission as abandoned. This method uses a named query that does a conditional update, avoiding race conditions with other threads updating the submission.
        Parameters:
        submissionId - the OID of the submission to be abandoned (required)
        currentFormStatus - the form status value the submission must be in for abandonment to be performed (required, should be the current known form status)
        abandonmentType - the desired abandonment type (required)
        deliveryStatus - the new delivery status (optional, currently used only to mark submission as undeliverable)
        Returns:
        true if the submission was abandoned, false otherwise
        Since:
        4.1.0
      • safelySetSubmissionIneligible

        public boolean safelySetSubmissionIneligible​(Long submissionId,
                                                     String currentFormStatus,
                                                     String deliveryStatus)
        Safely mark a submission as abandoned due to ineligibility of the user. This method uses a named query that does a conditional update, avoiding race conditions with other threads updating the submission.
        Parameters:
        submissionId - the OID of the submission to be abandoned (required)
        currentFormStatus - the form status value the submission must be in for abandonment to be performed (required, should be the current known form status)
        deliveryStatus - the new delivery status (optional, currently used only to mark submission as undeliverable)
        Returns:
        true if the submission was abandoned and marked as ineligible, false otherwise
        Since:
        5.1.0
      • getHelpDeskSubmissions

        public List<Submission> getHelpDeskSubmissions​(Portal portal,
                                                       String keyword,
                                                       String formStatus,
                                                       Date startDate,
                                                       boolean includeAnonymousSubmissions,
                                                       boolean includeAuthenticatedSubmissions)
        Return a the list help desk submission.
        Parameters:
        portal - the portal associated with the submissions (optional)
        keyword - the search keyword (optional)
        formStatus - the form status (optional)
        startDate - the search start date (optional)
        includeAnonymousSubmissions - the include anonymous submissions option
        includeAuthenticatedSubmissions - the include authenticated submissions option
        Returns:
        the list help desk submission for the given search criteria
        Since:
        4.2.0
      • getDocusignMapPendingSubmission

        public Map<String,​Long> getDocusignMapPendingSubmission()
        Queries for outstanding DocuSign transactions and returns a Map linking the a DocuSign envelopeId to a SubmissionId
        Returns:
        a Map linking a DocuSign envelopeId to a SubmissionId
        Since:
        4.3.4
      • getJobDeliveryCompleteSubmissions

        public List<Submission> getJobDeliveryCompleteSubmissions()
        Returns the submissions that are marked delivery completed and have jobDeliveryRequiredFlag set to true.
        Returns:
        the submissions that have delivery completed but have not been processed by collaboration jobs.
        Since:
        20.11.0