Class TransactionHistoryDao


public class TransactionHistoryDao extends AbstractDao
Provides a DAO for the TransactionHistory entity.
Since:
4.0.0
See Also:
  • Field Details

    • KEY_CLIENT_ID

      public static final String KEY_CLIENT_ID
      The key for the client identifier used in the map returned by getClientsFromRequestLogMetrics
      See Also:
    • KEY_CLIENT_CODE

      public static final String KEY_CLIENT_CODE
      The key for the client code used in the map returned by getClientsFromRequestLogMetrics
      See Also:
  • Constructor Details

    • TransactionHistoryDao

      public TransactionHistoryDao()
  • Method Details

    • getTransactionCompletedCount

      public int getTransactionCompletedCount(Date startDate, Date endDate, Long clientId)
      Return the completed transaction count between the specified days, client and for the current user client access.
      Parameters:
      startDate - the query start date (required)
      endDate - the query end date (required)
      clientId - the selected client id (optional)
      Returns:
      the completed transaction count between the specified days for the current user client access.
      Since:
      4.3.4
    • hasTrackingNumberTransaction

      public boolean hasTrackingNumberTransaction(String trackingNumber)
      Return true if there is a transaction for the given tracking number.
      Parameters:
      trackingNumber - the tracking number to test
      Returns:
      true if there is a transaction_history with the given tracking number
      Since:
      4.3.2
    • getHistoryBySubmitKey

      public List<TransactionHistory> getHistoryBySubmitKey(String submitKey)
      Gets the history by submit key.
      Parameters:
      submitKey - the submit key
      Returns:
      the history by submit key
    • getRequestsByMonth

      public List<Map<String,Object>> getRequestsByMonth(String clientCode, String formCode, Date startDate, Date endDate, boolean includeTestData)
      Return information about the requests made during a specified period, grouped by month
      Parameters:
      clientCode - the client code associated with the request log (optional)
      formCode - the form code associated with the request log (optional)
      startDate - the lower bound on the request time
      endDate - the upper bound on the request time
      includeTestData - whether to include test requests
      Returns:
      a list of DataRow objects containing data for one month each
    • getRefererSubmissions

      public List getRefererSubmissions(String clientCode, String portalName, String formCode, String deviceType, String status, boolean excludeJobsTasks, Date startDate, Date endDate)
      Return the number of submissions for each referer header value for the specified client, form and date range.
      Parameters:
      clientCode - the client code (optional)
      portalName - the portal name (optional)
      formCode - the form code (optional)
      deviceType - the device type (optional)
      status - the status
      excludeJobsTasks - exclude job and task transactions (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      Returns:
      the referer header values and the number of submissions for each of them
    • getRefererSubmissions

      @Deprecated public List getRefererSubmissions(String clientCode, String portalName, String formCode, String deviceType, String status, Date startDate, Date endDate)
      Deprecated.
      Return the number of submissions for each referer header value for the specified client, form and date range. Excludes job tasks
      Parameters:
      clientCode - the client code (optional)
      portalName - the portal name (optional)
      formCode - the form code (optional)
      deviceType - the device type (optional)
      status - the status
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      Returns:
      the referer header values and the number of submissions for each of them
    • getFormsFromSubmissionMetrics

      public List<TransactionHistoryDao.FormCodeName> getFormsFromSubmissionMetrics(String clientCode)
      Return the list of distinct forms (form name, form code) for the set of submission metrics.
      Parameters:
      clientCode - the client code to filter by (required)
      Returns:
      the set of distinct form codes and form names
    • getSubmissionsByMonth

      public List<Map<String,Object>> getSubmissionsByMonth(String clientCode, String formCode, Date startDate, Date endDate, boolean includeTestData)
      Return information about the submissions made during a specified period, grouped by month
      Parameters:
      clientCode - the client code associated with the submission (optional)
      formCode - the form code associated with the submission (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      includeTestData - whether to include submissions in test mode
      Returns:
      a list of DataRow objects containing data for one month each
    • getSubmissionsByForm

      public List<Map<String,Object>> getSubmissionsByForm(String clientCode, Date startDate, Date endDate, boolean excludeJobsTasks, boolean includeTestData)
      Return the number of submissions by form for a specific client and date range
      Parameters:
      clientCode - the client code associated with the submissions (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      excludeJobsTasks - exclude job and task transactions (optional)
      includeTestData - whether to include submissions in test mode
      Returns:
      a list of entries containing form code, form name and number of submissions
    • getReaderSubmissions

      public List getReaderSubmissions(String clientCode, Date startDate, Date endDate, boolean excludeJobsTasks, boolean includeTestData, String formCode)
      Return the number of submissions per Adobe Reader version for the specified client, form and date range
      Parameters:
      clientCode - the client code (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      excludeJobsTasks - exclude job and task transactions (optional)
      includeTestData - whether to include submissions in test mode
      formCode - the form code (optional)
      Returns:
      the Adobe Reader versions and the number of submissions for each of them
    • getReaderSubmissions

      @Deprecated public List getReaderSubmissions(String clientCode, Date startDate, Date endDate, boolean includeTestData, String formCode)
      Deprecated.
      Return the number of submissions per Adobe Reader version for the specified client, form and date range Note: excludes jobs invalid input: '&' tasks
      Parameters:
      clientCode - the client code (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      includeTestData - whether to include submissions in test mode
      formCode - the form code (optional)
      Returns:
      the Adobe Reader versions and the number of submissions for each of them
    • getSubmissionBrowsers

      public List getSubmissionBrowsers(String clientCode, String formCode, String status, boolean excludeJobsTasks, Date startDate, Date endDate)
      Return information about the submissions made during a specified period, grouped by browser type and version.
      Parameters:
      clientCode - the client code associated with the submission (optional)
      formCode - the form code associated with the submission (optional)
      status - the status
      excludeJobsTasks - exclude job and task transactions (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      Returns:
      a list of DataRow objects
    • getSubmissionBrowsers

      @Deprecated public List getSubmissionBrowsers(String clientCode, String formCode, String status, Date startDate, Date endDate)
      Deprecated.
      Return information about the submissions made during a specified period, grouped by browser type and version.
      Parameters:
      clientCode - the client code associated with the submission (optional)
      formCode - the form code associated with the submission (optional)
      status - the status
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      Returns:
      a list of DataRow objects
    • getSubmissionOperatingSystems

      public List getSubmissionOperatingSystems(String clientCode, String formCode, String status, boolean excludeJobsTasks, Date startDate, Date endDate)
      Return information about the submissions made during a specified period, grouped by operating system type and version.
      Parameters:
      clientCode - the client code associated with the submission (optional)
      formCode - the form code associated with the submission (optional)
      status - the status
      excludeJobsTasks - exclude job and task transactions (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      Returns:
      a list of DataRow objects
    • getSubmissionOperatingSystems

      @Deprecated public List getSubmissionOperatingSystems(String clientCode, String formCode, String status, Date startDate, Date endDate)
      Deprecated.
      Return information about the submissions made during a specified period, grouped by operating system type and version. Note: excludes jobs invalid input: '&' tasks
      Parameters:
      clientCode - the client code associated with the submission (optional)
      formCode - the form code associated with the submission (optional)
      status - the status
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      Returns:
      a list of DataRow objects
    • getTransactionHistoryList

      public List<TransactionHistory> getTransactionHistoryList(String genericSearchValue, String clientId, String formStatus, String formAbandonmentType, String timeProperty, Date startDate, Date endDate, int pageSize, int fetchLimit)
      Retrieve the list of transaction history entries matching a set of search criteria
      Parameters:
      genericSearchValue - the value of a generic search field (optional; will be used to match submission OID, receipt number, tracking code, submit key or form code)
      clientId - the OID of the client to filter on (optional; note that client restrictions for the current user will be automatically applied)
      formStatus - the form status (optional; one of Submission.STATUS_Abandoned and Submission.STATUS_Completed)
      formAbandonmentType - the transaction form abandonment type (optional)
      timeProperty - the time property (required)
      startDate - the lower bound on the request time (optional)
      endDate - the upper bound on the request time (optional)
      pageSize - the query page size
      fetchLimit - the query fetch limit
      Returns:
      the matching list of transaction history entries, limited to 10000 results
      Since:
      4.3.2
    • getSubmissionCompletedOsCount

      public List<TransactionHistoryDao.OsCount> getSubmissionCompletedOsCount(Long clientId, String portalName, String formCode, String deviceType, Boolean excludeJobsTasks, Date startDate, Date endDate)
      Return the completed transaction operating system counts for the specified filter criteria. Excludes task transactions.
      Parameters:
      clientId - the OID of the selected client (optional)
      portalName - the selected portal name (optional)
      formCode - the form to filter on (optional)
      deviceType - the deviceType (optional)
      excludeJobsTasks - exclude job and task transactions (optional)
      startDate - the start date/time (required)
      endDate - the end date/time (required)
      Returns:
      the completed transaction device counts for the specified filter criteria.
      Since:
      4.1.0
    • getSubmissionCompletedBrowserCount

      public List<TransactionHistoryDao.BrowserCount> getSubmissionCompletedBrowserCount(Long clientId, String portalName, String formCode, String deviceType, Boolean excludeJobsTasks, Date startDate, Date endDate)
      Return the completed transaction browser counts for the specified filter criteria. Excludes task transactions.
      Parameters:
      clientId - the OID of the selected client (optional)
      portalName - the selected portal name (optional)
      formCode - the form to filter on (optional)
      deviceType - the deviceType (optional)
      excludeJobsTasks - exclude job and task transactions (optional)
      startDate - the start date/time (required)
      endDate - the end date/time (required)
      Returns:
      the completed transaction browser counts for the specified filter criteria.
      Since:
      4.3.4
    • getCompletedDeviceCount

      public List<TransactionHistoryDao.DeviceCount> getCompletedDeviceCount(Long clientId, String portalName, String formCode, String deviceType, Boolean excludeJobsTasks, Date startDate, Date endDate)
      Return the completed transaction device counts for the specified filter criteria. Excludes task transactions.
      Parameters:
      clientId - the OID of the selected client (optional)
      portalName - the selected portal name (optional)
      formCode - the form to filter on (optional)
      deviceType - the device type (optional)
      excludeJobsTasks - exclude job and task transactions (optional)
      startDate - the start date/time (required)
      endDate - the end date/time (required)
      Returns:
      the completed transaction device counts for the specified filter criteria.
      Since:
      4.3.2
    • getSubmissionTrendData

      public List<SubmissionTrendBean> getSubmissionTrendData(Long clientId, String portalName, String formCode, String deviceType, Boolean excludeJobsTasks, Date startDate, Date endDate)
      Return submission trend data with a view on the conversion rate for a time period and period type and optionally a specific client and form. Excludes task transactions.
      Parameters:
      clientId - the OID of the selected client (optional)
      portalName - the selected portal name (optional)
      formCode - the form to filter on (optional)
      deviceType - the device type to filter on (optional; one of UserAgentInfo.DEVICE_TYPES)
      excludeJobsTasks - exclude job and task transactions (optional)
      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
    • getMedianTimeToSubmitSec

      public long getMedianTimeToSubmitSec(Long clientId, String portalName, String formCode, String deviceType, Boolean excludeJobsTasks, Date startDate, Date endDate)
      Return the median time to submit in seconds. Excludes task transactions.
      Parameters:
      clientId - the OID of the selected client (optional)
      portalName - the portal name selected (optional)
      formCode - the form to filter on (optional)
      deviceType - the device type to filter on (optional; one of UserAgentInfo.DEVICE_TYPES)
      excludeJobsTasks - exclude job and task transactions (optional)
      startDate - the start date/time (required)
      endDate - the end date/time (required)
      Returns:
      the median time to submit in seconds
      Since:
      4.1.0
    • markAsDwhPublished

      public void markAsDwhPublished(Collection transactionHistoryIdSet)
      Updates a set of transaction history entries to have been published to a data warehouse (status is set to "Completed", publish time is set to the current time).
      Parameters:
      transactionHistoryIdSet - the collection of transaction history OIDs that need to be marked as published (required)
      Since:
      4.3.4
    • getDataRowList

      public List<org.apache.cayenne.DataRow> getDataRowList(Long clientId, String portalName, String formCode, String deviceType, Boolean excludeJobsTasks, Date startDate, Date endDate)
      Return data rows list for the given search criteria. Excludes task transactions.
      Parameters:
      clientId - the OID of the selected client (optional)
      portalName - the selected portal name (optional)
      formCode - the form to filter on (optional)
      deviceType - the device type to filter on (optional; one of UserAgentInfo.DEVICE_TYPES)
      excludeJobsTasks - exclude job and task transactions (optional)
      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.3.4
    • purgeTransactionHistory

      public int purgeTransactionHistory(int maxAgeDays, int fetchLimit, long maxTimeMs)
      Delete transaction history records older than a specified number of days
      Parameters:
      maxAgeDays - The age in days above which records will be deleted. If this value is negative or equal to 0, no records will be purged.
      fetchLimit - the maximum number of records to purge
      maxTimeMs - the maximum time that can be used to purge records
      Returns:
      the number of records that were deleted
    • getCompletedDeviceCount

      @Deprecated public List<TransactionHistoryDao.DeviceCount> getCompletedDeviceCount(Long clientId, String portalName, String formCode, Date startDate, Date endDate)
      Deprecated.
      Return the completed transaction device counts for the specified filter criteria.
      Parameters:
      clientId - the OID of the selected client (optional)
      portalName - the selected portal name (optional)
      formCode - the form to filter on (optional)
      startDate - the start date/time (required)
      endDate - the end date/time (required)
      Returns:
      the completed transaction device counts for the specified filter criteria.
      Since:
      4.1.0
    • getClientsFromRequestLogMetrics

      @Deprecated public List<Map<String,Object>> getClientsFromRequestLogMetrics()
      Deprecated.
      Return the list of distinct clients for the set of request log metrics. Note: A previous implementation used to return client OID and code. As we don't want to use the client OID, we are duplicating the client code as the ID for use in the Flex implementation. Also note that we are assuming that it is sufficient to obtain the list of clients from the set of RequestLogMetrics alone (ignoring SubmissionMetrics). That is not strictly true in all cases, but should be a reasonable approximation.
      Returns:
      the set of distinct client codes, stored in the map in both "id" and "clientCode" keys
    • getFormRequestCount

      @Deprecated public int getFormRequestCount(Form form)
      Deprecated.
      Return the number of form render requests for the given form.
      Parameters:
      form - the form
      Returns:
      the number of form requests for the given form.
    • getFormRequestCount

      @Deprecated public int getFormRequestCount(Client client)
      Deprecated.
      Return the number of form render requests for the specified client if, or all forms if no client defined.
      Parameters:
      client - the client
      Returns:
      the number of form requests for the given form.
    • getFormAvgTimeToSubmit

      @Deprecated public Integer getFormAvgTimeToSubmit(Form form)
      Deprecated.
      Return average form time in seconds to submission for the specified form.
      Parameters:
      form - the form to query
      Returns:
      the average time in seconds to submission, or -1 if undefined
    • getTimeToSubmissions

      @Deprecated public List getTimeToSubmissions(String clientCode, String formCode, Date startDate, Date endDate, String period, String submissionOS, String submissionBrowser)
      Deprecated.
      Return information about the time to submissions made during a specified period
      Parameters:
      clientCode - the client code associated with the submission (optional)
      formCode - the form code associated with the submission (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      period - one of "Hourly", "Daily", "Weekly", "Monthly"
      submissionOS - the OS type to filter by (optional)
      submissionBrowser - the browser type to filter by (optional)
      Returns:
      a list of DataRow objects
    • getConversionInfo

      @Deprecated public List getConversionInfo(String clientCode, String formCode, Date startDate, Date endDate, boolean includeTestData)
      Deprecated.
      Return information about the submissions made during a specified period, grouped by browser type and version
      Parameters:
      clientCode - the client code associated with the submission (optional)
      formCode - the form code associated with the submission (optional)
      startDate - the lower bound on the submission time
      endDate - the upper bound on the submission time
      includeTestData - whether to include submissions in test mode
      Returns:
      a list of DataRow objects
    • getTransactionHistoryList

      @Deprecated public List<TransactionHistory> getTransactionHistoryList(String genericSearchValue, String clientId, String formStatus, Date startDate, Date endDate)
      Deprecated.
      Retrieve the list of transaction history entries matching a set of search criteria
      Parameters:
      genericSearchValue - the value of a generic search field (optional; will be used to match submission OID, receipt number, tracking code, submit key or form code)
      clientId - the OID of the client to filter on (optional; note that client restrictions for the current user will be automatically applied)
      formStatus - the form status (optional; one of Submission.STATUS_Abandoned and Submission.STATUS_Completed)
      startDate - the lower bound on the request time (optional)
      endDate - the upper bound on the request time (optional)
      Returns:
      the matching list of transaction history entries, limited to 10000 results
      Since:
      4.0.9
    • getTransactionHistoryList

      public List<TransactionHistory> getTransactionHistoryList(String genericSearchValue, String clientId, String formStatus, String formAbandonmentType, Date startDate, Date endDate, int pageSize, int fetchLimit)
      Retrieve the list of transaction history entries matching a set of search criteria
      Parameters:
      genericSearchValue - the value of a generic search field (optional; will be used to match submission OID, receipt number, tracking code, submit key or form code)
      clientId - the OID of the client to filter on (optional; note that client restrictions for the current user will be automatically applied)
      formStatus - the form status (optional; one of Submission.STATUS_Abandoned and Submission.STATUS_Completed)
      formAbandonmentType - the transaction form abandonment type (optional)
      startDate - the lower bound on the request time (optional)
      endDate - the upper bound on the request time (optional)
      pageSize - the query page size
      fetchLimit - the query fetch limit
      Returns:
      the matching list of transaction history entries, limited to 10000 results
      Since:
      4.3.2
    • getTransactionHistoryList

      @Deprecated public List<TransactionHistory> getTransactionHistoryList(String genericSearchValue, String clientId, String formStatus, Date startDate, Date endDate, int pageSize, int fetchLimit)
      Deprecated.
      Retrieve the list of transaction history entries matching a set of search criteria
      Parameters:
      genericSearchValue - the value of a generic search field (optional; will be used to match submission OID, receipt number, tracking code, submit key or form code)
      clientId - the OID of the client to filter on (optional; note that client restrictions for the current user will be automatically applied)
      formStatus - the form status (optional; one of Submission.STATUS_Abandoned and Submission.STATUS_Completed)
      startDate - the lower bound on the request time (optional)
      endDate - the upper bound on the request time (optional)
      pageSize - the query page size
      fetchLimit - the query fetch limit
      Returns:
      the matching list of transaction history entries, limited to 10000 results
      Since:
      4.3.0
    • getFormSubmissionCount

      @Deprecated public int getFormSubmissionCount(Form form)
      Deprecated.
      Return the number of form submissions for the given form.
      Parameters:
      form - the form
      Returns:
      the number of form submissions for the given form.
    • getFormSubmissionCount

      @Deprecated public int getFormSubmissionCount(Client client)
      Deprecated.
      Return the number of form submissions for the specified client or all clients if not specified.
      Parameters:
      client - the client
      Returns:
      the number of form submissions for the given client.
    • getFormsMapFromSubmissionMetrics

      @Deprecated public List<Map<String,Object>> getFormsMapFromSubmissionMetrics(String clientCode)
      Deprecated.
      Gets the forms map from submission metrics.
      Parameters:
      clientCode - the client code
      Returns:
      the forms map from submission metrics
      Since:
      4.0.0
    • getRequestsForReportChartsByPeriod

      @Deprecated public List getRequestsForReportChartsByPeriod(String clientCode, String formCode, Date startDate, Date endDate, String period, boolean includeTestData, String requestOS, String requestBrowser)
      Deprecated.
      Return information about the requests made during a specified period.
      Parameters:
      clientCode - the client code associated with the request log (optional)
      formCode - the form code associated with the request log (optional)
      startDate - the lower bound on the request time
      endDate - the upper bound on the request time
      period - one of "Hourly", "Daily", "Weekly", "Monthly"
      includeTestData - whether to include requests made while the form was in test mode
      requestOS - the OS type to filter by (optional)
      requestBrowser - the browser type to filter by (optional)
      Returns:
      a list of DataRow objects
    • iterateOverTransactionsForLicensing

      public void iterateOverTransactionsForLicensing(org.apache.cayenne.ResultIteratorCallback<TransactionHistory> op)
      Iterates over the set of transactions that shall be published for licensing.
      Parameters:
      op - operation to perform on every object.
    • getLicensingCompletedTransactionStatistics

      public List<org.apache.cayenne.DataRow> getLicensingCompletedTransactionStatistics(String clientId, String formId, Date startDate, Date endDate, Boolean jobFilter, Boolean billableTransactionFilter, boolean publishedTransactionsOnly, List<Pair<Date,Date>> dateTimePairs, boolean useJobQuery)
      Return aggregate statistics on completed transactions during a certain time period.
      Parameters:
      clientId - the client ID (optional, may be inferred for non-global users)
      formId - the form ID (optional, can be set only if the client ID is also set)
      startDate - the overall start date (required)
      endDate - the overall end date (required)
      jobFilter - whether to filter on job_oid (if null, no filtering; if true, only job transactions are considered; otherwise only standalone transactions are considered)
      billableTransactionFilter - whether to filter on billable_flag (if null, no filtering; if true, only billable transactions are considered; otherwise only non billable transactions are considered)
      publishedTransactionsOnly - whether to exclude transactions that have not yet been published to S3
      dateTimePairs - the ordered list of start/end date periods that should be grouped on (required, should fall between startDate and endDate)
      useJobQuery - true if this query originates from the LicensingCompletedJobTransactionsPage
      Returns:
      the list of aggregates (one row per form, with the date periods as a set of dynamic columns)
      Since:
      17.10.0
    • getLicensingAbandonedTransactionStatistics

      public List<org.apache.cayenne.DataRow> getLicensingAbandonedTransactionStatistics(String clientId, String formId, Date startDate, Date endDate, Boolean jobFilter, Boolean billableTransactionFilter, boolean publishedTransactionsOnly, List<Pair<Date,Date>> dateTimePairs, boolean useJobQuery)
      Return aggregate statistics on abandoned delivered transactions during a certain time period.
      Parameters:
      clientId - the client ID (optional, may be inferred for non-global users)
      formId - the form ID (optional, can be set only if the client ID is also set)
      startDate - the overall start date (required)
      endDate - the overall end date (required)
      jobFilter - whether to filter on job_oid (if null, no filtering; if true, only job transactions are considered; otherwise only standalone transactions are considered)
      billableTransactionFilter - whether to filter on billable_flag (if null, no filtering; if true, only billable transactions are considered; otherwise only non billable transactions are considered)
      publishedTransactionsOnly - whether to exclude transactions that have not yet been published to S3
      dateTimePairs - the ordered list of start/end date periods that should be grouped on (required, should fall between startDate and endDate)
      useJobQuery - true if this query originates from the LicensingCompletedJobTransactionsPage
      Returns:
      the list of aggregates (one row per form, with the date periods as a set of dynamic columns)
      Since:
      17.10.0